
[英]AppleScript -- Menu Item in the Menu Button popup is not selectable while using keystroke return or (key code 36) command
[英]Applescript: “key code” command not working
我正在尝试运行代码以打开应用并在其中执行键盘快捷键。 当我尝试运行代码时,在突出显示“键”的同时,收到一条消息:“预期行尾但找到了属性”。 “键码”是否注册为两个不同的命令?
tell application "Evernote"
activate
tell application "Evernote" keycode 45 using {command down, shift down}
end tell
您必须调用“系统事件”才能使用UI脚本。
tell application "Evernote"
activate
delay 1
tell application "System Events"
tell process "Evernote" to key code 45 using {command down, shift down}
end tell
end tell
有关更多信息,请访问http://macbiblioblog.blogspot.com/2014/12/key-codes-for-function-and-special-keys.html
key code
属于System Events
,由两个词组成
tell application "System Events" to key code 45 using {command down, shift down}
由于击键总是发送到最前端的应用程序,因此在明确地将其激活后,实际上不需要引用目标进程。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.