Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-14 Thread Andy Lee
On Dec 14, 2008, at 6:35 AM, John Love wrote: BOOL ExcelActive = NO; NSWorkspace *workSpace; NSArray *runningAppDictionaries; NSDictionary *aDictionary; workSpace = [NSWorkspace sharedWorkspace]; runningAppDictionaries =

Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-14 Thread John Love
On Dec 13, 08, at 12:21 PM, Jean-Daniel Dupas wrote: Because operator overriding does not exists in Obj-C and so, == is a pointer comparaison and not a string comparaison. use the isEqual: method to compare two object. Thanks to everyone who chimed in .. and here are my changes:

Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread John Love
I do not understand why this code completes with the specified application not being active .. when it really is? I really need your help. BOOL AppActive = NO; NSWorkspace *workSpace; NSArray *runningAppDictionaries; NSDictionary *aDictionary;

Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread Jean-Daniel Dupas
Le 13 déc. 08 à 18:14, John Love a écrit : I do not understand why this code completes with the specified application not being active .. when it really is? I really need your help. BOOL AppActive = NO; NSWorkspace *workSpace; NSArray

Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread jmunson
Specifically, in his case, wouldn't it be: aDictionary valueForKey:@NSApplicationName] isEqualToString: @MyApplication ? Quoting Jean-Daniel Dupas devli...@shadowlab.org: Le 13 déc. 08 à 18:14, John Love a écrit : I do not understand why this code completes with the specified

Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread Jean-Daniel Dupas
Yes, you can use this variant in this case, but the result will be the same. Quote from isEqualToString: documentation «When you know both objects are strings, this method is a faster way to check equality than isEqual:» Le 13 déc. 08 à 18:41, jmun...@his.com a écrit : Specifically,

Re: Using NSWorkspace's launchedApplication to detect running App

2008-12-13 Thread Michael Ash
On Sat, Dec 13, 2008 at 12:14 PM, John Love jote...@charter.net wrote: if ([aDictionary valueForKey:@NSApplicationName] == @My Application) { In addition to what the others have said, you should be checking the bundle ID if at all possible, not the name. A bundle ID is (intended