我有一个 applescript-objc 脚本,其方法如下:-
on say_(phrase, userName)
set whatToSay to "\"" & phrase & " " & userName & "\""
say whatToSay
end say_
我想从objective-c调用这个方法,但似乎无法弄清楚如何调用具有多个参数的方法,我没有问题调用只有一个参数的方法,如下所示:-
@interface NSObject (ASHandlers)
- (void)say:(NSString *)phrase;
@end
@implementation AppDelegate
@synthesize window, sayTextField;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
scriptFile = NSClassFromString(@"Test");
if ( !scriptFile ){
// Handle errors here
return;
}
}
- (IBAction)say:(id)sender{
NSString *phrase = [sayTextField stringValue];
[scriptFile say:phrase];
}
请有人帮忙。
问候,安迪。