I’m handicapped so I am unable to use the scroll wheel on the mouse. What I’m trying to achieve
when moving the mouse in an upward gesture with cmd hold down, enter a loop:
simulate scroll wheel up x amount,
wait a small amount of time.
repeat loop until cmd key released
I have this working more or less. Please see attachment. Needless to say, I have a mirror action that does the reverse.
I want to add a wrinkle: if I move the mouse the other direction, I want to exit this macro and execute the mirror macro (wheel up), without having to release the cmd key. It’ll make a seamless action where the cmd key acts as a wheel scroll trigger in either direction until let go.
I hope this makes sense. I thought maybe the cancel macro action would do the trick, but no it does nothing really.
Any help is appreciated. Also, if you have any suggestion on another way to tackle this, please feel free. Thanks in advance.
You don't cancel a macro -- you cancel an executing instance of a macro, and that requires targeting it via an Instance UUID.
There's no single-Action way to do this. You'll need to get all the currently-executing instances using the %ExecutingInstances% Token, find out the name of the macro for each of those using [%ExecutingInstanceName%](token:ExecutingInstanceName [Keyboard Maestro Wiki]), and cancel any instance whose macro name matches what you want to cancel.
Something like this should do it (untested), replacing your "Cancel" Action:
"Cancel All Macros" really does cancel all macros -- including the one you are running it from which is your "new scroll direction" macro.
You'll have better results with "Cancel All Other Macros", which will leave the current one running -- but it's a blunt instrument. It will, for example, also cancel a background macro you have Copying files, leaving that job in an unknown state. And once you get into KM you'll start making just such background macros.
Try the "cancel by UUID" approach above -- it's a lot more... surgical.
That is what I wrote, “Cancel all other macros”. I know it’s a blunt instrument, but I just wanted to test my concept and it doesn’t appear to work. It still scrolls in the original direction even though I gesture the mouse decisively the other way – as long as I have cmd held down. I have to let go of cmd first and move the mouse the other way. Somewhat more coordination than it’s worth.
Apologies -- since you didn't say why you changed I thought it was worth an explanation of the different approaches.
Back to the actual problem...
Try your "Cancel all other macros" version again, but set the "Pause" in each to 1 second. That should work as you want. Then start reducing the pauses to the point where things break, then increase by a 10th of a second.
What I think is happening is that your simulated scroll is happening during the mouse drag that is supposed to trigger the next macro -- the simulated event is interrupting the hardware event and the KM Engine doesn't register it. So you need a pause long enough that you can do the entire mouse movement between scroll repetitions.
You'll be able to go faster if you use hot key triggers (maybe ⌘↑ and ⌘↓) as they are near-instantaneous. Or if you've a multi-button mouse you might be able to use one of those as the trigger button. Otherwise, try registering as short a gesture as possible as the trigger.
You nailed it. Adding a larger pause makes it work. Unfortunately, there isn’t a sweet spot of it working at all and working smoothly. I’m better off creating a plain old hot key trigger.
Multi buttons mice are usually oversized and don’t work for me. I think I’ll try better touch tool for this one.