1
在Xcode中運行我的AppleScript代碼如下:變量傳遞到一個AppleScript
NSString *path = [[NSBundle mainBundle] pathForResource:@"Script" ofType:@"scpt"];
NSAppleScript *script = [[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:nil];
[script executeAndReturnError:nil];
之前執行它,我想知道是否有可能將一些變量爲它的使用。換句話說,我想將我的應用程序中的變量傳遞給applescript。
該解決方案替換它們並不好,因爲它會導致重新編譯腳本每次都可能是低效的。這不是真正的參數傳遞問題。更合適的答案在這裏:http://stackoverflow.com/questions/6963072/execute-applescript-from-cocoa-app-with-params – 2014-07-04 14:12:18