Using Applescript to Execute a Complicated Keystroke

前端 未结 2 1876
南方客
南方客 2020-12-31 01:12

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:



        
2条回答
  •  傲寒
    傲寒 (楼主)
    2020-12-31 01:57

    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
    

    ARROW KEY CODES

    • LEFT: (key code 123)
    • RIGHT: key code 124)
    • UP: (key code 126)
    • DOWN: (key code 125)

提交回复
热议问题