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,所以如果我在其他地方搞砸了,请告诉我。