我想發送擊鍵到使用AppleScript的應用程序VisualBoyAdvance,但我無法讓它工作。應用程序不接受按鍵
我的代碼,到目前爲止,是這樣的:
tell application "VisualBoyAdvance"
activate
tell application "System Events"
keystroke "k"
end tell
end tell
當我直接告訴VisualBoyAdvance,我得到這個錯誤:
error "VisualBoyAdvance got an error: Can’t get keystroke \"k\"." number -1728 from keystroke "k"
我曾嘗試直接告訴VisualBoyAdvance了,我也試着使用key code 40
,但我仍然無法使其工作。奇怪的是,這樣做的工作:
tell application "VisualBoyAdvance"
activate
tell application "System Events"
keystroke "d" using {command down}
end tell
end tell
但是,這是一個快捷鍵,在菜單欄上顯示出來,所以我想這將是一個有點不同。
如何使用AppleScript模擬按鍵並使應用程序響應它?如果我不能爲此使用AppleScript,還可以使用其他什麼?
你有輔助設備支持打開? – alesplin 2010-03-02 19:41:47
這有什麼好運? – 2014-04-18 01:57:59