构建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
(...)
答案 0 :(得分:2)
你需要告诉系统事件按键,这是你的新代码!
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
答案 1 :(得分:0)
在击键中使用using命令,在这里:
tell application "System Events" to keystroke "+" using command down