Is it possible to run an AppleScript code inside an Cocoa Application?
I've tried NSAppleScript class, but no success.
Also, does Apple allow this?
See Question&Answers more detail:osIs it possible to run an AppleScript code inside an Cocoa Application?
I've tried NSAppleScript class, but no success.
Also, does Apple allow this?
See Question&Answers more detail:osSolved!
Xcode wasn't saving my script file into app's resources path. To run an AppleScript code from Cocoa Application, use this:
NSString* path = [[NSBundle mainBundle] pathForResource:@"ScriptName" ofType:@"scpt"];
NSURL* url = [NSURL fileURLWithPath:path];NSDictionary* errors = [NSDictionary dictionary];
NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:url error:&errors];
[appleScript executeAndReturnError:nil];
[appleScript release];