使用 Applescript 打字 [英] Typing with Applescript
本文介绍了使用 Applescript 打字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用 applescript 为您提供我的 mac 类型?我想要的是:编译时,这个applescript 会输入一个短语,然后按回车键.有没有模拟按键的代码?
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?
推荐答案
keystroke
命令对你有用.
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"
这篇关于使用 Applescript 打字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文