AppleScript: "Expected end of line, etc. but found identifier",Mavericks错误?

标签 applescript

我有一个简短的脚本,可以在运行AppleScript后开始在Spotify搜索特定歌曲的地方开始工作,但是出现此错误似乎只是小牛在提示(经过一小段谷歌搜索之后) 。

tell application "Spotify" to activate
delay 0.1
tell application "Spotify" to keystroke "l" using command down

它说

Syntax Error: Expected end of line, etc. but found identifier



并指向“使用”。现在,我只是编码了很短的时间,但是据我所知,这是很多人正在使用并已发布到SO和其他地方的确切语法。

有任何想法吗?

干杯

最佳答案

命令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

关于AppleScript: "Expected end of line, etc. but found identifier",Mavericks错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23266980/

相关文章:

list - 如何将 AppleScript 列表转换为字符串

AppleScript : Trying to write in a TextEdit file

macos - 在 Mac OS 中以编程方式选择查找器中的多个文件

macos - 如何从 SwiftUI View 中运行 AppleScript?

macos - 在 IntelliJ IDEA 中构建的 applescript

javascript - 通过 AppleScript 使用 Javascript 获取图像尺寸

Java 在新终端 (mac osx) 中开始运行命令 - 进程生成器未正确运行 osascript

applescript - 如何使用applescript在photoshop(cs5)中获取当前打开文件的路径?

objective-c - 使用 Mail.app 从 Cocoa 发送 HTML 邮件

macos - 如何从终端启动 applescript.scpt 文件并传递术语/变量?