【发布时间】:2021-10-13 11:39:12
【问题描述】:
我打开了 TextEdit。 我想在 TextEdit 中输入“hello”,但不是通过自己输入,而是使用终端中的命令。
我试过了:
osascript -e 'tell application "TextEdit" to keystroke "hello"'
但它给出了以下错误:
31:48: execution error: TextEdit got an error: Can’t get keystroke "hello". (-1728)
我做错了什么?
【问题讨论】:
-
错误的应用程序 - 系统事件 是执行击键的应用程序(查看应用程序的脚本字典)。
标签: terminal keystroke osascript