+- (ProcessSerialNumber)iTunesPSN
+{
+ ProcessSerialNumber number;
+ number.highLongOfPSN = kNoProcess;
+ number.lowLongOfPSN = 0;
+
+ while ( (GetNextProcess(&number) == noErr) )
+ {
+ CFStringRef name;
+ if ( (CopyProcessName(&number, &name) == noErr) )
+ {
+ if ([(NSString *)name isEqualToString:@"iTunes"])
+ {
+ return number;
+ }
+ [(NSString *)name release];
+ }
+ }
+ return number;