Jump to content

Wikipedia:Reference desk/Archives/Computing/2024 June 28

From Wikipedia, the free encyclopedia
Computing desk
< June 27 << May | June | Jul >> Current desk >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 28

[edit]

Dragging a map without mouse

[edit]

On Google maps the displayed map can be dragged in any direction by the mouse held with left button down. To do this in a script I hope to use this HotKeys command:

MouseClickDrag Clicks and holds the specified mouse button, moves the mouse to the destination coordinates, then releases the button.

MouseClickDrag, WhichButton, X1, Y1, X2, Y2 [, Speed, R]

On testing the mouse does move to the expected positions (x1,Y1) and (x2,Y2) but the map fails to move. Can someone say what I need to do to drag the map without mouse?

Comment: Attempting to slow the auto mouse by inserting 100 for Speed did not help. I also tried this sleepwalking version with 1-second waits between operations:

Sleep, 1000      ;sleep 1 second
MouseMove, 451, 314 ;map top left
Sleep, 1000
Send, {LButton Down}
Sleep, 1000
MouseMove, 691, 474 ;This where I want the map to be dropped
Sleep, 1000
Send, {LButton Up}

As before, the mouse moves as expected but the map fails to drag. Note: this is on Windows 10. MouseClickDrag works ok for drawing lines in PAINT.exe. Philvoids (talk) 18:44, 28 June 2024 (UTC)[reply]

My first assumption is that you need two left button presses. Google Maps already has key bindings to the cursor keys to move it up, down, right, left. But, when you initially open Maps, it has focus on the search box. You have to click on the map once to put focus on the map. Then, the cursor keys and + and - work. So, your key bindings may not work without first clicking on the map, which I assume you can script, and then click-dragging. But, in my mind, this would be a cute project to work out how many cursor key presses it takes to move to a specific point and interleaving them so it appears to move diagonal instead of left to a point and then down to the final point. 12.116.29.106 (talk) 11:34, 2 July 2024 (UTC)[reply]
I invoke Google maps from a Wikipedia geographic location so it displays with the Search box already filled. Just a single left-mouse-press is enough to start a drag. Thank you for the tip about the up/down/left/right arrow keys - they drag in large steps while the left mouse key is held down. Yes, you have the seed of a cute useful project for extracting wide-area high resolution maps from Google. Unfortunately the arrow keys do not work on this scan of an old map so this will not help the "Download image from website" question above. Philvoids (talk) 12:19, 2 July 2024 (UTC)[reply]