涉及击键的 Applescript 错误
Applescript error involving keystrokes
构建 applescript 代码后,出现此错误。 error "Can’t get keystroke \"2\"." number -1728 from keystroke "2"
我不知道这是什么意思,也不知道如何解决。我的代码应该提出问题,打开便签,然后将返回的文本键入框中。我下面的代码一直有效到第 5 行的 keystroke a
。有人知道这个问题吗?这让我烦恼了很久,如果有任何帮助,我将不胜感激。
set a to text returned of (display dialog "What is your name?" with title "Yo name" with icon 2 default answer "" buttons {"Continue…"} default button 1 giving up after 25)
(...)
delay 1
tell application "Stickies" to activate
delay 1
keystroke a
keystroke space
(...)
您需要告诉系统事件来击键它,这是您的新代码!
set a to text returned of (display dialog "What is your name?" with title "Yo name" with icon 2 default answer "" buttons {"Continue…"} default button 1 giving up after 25)
delay 1
tell application "Stickies" to activate
delay 1
tell application "System Events"
keystroke a
keystroke space
end tell
在击键中使用using命令,这里:
tell application "System Events" to keystroke "+" using command down
构建 applescript 代码后,出现此错误。 error "Can’t get keystroke \"2\"." number -1728 from keystroke "2"
我不知道这是什么意思,也不知道如何解决。我的代码应该提出问题,打开便签,然后将返回的文本键入框中。我下面的代码一直有效到第 5 行的 keystroke a
。有人知道这个问题吗?这让我烦恼了很久,如果有任何帮助,我将不胜感激。
set a to text returned of (display dialog "What is your name?" with title "Yo name" with icon 2 default answer "" buttons {"Continue…"} default button 1 giving up after 25)
(...)
delay 1
tell application "Stickies" to activate
delay 1
keystroke a
keystroke space
(...)
您需要告诉系统事件来击键它,这是您的新代码!
set a to text returned of (display dialog "What is your name?" with title "Yo name" with icon 2 default answer "" buttons {"Continue…"} default button 1 giving up after 25)
delay 1
tell application "Stickies" to activate
delay 1
tell application "System Events"
keystroke a
keystroke space
end tell
在击键中使用using命令,这里:
tell application "System Events" to keystroke "+" using command down