Mouse_event in a loop Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
THEjuozasXD

Mouse_event in a loop

06 Apr 2018, 04:32

Hey,
need some help figuring out how this works, I have a mouse_event set to move the cursor in a certain direction. it's looping to create a smoothness imitation, without sleep the loop takes 0 ms to complete, but for some reason with sleep only set to 1 ms loop takes 281 ms to complete, to put this into perspective heres the code:

Code: Select all

#NoEnv
MS := A_TickCount
x = 0
loop  {
	x += 10
	DllCall("mouse_event",uint,1,int, 70 ,int, 0,uint,0,int,0)
	if (x > 180) {
		break
	}
	sleep 1
}
time := A_TickCount - MS
Msgbox % time
try it without sleep and with sleep...
User avatar
noname
Posts: 515
Joined: 19 Nov 2013, 09:15

Re: Mouse_event in a loop  Topic is solved

06 Apr 2018, 11:36

Take a look at the "sleep" documentation (see the remarks),i think it contains the answer to your question.

https://autohotkey.com/docs/commands/Sleep.htm

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], OrangeCat and 191 guests