Reputation: 8076
I call and execute apple script in main thead below
NSAppleScript *as = [[NSAppleScript alloc]
initWithSource:@"tell application \"Finder\" to sleep"];
[as executeAndReturnError: NULL];
[as release];
but does not work, while the script
tell application Finder to sleep
works well in AppleScript Editor.
your comment welcome
Upvotes: -1
Views: 919
Reputation: 17218
This is the way to examine the result and error from -executeAndReturnError:
NSDictionary *errors = nil;
NSAppleEventDescriptor *result = [as executeAndReturnError:&errors];
NSLog(@"result: %@", result);
NSLog(@"errors: %@", errors);
Upvotes: 4