我有以下代码:
NSAppleScript* playPause = [[NSAppleScript alloc] initWithSource:
@"tell application \"Xcode\"to activate \n to open POSIX file \"beetSapper.xcodeproj""\n"
@"end tell"];
[playPause executeAndReturnError:NULL];但是它没有打开文件"beetSapper“,我猜我写字符串的方式不起作用。有人能演示一下如何正确地编写这个命令吗?谢谢
发布于 2016-08-25 12:44:27
代码中的to太多。
由于Xcode还接受POSIX路径,因此您可以编写
tell application "Xcode"
activate
open "/Users/myUser/Documents/beetSapper.xcodeproj/"
end tell"stringyfied“的等价物是
"tell application \"Xcode\"\n activate\n open \"/Users/myUser/Documents/beetSapper.xcodeproj/\"\n end tell"请注意,您必须指定项目文件的完整路径,以斜杠开头。
发布于 2019-10-09 17:07:06
tell application "Xcode"
open file "Macintosh HD:Users:YourUserName:YourFolder:YourFolder:YourFileProject.xcodeproj"
end tellhttps://stackoverflow.com/questions/39133862
复制相似问题