I am working on some macros to control the mouse via the keyboard.
I want to particular hotkey to initiate a drag... that is, click and hold, allowing me to move the mouse to drag as I move. Then I want another hotkey to release the mouse button.
Okay, update. I figured out some of this. The macro only holds the mouse button as long as the macro is running, so I need to add a “pause until” the condition that “v” is up, then add a mouse release action.
This ALMOST works. It works for certain kinds of drags. However, what I was really hoping to do was use this as part of Photoshop painting work. It works okay when dragging out rectangles in Photoshop, but it does not work when painting with a brush. In the latter situation, when I press “v”, the brush will put down one little spot of paint and then act like the mouse button isn’t pressed. Even as I move the mouse pointer around (holding down “v”) the brush will not be painting, Then when I release V, suddenly a line of paint will appear.
I am not sure what Photoshop thinks the mouse is doing.
Can I get any suggestions as to any known anomalies in the way KM operates the mouse from within macros that might provide a clue why it is behaving this way?
Is there any way to simulate a mouse drag that is functionally identical to dragging with the physical mouse?
I don’t see the mouse release action here, but otherwise that’s basically the idea.
I have played around with this a lot, and I don’t have a good feel for what KM is doing with the mouse when used with Photoshop. I’ve tried variations on this macro, and I can never predict what is going to happen. In general there seems to be some delay before Photoshop recognizes that the mouse has moved, and then it jumps all at once to a different location, sometimes taking a straight line, sometimes taking the actual mouse trajectory (but delayed).
I’m having the similar problem. I’m trying to do this in Xcode for control-drag. Mouse moves to the right place, but it’s not being dragged. I even tried to record the movement. It definitely worked while recording, but it doesn’t work when I execute the recorded action.
@peternlewis, could you duplicate this problem in Xcode? Basically, I just tried make a testing macro to control drag an object to make an connection in storyboard. Thanks!
You cannot generally mix simulated and non-simulated events.
When you move the mouse yourself, the event does not include the fact that the mouse is down.
So the macro as shown will generally not work in a useful way. It will press and hold the mouse and keep it pressed until the macro ends (@mike1127: the mouse will be automatically released when the macro ends) or an action releases it, or until you perform some actual UI action which will include an event that does not have the mouse pressed.
Thanks @peternlewis for the clarification. I tried both on Xcode, and it doesn’t seem to work.
Single action.
Click left button with control at x1,y1 and drag to x2,y2
Custom move
Action 1 Click left button with control at x1,y1 and and hold
Action 2: Move mouse to x2,y2
If I understand correctly, the second method won’t work because action 1 will release the mouse before action 2?
Could you let me know how I can get control-drag on Xcode to work for making connections in storyboard?
Thanks!
This method works for creating an outlet, presumably it would work in a storyboard.
Click at the source location and hold the control key and mouse button.
Move the mouse in at least two steps, with pauses.
Release the mouse button and the control key.
Hi Peter, thanks for looking into this.
I’m a blind user, so I can’t see the example picture.
Could you do me a huge favor and post the macro example, so I can import
and examine?
I’d really appreciate it.
Thanks!
@peternlewis
Hello Mike (and Peter),
You seem to be familiar with KBM mouse control.
I have been unable to find an answer to my question in the forum, including posting a question.
Would you know how to create an action to simply mouse left click at the current position 1,2,3 or 4 times ?
If the user has a trackpad, would the mouse action trigger the same effect as a simple tap, or should I use a different action?
thanks very much in advance for your time and help
Thank you for your reply.
Just in case, you would like to know: repeated mouse clicks only work if they are set as single, double, triple click.
The repeat action does not work for mouse clicks, even adding a pause.
That being said, you solved my problem and I am very grateful.
Thanks again for your help
thank you for your answer.
Triple click I understand.
Could you give me an example where 3 clicks (3x - repeat- 1 click) would do anything?
I tested it and it does nothing.
After lookning for a solution like this for ages i found Dwell Click.
Simple app but works flawlessly, Just map a key to drag and hold
Hit the mapped key and it does exactly what you want. dragging a window, drawing in photoshop, pulling sliders, cropping in lightroom. All works until you hit the key again.
I mapped my left shift to F15 when pressed alone ( using karabiner )
Then mapped the f15 to drag and hold in Dwell Click.
I then use Keyboard maestro to map the F15 to my midi controller buttons or playstation controller to have the same drag and hold funct ionality.