arachide
arachide

Reputation: 8076

AppleScript executed with NSAppleScript does not work

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

Answers (1)

paulmelnikow
paulmelnikow

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

Related Questions