Page 1 of 1

I need help ending a script and being ready for the next key press.

Posted: 12 Jan 2023, 14:38
by mexican scientist
this is my code

Code: Select all

#IfWinActive, Elder Scrolls Online
z::
sleep, 11000
SetTimer, CheckColor, 1000
CheckColor:
    CoordMode, Pixel, Screen
    PixelSearch, X, Y, 1263, 958, 1371, 965, 0xF0463B, 10
    If ErrorLevel = 0
	{
        Send, {f}
	sleep, 5000
	Send, {f}
	sleep, 100
	PixelSearch, X, Y, 1093, 640, 1099, 644, 0x000000, 2
		If ErrorLevel = 1
			{
			sleep, 1000
			PixelSearch, X, Y, 1093, 640, 1099, 644, 0x000000, 2
				If ErrorLevel = 1
					{
					MsgBox The Scrip now ends, you can now press z again to start the script again.
					Exit
					}
			}

	}
Return
Notice the message box "The Scrip now ends, you can now press z again to start the script again."

How can I end the script here and do exactly what the message box claims? Using the Exit command does not work. The script is still searching for pixel colors...

Re: I need help ending a script and being ready for the next key press.  Topic is solved

Posted: 12 Jan 2023, 15:34
by adrianh
https://www.autohotkey.com/docs/v1/lib/SetTimer.htm wrote: PeriodOnOffDelete
Period: Creates or updates a timer using the absolute value of this parameter as the approximate number of milliseconds that must pass before the timer is executed. The timer will be automatically enabled and reset. It can be set to repeat automatically or run only once:
  • If Period is positive, the timer will automatically repeat until it is explicitly disabled by the script.