Good day,
I am having issues getting a code to work more consistently.
The task I'm trying to accomplish is the ability to hold a LEFT click down and move mouse to loop ONLY between 2 specific coordinates moving mouse back and forth between the two coordinates.
Below is the code and the issue I've run into.
`::
BreakLoop = 1 ; ` Breaks The Loop
return ; You must have a return after any multi line hotkey
^!0:: ; Bind to Ctrl + Alt + 0
BreakLoop = 0 ; lets the hotkey reset the BreakLoop var when pressed
MouseGetPos, px, py
Sleep, 300
MouseClick, L, %px%, %py%, , , D
Sleep, 1000
Loop ;Loop Script begins here
{
if (BreakLoop = 1) ; Breaks when Esc is pressed
break
MouseMove, 1069, 889
Sleep, 100
MouseMove, 840, 886
Sleep, 100
}
return
The first portion of the code "MouseGetPos" section of 4 lines works I THINK as intended, but when it transitions into the loop section it does NOT consistently move the mouse to specified coordinates while still holding the down the "MouseClick" command. On one computer it seems to work almost always. On other computers instead of clicking and moving to indicated coordinates, it'll click and move in exact same location as "MouseGetPos" and start the loop code instead while shifting app screen to match the indicate coordinates.
2nd, I am hoping to input a pause of the loop so that I can have manual control of where to move the mouse, without the LEFT click command getting reset. So once I unpause the script it'll go back to looping between the 2 specific coordinates again.
Any assistance would be greatly appreciated