• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSWorkspace launchApplication: vs NSAppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSWorkspace launchApplication: vs NSAppleScript


  • Subject: NSWorkspace launchApplication: vs NSAppleScript
  • From: Nir Soffer <email@hidden>
  • Date: Tue, 30 May 2006 22:33:23 +0300

According to the documentation, NSWorkspace -launchApplication should launch an app synchronically, and returns a boolean result.

However, this code does return a success, but checking for the active application little later does not return the expected result. This happen randomly, sometime it works and sometime not.

if (! [[NSWorkspace sharedWorkspace] launchApplication:@"Microsoft PowerPoint"])
STFail(@"SkipTest: can't launch Microsoft PowerPoint");


This code works:

    NSAppleScript *script = [[NSAppleScript alloc] initWithSource:
        @"tell application \"Microsoft PowerPoint\" to activate"];

NSDictionary *error = nil;
NSAppleEventDescriptor *event = [script executeAndReturnError:&error];
[script release];
if (event == nil)
STFail(@"SkipTest: can't activate PowerPoint: %@",
[error objectForKey:NSAppleScriptErrorMessage]);


I'm activating in a fixture setUp, and verify the active application using NSWorkspace -activeApplication in a test method.


Is this a bug or I'm missing something?


Best Regards,

Nir Soffer

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Accessing System default sounds
  • Next by Date: [ANN] -- Atimi seeks Cocoa programmer
  • Previous by thread: Re: Changing from Java to OBJ-C
  • Next by thread: Re: NSWorkspace launchApplication: vs NSAppleScript
  • Index(es):
    • Date
    • Thread