Reputation: 104
I would like to call a IBAction within a cocoa app from applescript:
I want to call:
- (IBAction)reverse:(id)pId;
{
direction = -1;
}
with a line in an external applescript file like:
tell application "theapp"
reverse
end tell
Any Ideas?
Thanks in Advance
Upvotes: 0
Views: 246
Reputation: 3601
Use NSAppleScript.
NSAppleScript *as = [[NSAppleScript alloc] initWithSource:@"tell application \"theapp\"\nreverse\nend tell"];
NSDictionary *err = nil;
NSAppleEventDescriptor *desc = [as executeAndReturnError:&err];
NSLog(@"Error: %@\nData: %@", err, desc.data);
[as release];
There is also a good answer about Scripting Bridge
here
Upvotes: 1