Help with Loop Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
Spxctator
Posts: 1
Joined: 04 Jan 2021, 01:20

Help with Loop  Topic is solved

04 Jan 2021, 01:30

I need help with this loop, intended and expected function: send a message every 3 seconds if it doesn't detect a grey pixel (using pixelgetcolor) and blue pixels (using pixelsearch) in an area.
It works without the pixelsearch and errorlevel line.

Code: Select all

Loop
{
PixelGetColor, DetectMath, 700, 850
PixelSearch, X, Y, 900, 700, 1200, 900, 0xF4A420
	if (DetectMath = 0x36312F)
	{
		SoundBeep
		Pause
	}
	else if (ErrorLevel = 0)
	{
		SoundBeep
		Pause
	}
	else
    {
		Send, test{enter}
		Sleep 3000
    }
}
return
Edit: Solved by editing line 4.

Code: Select all

Loop
{
PixelGetColor, DetectMath, 700, 850
PixelSearch, VarX, VarY, 900, 700, 1200, 900, 0xF4A420, 15, Fast
    if (DetectMath = 0x36312F)
    {
        SoundBeep
        Pause
    }
    if (ErrorLevel = 0)
    {
        SoundBeep
        Pause
    }
    else
    {
        Send, test{enter}
        Sleep 3000
    }
}
return
Last edited by Spxctator on 04 Jan 2021, 02:31, edited 1 time in total.
User avatar
Xtra
Posts: 2060
Joined: 02 Oct 2015, 12:15

Re: Help with Loop

04 Jan 2021, 02:09

Code: Select all

Loop
{
    PixelGetColor, DetectMath, 700, 850
	if (DetectMath = 0x36312F)
	{
		SoundBeep
		Pause
	}
	else
	{
		PixelSearch, X, Y, 900, 700, 1200, 900, 0xF4A420
		if (ErrorLevel = 0)
		{
			SoundBeep
			Pause
		}
		else
		{
			Send, test{enter}
			Sleep 3000
		}
	}	
}
return

Return to “Ask For Help”

Who is online

Users browsing this forum: ark, Spawnova and 41 guests