涉及击键的Applescript错误

涉及击键的Applescript错误,applescript,keystroke,Applescript,Keystroke,在生成applescript代码后,我遇到了这个错误错误“无法从击键“2”中获取击键\“2\”编号-1728,我不知道这是什么意思,也不知道如何修复它。我的代码应该询问这个问题,打开胶粘物,然后将返回的文本键入框中。我下面的代码一直工作到第5行的击键a。有人知道这个问题吗?这已经困扰了我这么久了,我将感谢任何帮助 set a to text returned of (display dialog "What is your name?" with title "Yo name" with ico

在生成applescript代码后,我遇到了这个错误<代码>错误“无法从击键“2”中获取击键\“2\”编号-1728,我不知道这是什么意思,也不知道如何修复它。我的代码应该询问这个问题,打开胶粘物,然后将返回的文本键入框中。我下面的代码一直工作到第5行的
击键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命令down,如下所示:

tell application "System Events" to keystroke "+" using command down

非常感谢。我试试看!在这里,如何在applescript中执行类似于
Command+
的操作(通过击键)