我的代码如下所示:
NSMutableString* cmd = [NSMutableString new];
[cmd appendString:@"script createScriptFile\n"];
[cmd appendString:@"beep\n"];
[cmd appendString:@"end script\n"];
[cmd appendString:@"store script createScriptFile in \"/tmp/narg.scpt\"\n"];
NSAppleScript* script = [[NSAppleScript alloc] initWithSource:cmd];
NSDictionary* err = nil;
NSAppleEventDescriptor *result = [script executeAndReturnError:&err];
运行良好且没有错误,但生成的脚本文件(narg.scpt)如下所示:
script createScriptFile
beep
end script
store script createScriptFile in "/tmp/narg.scpt"
我想要的是narg.sctp看起来像这样:
beep
我做错了什么?
谢谢, 克里斯