本文介绍了使用 Applescript 执行复杂的击键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在 Automator 中编写一个 Applescript,它会在按住 control、option 和 command 的同时按下左箭头按钮.我到目前为止的代码是:
I'm trying to write an Applescript in Automator that will press the left arrow button while holding down control, option, and command. The code I have so far is:
on run {input, parameters}
tell application "System Events"
tell application "Sublime Text 2" to activate
keystroke "left" using {control down, option down, command down}
end tell
return input
end run
然而,这是行不通的.有关如何修复此代码的任何建议?谢谢!
However, this is not working. Any suggestions as to how to fix this code?Thanks!
推荐答案
当使用箭头键时,您需要通过键码来定位它们.
When using arrow keys you need to target them via key code.
tell application "Sublime Text 2" to activate
tell application "System Events"
key code 123 using {control down, option down, command down}
end tell
箭头键代码
- 左:(密钥代码 123)
- 右:密钥代码 124)
- UP:(密钥代码 126)
- 向下:(键码 125)
这篇关于使用 Applescript 执行复杂的击键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!