script to sleep while mouse moves and I move my scroll wheel
script to sleep while mouse moves and I move my scroll wheel
Can you help me plz with I want a script to sleep while a mouse moves and I move my scroll wheel and the script continues if I don't do it for a second.
Re: script to sleep while mouse moves and I move my scroll wheel
You probably haven't gotten any replies yet because it's very unclear what you are saying. Try restating it in short, separate sentences that describe what you want to happen in a step-by-step manner.
Re: script to sleep while mouse moves and I move my scroll wheel
Here is an example of a loop that "stops" when the mouse moves.
Code: Select all
SetTimer, Check, -100
Loop {
Send x
Sleep, 100
Send y
Sleep, 100
}
Check:
CoordMode, Mouse
MouseGetPos, x1, y1
SetTimer, Check2, -100
Return
Check2:
CoordMode, Mouse
MouseGetPos, x2, y2
If (x2 != x1 || y2 != y1) ; Mouse moved
Loop {
MouseGetPos, x1, y1
Sleep, 100
MouseGetPos, x2, y2
} Until (x2 = x1 && y2 = y1)
SetTimer, Check, -100
Return
Re: script to sleep while mouse moves and I move my scroll wheel
boiler, mikeyww thank you so much guys. In a more clear way: I have a script that does clicks and presses buttons.
at some point of it I want it to pause doing it for 2 seconds until I stop scrolling with mousewheel and moving a wheel (to read my webpage)
after 2 seconds of stopping doing it (I don't move my mousewheel and mouse itself) I want the script to continue doing my clicks that I programmed.
The script is actually going to close the tab that I was reading after that.
at some point of it I want it to pause doing it for 2 seconds until I stop scrolling with mousewheel and moving a wheel (to read my webpage)
after 2 seconds of stopping doing it (I don't move my mousewheel and mouse itself) I want the script to continue doing my clicks that I programmed.
The script is actually going to close the tab that I was reading after that.
Re: script to sleep while mouse moves and I move my scroll wheel
So, you want your script to behave like what mikeyww showed, except you also want the mouse wheel movements to pause what the script would be doing, and you don’t want it to resume after being paused until 2 seconds after you’ve stopped moving the mouse or mouse wheel. Is that correct?
Re: script to sleep while mouse moves and I move my scroll wheel
yesboiler wrote: ↑22 Jan 2022, 05:58So, you want your script to behave like what mikeyww showed, except you also want the mouse wheel movements to pause what the script would be doing, and you don’t want it to resume after being paused until 2 seconds after you’ve stopped moving the mouse or mouse wheel. Is that correct?
Re: script to sleep while mouse moves and I move my scroll wheel
Possibly something like this.
Code: Select all
squelch = 2000
SetTimer, Check, -100
SetTimer, Check3, 100
Loop {
Send x
Sleep, 100
Send y
Sleep, 100
}
Check:
CoordMode, Mouse
MouseGetPos, x1, y1
SetTimer, Check2, -100
Return
Check2:
CoordMode, Mouse
MouseGetPos, x2, y2
If (x2 != x1 || y2 != y1) { ; Mouse moved
Loop {
MouseGetPos, x1, y1
Sleep, 100
MouseGetPos, x2, y2
} Until (x2 = x1 && y2 = y1)
Sleep, squelch
}
SetTimer, Check, -100
Return
Check3:
While Instr(A_PriorHotkey, "Wheel") && A_TimeSincePriorHotkey < squelch
Sleep, squelch
~WheelUp::
~WheelDown::Return