My current script functions like this and gives me a set amount of time for me to make a gesture with my trackpad:
tell application "System Events"
key down {control}
delay 1
key up {control}
end tell
Instead of the timed delay, I need the ‘key up’ only delayed while I move my cursor with the trackpad to form a gesture. When I finish the gesture by lifting my finger off the trackpad I need the “key up” after it being ‘key down’ while I’m gesturing. Something like this:
(The parts in bold tags aren’t code, it’s just explaining what I’d like the actual code to do there)
tell application "System Events"
key down {control}
[b]repeat until "trackpad event starts and stops"[/b]
[b]if no trackpad event after 0.5 seconds then key up[/b]
key up {control}
end tell
Shane Stanley provided an example of a script waiting for a mouse click here: https://macscripter.net/viewtopic.php?id=44549
I don’t know ASObjC well enough to know if it’s possible to wait for a gesture or to try to adapt this script, but perhaps it would be a useful example to you or anyone else trying to help.
Thank you for the link. That shows it may be possible, but I’m having trouble making sense of which parts of the script I would use. Thanks again for the lead though!
Thank you for the clarification. That said, do you know if this is possible with AppleScript? And, if so, could you point me to the right direction to implement?
But I thought you were looking for code to wait until you had completed a trackpad gesture, and trigger the execution of more code upon completion.
If you’re just looking to automate the mouse via code, that is very doable. It’s waiting until a gesture is completed that none of us seem to have a solution to.