使用AppleScript来执行复杂的按键 [英] Using Applescript to Execute a Complicated Keystroke

查看:2841
本文介绍了使用AppleScript来执行复杂的按键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Automator中,同时按住控制,选项和命令,将preSS向左箭头按钮来写一个AppleScript。在code我至今是:

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

但是,这是行不通的。任何建议,如何解决这个问题code?
谢谢!

However, this is not working. Any suggestions as to how to fix this code? Thanks!

推荐答案

在使用箭头键,您需要通过关键code对其进行定位。

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

箭头键codeS


  • LEFT:(关键code 123)

  • 右键:关键code 124)

  • UP:(键code 126)

  • DOWN:(键code 125)

这篇关于使用AppleScript来执行复杂的按键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆