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:

        BOOL         ExcelActive = NO;
        NSWorkspace  *workSpace;
        NSArray      *runningAppDictionaries;
        NSDictionary *aDictionary;
        
        workSpace = [NSWorkspace sharedWorkspace];
        runningAppDictionaries = [workSpace launchedApplications];
        
        for (aDictionary in runningAppDictionaries) {
                
if ([[aDictionary valueForKey:@"NSApplicationName"] isEqualToString:@"Microsoft Excel"]) {
                        ExcelActive = YES;
                        break;
                }
                
        }
        
        return ExcelActive;

Same NO return value.

I then tried this variation, with the same NO return value:

        NSArray *applArray;
        
        applArray = [[[[NSWorkspace sharedWorkspace] launchedApplications]
filteredArrayUsingPredicate:[NSPredicate predicateWithFormat: @"%K contains %@", @"NSApplicationName", @"Microsoft Excel"]] valueForKey:@"NSApplicationName"];

        if ([applArray count] > 0)   return YES;
        else                         return NO;


One footnote .. there are problems with Microsoft Excel as reported by HAS of appscript. He points out difficulties with Excel, in particular, with respect to Excel documents. Don't know about the app- level.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to