Page 1 of 1

Re: mouse move script help ?

Posted: 19 Sep 2021, 09:50
by Ianizer
Just read the comment on line 12:

Code: Select all

#MaxThreadsPerHotkey 2
SetBatchLines, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
DllCall("QueryPerformanceFrequency", "Int64*", QPCFrequency)

F4::
	MoveMouse := !MoveMouse
	while (MoveMouse)
	{
		MouseMove, 1, 0,, R
		AccuSleepBreakable(15, MoveMouse) ;lower the 15 to move the mouse faster. the time is in milliseconds
	}
return

AccuSleepBreakable(TimeToSleep := 10, ByRef VarThatStopsTheSleepLoopIfTrue := 0, ByRef VarThatStopsTheSleepLoopIfTrue2 := 0, ByRef VarThatStopsTheSleepLoopIfValueChanges := 0)
{ ;time to Sleep in ms ;returns amount of time slept in ms ;Accuracy: ~2ms ;I recomended to sleep for 0.4ms less than you want since it stops sleeping when elapsed time >= TimeToSleep
	DllCall("QueryPerformanceCounter", "Int64*", StartTime)
	OldVarValue := VarThatStopsTheSleepLoopIfValueChanges
	global QPCFrequency
	TimeToSleep := (TimeToSleep/1000)*QPCFrequency
	Loop
	{
		DllCall("Winmm\timeBeginPeriod", "UInt", 1)
		DllCall("Sleep", "UInt", 1)
		DllCall("Winmm\timeEndPeriod", "UInt", 1)
		DllCall("QueryPerformanceCounter", "Int64*", CurrentTime)
	}until ((CurrentTime - StartTime >= TimeToSleep) || (VarThatStopsTheSleepLoopIfTrue || VarThatStopsTheSleepLoopIfTrue2 || VarThatStopsTheSleepLoopIfValueChanges != OldVarValue))
	return ((CurrentTime - StartTime)/QPCFrequency)*1000
}

Re: mouse move script help ?

Posted: 19 Sep 2021, 14:33
by Ianizer
My bad, I forgot some commas:

Code: Select all

#MaxThreadsPerHotkey 2
SetBatchLines, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
DllCall("QueryPerformanceFrequency", "Int64*", QPCFrequency)

F4::
	MoveMouse := !MoveMouse
	while (MoveMouse)
	{
		MouseMove, 1, 0,, R
		AccuSleepBreakable(15,,, MoveMouse) ;lower the 15 to move the mouse faster. the time is in milliseconds
	}
return

AccuSleepBreakable(TimeToSleep := 1, ByRef VarThatStopsTheSleepLoopIfTrue := 0, ByRef VarThatStopsTheSleepLoopIfTrue2 := 0, ByRef VarThatStopsTheSleepLoopIfValueChanges := 0)
{ ;time to Sleep in ms ;returns amount of time slept in ms ;Accuracy: ~2ms ;I recomended to sleep for 0.4ms less than you want since it stops sleeping when elapsed time >= TimeToSleep
	DllCall("QueryPerformanceCounter", "Int64*", StartTime)
	OldVarValue := VarThatStopsTheSleepLoopIfValueChanges
	global QPCFrequency
	TimeToSleep := (TimeToSleep/1000)*QPCFrequency
	Loop
	{
		DllCall("Winmm\timeBeginPeriod", "UInt", 1)
		DllCall("Sleep", "UInt", 1)
		DllCall("Winmm\timeEndPeriod", "UInt", 1)
		DllCall("QueryPerformanceCounter", "Int64*", CurrentTime)
	}until ((CurrentTime - StartTime >= TimeToSleep) || (VarThatStopsTheSleepLoopIfTrue || VarThatStopsTheSleepLoopIfTrue2 || VarThatStopsTheSleepLoopIfValueChanges != OldVarValue))
	return ((CurrentTime - StartTime)/QPCFrequency)*1000
}

Re: mouse move script help ?  Topic is solved

Posted: 20 Sep 2021, 00:13
by Rohwedder
Hallo,
try:

Code: Select all

SetMouseDelay, -1,% Speed := 10
F4::SetTimer, F4 Up,% (F4:=!F4*Speed)?15:"Off"
F4 Up::MouseMove, F4, 0, 0, R