Click & Hold, Drag, Release... Not Working


New to KM.

I need to create a macro that allows me to click on a specific spot on Google Maps, and drag the map a certain direction, and release the mouse at a new X,Y coordinate (I'm building a master map for somewhere that I'm traveling, but need to do so by Photoshopping together multiple screenshots, and I'm trying to set up a macro that will drag the map up or down "Y" units, so I can take another screenshot, and so on, and thus all of my screenshots are easy to line up/assemble into said larger map).

I thought that's what the "Click...Drag To" function would do, but apparently I'm missing something.
When I set up the location to click, and the location that the mouse should have dragged the map to, the mouse hits both of those spots, but doesn't lock onto the map, nor does it drag it...the mouse just hits both locations.

What am I missing?

Please refer to mine:


1 Like

Thanks for the reply.

I'm used to another Macro program, so still trying to wrap my head around some of the different ways KM tries to accomplish the same thing(s).

Having said that, I'm a little confused by some of your steps:

  1. What are the "End" and "Page Up" keystrokes for (in your Macro).
  2. I see in the first step there is a "Hold" option (after the mouse is clicked), but at not point in your Macro do I see a "Release" does the computer know to release the mouse click after the picture move?

Finally, isn't there a way to have the mouse click at one location, hold the click, move the mouse (still clicked and held) to another location (thus dragging the page it is holding onto), and then when the mouse reaches a certain grid location release the click?

Seems pretty simple, and like it should be just a one step operation.....Click and Hold, Drag, Drag Duration, Release at Location.


Test.kmmacros (28.1 KB)

Still hoping someone out there has a simple solution to this, seemingly, simple need listed above.

Here is a macro that will drag/drop one image onto another.

I use the Find Image on Screen action to get the coordinates to drag from, and drag to, but you could set the variables by other means if your prefer:

  • DID__ImageToDrag
  • DID__ImageToDropOn

You can test my macro using Finder Folders.

MACRO:   Drag Image 1 to Drop on Image 2 [Example]

--- VER: 1.0    2020-01-03 ---
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: Drag Image 1 to Drop on Image 2 [Example].kmmacros

Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

Actually, when I reread your OP, I realized that your simple Action should work.

On thing that might cause a problem is if the source window was NOT already frontmost.
A click on that window would only bring the window frontmost, not actually click on a specific point in the window and hold.

So, you might try an Activate a Specific Application action and Manipulate a Window action at the top of your macro to make sure the proper window is frontmost.

The action works but it doesn't work within Google maps. After a full day of googling, I still can't simulate a click and drag with javascript.

Yeah, I have a command above the one that I posted that makes "Chrome" the active/frontmost window before KM tries to execute the Drag-n-Release...but I will have to try adding the "Manipulate a Window Action" function. Thanks.

That's too bad. It's really weird that this simple action seems so hard to replicate using KM. I know that with QK it was a one-step function and worked well (in any app, including on Google Maps).
Thanks for trying to figure it out using JS as well.

Just in case anyone is still unclear as to what simple action I'm trying to accomplish, here is a simple video:


@jman995x, I can confirm this. It is a Google maps issue.

I don't know how KM implements the click, hold, drag, drop, but unless @peternlewis has some suggestions, I think you will need to look for other tools to do this job.

BTW, I could be wrong, but I think Google Maps has an API you can use. Maybe that's a potential solution . . .

Good luck, and let us know how it goes.

No, definitely not a Google Maps issue, as QuicKeys accomplished this exact task for me hundreds, if not thousands of times, over the years while I've been creating my own maps from Google Maps.

Just very weird that with as robust as KM is, that it can't accomplish this seemingly simple task.

Thanks for the reply.

Keyboard Maestro simulates the events. If the application looks at the hardware mouse button, or otherwise works around the events, then it will see other things.

Quickeys liked to poke deep in to undocumented parts of the system. Sometimes this meant it could achieve tasks that Keyboard Maestro can’t. Also, this meant that Quickeys would often break or become buggy with system upgrades (as compared to Keyboard Maestro, which runs back to version 2 (release4d in 2007) under Mojave, and back to version 4 (released in 2009) under Catalina).

Ok, thanks for the explanation (still too bad that it can't do this simple task when some of the other things it can do are really impressive and seem much more complicated).


This is a basic template for custom screenshot by mouse dragging.

Hope it helps!

Screenshot - drag mouse.kmmacros (6.5 KB)

I just love Keyboard Maestro so much. 2023 n still counting!

Keep in mind that Keyboard Maestro's own Screen Capture action is able to take an area as parameters: