Re: Cancel 10 second sleep in a counting script Topic is solved

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

Cancel 10 second sleep in a counting script

30 Sep 2018, 09:42

Hi, I have a counting script that counts from a set number and writes "hello", then it searches the color at 20, 285 and it does it in a loop. If the pixel at 20, 285 is not white it does it every 10 seconds. If it is white it does it every 160 milliseconds. I want to be able to break the 10 second sleep with a key, so it goes to "hello and count" part again. Can you help me with it please?

Code: Select all

x := 278765718 

Loop {
Sleep 20
      Clipboard = hello %x%
	  x++
Send {Shift down}{Insert}{Shift Up}
	  Sleep 160
      Wait2()
   }
 

   Wait2()
{
	CoordMode, Pixel, Screen
	CoordMode, Mouse, Screen
	Loop
	{
		Sleep 20
		PixelGetColor, col, 20, 285 
	 If col = 16777215 
		break
	sleep 10000
		break
	}
}

  ralt::
  pause
  Return
Rohwedder
Posts: 7643
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Cancel 10 second sleep in a counting script  Topic is solved

01 Oct 2018, 02:29

Hallo,
break the 10 second sleep of Wait2() with key Escape:

Code: Select all

Wait2()
{
	CoordMode, Pixel, Screen
	CoordMode, Mouse, Screen
	Sleep 20
	PixelGetColor, col, 20, 285
	If col = 16777215
		Return
	End := A_TickCount + 10000
	While A_TickCount < End And !GetKeyState("Esc")
		Sleep, 50
}
Rohwedder
Posts: 7643
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Cancel 10 second sleep in a counting script

01 Oct 2018, 02:30

Hallo,
this page is currently defective and without delete button!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], ReyAHK and 271 guests