AppleScript:"预计行尾等,但发现标识符",小牛错误?

Eri*_*ist 6 applescript

我有一个简短的脚本,我开始处理我希望Spotify在AppleScript运行时搜索特定的歌曲,但我得到的错误似乎只是小牛队抱怨的事情(经过短暂的谷歌搜索) .

tell application "Spotify" to activate
delay 0.1
tell application "Spotify" to keystroke "l" using command down
Run Code Online (Sandbox Code Playgroud)

它说

语法错误:预期的行尾等,但找到了标识符

并指向"使用".现在,我只编写了很短的一段时间,但据我所知,这是很多人正在使用并且已经发布到SO和其他地方的确切语法.

有任何想法吗?

干杯

use*_*603 16

该命令keystroke属于Processes Suite.您可以使用系统事件调用它.

tell application "Spotify" to activate
delay 0.1
tell application "System Events" to tell process "Spotify"
    keystroke "l" using command down
end tell
Run Code Online (Sandbox Code Playgroud)

  • 你的第二个答案更好......你不应该在告诉应用程序"Spotify"中嵌套告诉应用程序"系统事件". (2认同)