我正在从输入源读取击键和键码,并希望使用此输入来模拟键盘输入。
例如,我可能会收到输入"向下发送30页然后发送10''"
set theKey to key code 119
- > A identifier can’t go after this property.
set theKey to (key code 119)
- > Expected “,” but found identifier.
tell application "System Events" to keystroke "a"
tell application "System Events" to key code 119
如下所示:
tell application "System Events" to send theKey to application "Text Edit"
但如果事先我不知道是keystroke
还是key code
我想发送给系统事件,该怎么办?