請問怎麼在applescript裡面使用按鍵偵測 - MAC

Table of Contents

各位大大好,我想用applescript寫出類似autohotkey的功能(要拿來玩暗黑三冰法)
只是上網搜尋不到如何在if後面添加按鍵觸發
這是目前我寫出來測試的:
tell application "TextEdit"
activate
end tell

tell application "System Events"
repeat while 4 is 4
tell process "TextEdit"
set frontmost to true
end tell
keystroke "w"
delay 0.01
keystroke "e"
delay 0.01
keystroke "r"
delay 0.3
end repeat
end tell

然後我想要達到當按下空白鍵時,電腦自動重複按WER

請問要怎麼寫或是用什麼軟體可以達成呢?

--

All Comments

Olive avatarOlive2013-10-05
可以試試fastscript 不保證可以就是了
Victoria avatarVictoria2013-10-08
感謝大大回應! 那請問可以用if (keys pressed) contains
來寫嗎?
Victoria avatarVictoria2013-10-09
fastscript是給你的script設定hotkey
Queena avatarQueena2013-10-13
所以就寫個script是重覆wer 然後這個script的hotkey
Regina avatarRegina2013-10-15
是空白鍵就好了
Daph Bay avatarDaph Bay2013-10-15
謝謝!馬上去試試看!