预期行尾等,但找到“脚本”

时间:2018-07-20 08:34:05

标签: macos applescript

我写了一个非常基本的苹果脚本,它打开iTerm并转到文件:

tell application "iTerm"
    activate
    do script "cd ~" in tab 1
end tell

但是,如果我尝试运行此命令,则会得到Syntax Error

Expected end of line, etc. but found “script”.

知道为什么会这样吗?

此脚本中是否存在一些不正确的语法?

1 个答案:

答案 0 :(得分:2)

是的,事实证明语法不正确。

这有效:

tell application "iTerm"
    create window with default profile
    tell current session of current window
        write text "cd ~"
    end tell
end tell