NSWorkspace launchApplication: vs NSAppleScript
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