【问题标题】:Expected end of line, etc. but found “script”预期行尾等,但找到“脚本”
【发布时间】:2018-07-20 08:34:04
【问题描述】:

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

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

如果我尝试运行它,我会得到一个Syntax Error

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

知道为什么会这样吗?

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

【问题讨论】:

  • 这适用于终端应用程序。对于 iTerm,语法不同,你的答案很好

标签: macos applescript iterm2


【解决方案1】:

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

这行得通:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多