Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wait statement - until mouse stops moving
#1
Hi,
I have a macro where a "drawing state" is activated automatically which usually requires a left click to work. It then waits a specific time, then gives a lef- before ending the macro. It would be great if the macro waited until there was no mouse movement to give the lef- command to end the macro.
Since you might have to give a little bit of a chance for the user to initiate the movement, I geuss that wait state should not kick in until like 0.5 seconds in or something...

Is this possible?

Stuart
#2
Function WaitForMouseMove
Code:
Copy      Help
;/
function# [double'maxWaitTime]

;Waits until mouse movement begins.
;Returns 1 if movement began, 0 if not.


;maxWaitTime - number of seconds to wait. Default or 0 - infinite.


int wt=maxWaitTime*1000
int t1=GetTickCount
POINT p p0
xm p0
rep
,0.05
,xm p
,if(memcmp(&p &p0 sizeof(POINT))) ret 1
,if(wt and GetTickCount-t1>=wt) ret

Function WaitForMouseStop
Code:
Copy      Help
;/
function double'idleTime

;Waits until mouse movement ends.

;idleTime - number of seconds mouse must be not moving.


POINT p pp
int i t0 it=idleTime*1000
xm pp
rep
,0.05
,xm p
,if(memcmp(&p &pp sizeof(POINT))) i=0
,else if(!i) i=1; t0=GetTickCount
,else if(GetTickCount-t0>=it) ret
,pp=p

Example
Code:
Copy      Help
if(!WaitForMouseMove(2.5)) ret
WaitForMouseStop 1.5
#3
Thanks!!!


Forum Jump:


Users browsing this thread: 1 Guest(s)