Macos applescript不从终端运行

Macos applescript不从终端运行,macos,shell,terminal,applescript,Macos,Shell,Terminal,Applescript,为什么我的applescript不能从终端运行?我可以从编辑器中成功运行它 我运行命令 /usr/bin/osascript -e my_script.scpt 我犯了一个错误 0:12:语法错误:未知令牌无法跟随此标识符。(-2740) 我的剧本 set volume 2 set x to 0 open location "spotify:user:wunspe:playlist:meininki" tell application "Spotify" set the sound v

为什么我的applescript不能从终端运行?我可以从编辑器中成功运行它

我运行命令

/usr/bin/osascript -e my_script.scpt
我犯了一个错误

0:12:语法错误:未知令牌无法跟随此标识符。(-2740)

我的剧本

set volume 2
set x to 0
open location "spotify:user:wunspe:playlist:meininki"
tell application "Spotify"
    set the sound volume to 0
    play
    repeat 10 times
        if sound volume is less than 70 then
            set sound volume to (sound volume + 10)
            set x to (x + 9)
            set volume output volume x without output muted --100%

            delay 3
        end if
    end repeat



end tell
要运行已编译的脚本(文件),您必须省略
-e
标志,并传递脚本的完整路径

/usr/bin/osascript /Users/myUser/path/to/my_script.scpt
如果你写信

osascript -e "set Volume 10"
-e
之后是脚本的全部内容

如果您将其放入某个文件(我们称之为
volume.scpt

您可以按以下方式调用脚本文件:

osascript /path/to/volume.scpt
osascript /path/to/volume.scpt