Hello,
KM either has enough low level ability for click and hold, or doesn't get in the way of shell commands to click and hold.
I must have messed up, I didn't release I had to authorize accessibility for terminal in addition to MouseTools for MouseTools to work. I thought Apple would at least let terminal have control. Anyway, once I did that, I can use this shell script to click and hold:
However, new problem:
- The first time the macro is initiated it works perfectly. I can click on a GUI object, and move it around with a trackball.
- When I trigger a release of the macro, and then reinitiate the macro it seems to initiate a double click all on its own. Double click resets the GUI item I'm trying to adjust by click and hold:
https://drive.google.com/file/d/1baPuS6tNkQhuYBm-dY-GusS8erNS85lT/view?usp=sharing
- Third time I initiate click and hold macro it works again. All though sometimes it doesn't engage, and occasionally, like the very first action you see and very last action you see, it errors by jumping the GUI selection to the end of the circle.
Just to be clear, I think the goal is to create an action of some kind that continues to hold the left click down, once the macro is "finished". Like this in controller mate:
![button_down_macro_release](https://forum.keyboardmaestro.com/uploads/default/original/3X/2/0/2069e56a1edddc4788bf085ffd7f3c715bd5f2b4.png)
Sorry, I have no idea what MouseTools does or how it behaves.
You can use the Keyboard Maestro Click Mouse action to click and hold (as long as the macro remains running). Whether that will behave any better for you I have no idea.
But I don't have any idea what MouseTools does or how it might interact with Keyboard Maestro simulated events.
Keyboard Maestro simulated modifier events typically only last until a real event happens, at which point the Mac knows what the state of the modifier keys are. I don't know whether that applies to the mouse buttons as well.
This macro does NOT HOLD the left mouse button.
When I trigger the macro, it clicks at the current mouse position, but then when I manually move the mouse, the window I clicked on does NOT move. Or, if it clicks on text, the text is NOT selected when I move the mouse.
What am I doing wrong?
MACRO: Click Mouse Button and Hold Until Keystroke [Example
-~~~ VER: 1.0 2021-02-11 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
DOWNLOAD Macro File:
Click Mouse Button and Hold Until Keystroke [Example.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
You cannot mix and match simulated events and real events. They each have their own state.
So if Keyboard Maestro clicks & holds the button, and then you move the mouse - your mouse movement includes the fact that the button is not down.
Same for modifiers. If you Press and Hold the Shift key with Keyboard Maestro and then type a character on the keyboard, it wont be capitalised.
OK, so are you saying that there is no way to use KM to "click and hold" a mouse button while allowing the user to move the mouse?
If so, please update the KM Wiki on Move and Click to so clarify.
Hello @peternlewis, @JMichaelTX,
I appreciate your responsiveness.
I also tried just a shell command click and hold with MouseTools as the only action in the macro with one trigger (configured everyway I could) And another shell command macro for release (with a different trigger).
It works better on the desktop, but was still buggy. Like if I drag far enough the clicked on object releases, and any object I pass over gets held and can be dragged about the same distance.
Mousing seems to actually be kinda hard. I know Tangent, which makes the best after makers controllers for DaVinci Resolve, had to change their whole programming approach because the mouse emulation interfered with the OS and the physical mouse. Controllermate has to be quit, and their library app ControllermateHelper has to work in the background for click and hold to work. I don’t really know how CommanPost, Tangent, BetterTouchTools and Macroworks (windows) are doing it, but they are the only apps I’m familiar with that this works.