开发者

Typing with Applescript

开发者 https://www.devze.com 2023-04-11 02:38 出处:网络
Is it possible to have my mac type for you with applescript? What I want is this: when compiled, this applescript will type a phrase, then press enter. Is there any code simulating the pressing 开发者

Is it possible to have my mac type for you with applescript? What I want is this: when compiled, this applescript will type a phrase, then press enter. Is there any code simulating the pressing 开发者_开发问答of keys?


The keystroke command will work for you.

tell application "System Events" to keystroke "A phrase" & return & "Another phrase"

If you want a specific application to do the typing, just do something along these lines:

tell application "System Events" to tell process "TextEdit" to keystroke "A phrase" & return & "Another phrase"


Yes, look at keystroke and key down in System Events > Processes Suite, though you have to turn on Universal Access

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号