按住 Applescript 中的制表符
Hold down tab in Applescript
我想在 chrome 中按住 Tab 键并按回车键。我需要一个 Applscript 来自动化它。我试过:
tell application "System Events" to keystroke return while tab down
和
key down tab
tell application "System Events" to keystroke return
key up tab
和
key down (key code 48)
tell application "System Events" to keystroke return
key up (key code 48)
None 其中 运行 因为它给出了语法错误:"Expected end of line, etc. but found application constant or consideration."
我认为问题在于 "tab" 不是用来帮助按下的键。以上肯定适用于命令、选项或控制。我还没有尝试过其他键,看看哪些可以用,哪些不行。
不幸的是,普通的 AppleScript 无法做到这一点; key up/down 仅影响修饰键 command、option、control 和 shift
我想在 chrome 中按住 Tab 键并按回车键。我需要一个 Applscript 来自动化它。我试过:
tell application "System Events" to keystroke return while tab down
和
key down tab
tell application "System Events" to keystroke return
key up tab
和
key down (key code 48)
tell application "System Events" to keystroke return
key up (key code 48)
None 其中 运行 因为它给出了语法错误:"Expected end of line, etc. but found application constant or consideration."
我认为问题在于 "tab" 不是用来帮助按下的键。以上肯定适用于命令、选项或控制。我还没有尝试过其他键,看看哪些可以用,哪些不行。
不幸的是,普通的 AppleScript 无法做到这一点; key up/down 仅影响修饰键 command、option、control 和 shift