0

我的代码如下所示:

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

我究竟做错了什么?

谢谢,克里斯

4

0 回答 0