0
我無法弄清楚如何檢測在AppleScript中按下的按鍵以及如何延遲直到該密鑰被釋放。我想爲縮放製作一個切換,並且我還有其他一切(我認爲)。這是我目前的代碼檢測按鍵和延遲直到密鑰被釋放AppleScript
on idle
set ztoggle to 0
repeat
--how do i make it so a key is needed to run this loop? maybe an 'if (im not sure what to put here) then' loop?--
if (ztoggle = 1) then
set ztoggle to 0
else if (ztoggle = 0) then
set ztoggle to 1
end if
--how do i make it so the program waits at this line until the key from before is released? i was thinking delay, but im not sure--
if (ztoggle = 1) then
tell application "System Events"
key code 28 using {option down, command down}
end tell
end if
set ztoggle to 0
end repeat
end idle
有沒有人知道我該怎麼做?此外,這是我第一次嘗試使用AppleScript,所以如果我在其他地方搞砸了,請告訴我。