Problem with pixelsearch

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Yoslin
Posts: 3
Joined: 11 Oct 2017, 00:15

Problem with pixelsearch

12 Oct 2017, 10:31

I have this gui for progress bar and I'd want it to reset when pixelsearch finds in this case the white pixel.
It's basicly searching rectangle area with hole in the middle that's why it's there 4 times.
It's kinda doing what I want it to do however when I uncomment the pixelsearch my progressbar gets quite slow as it's ment to function like swing timer that's not acceptable. Is there better way to do what I'm trying to achieve?

Code: Select all

;F1 to start, F2 to restart bar, X to close script

#NoEnv
#Persistent
#SingleInstance Force
SetWorkingDir %A_ScriptDir%

Gui -Caption +AlwaysOnTop +0x400000
Gui Add, Progress, vMyProgress x0 y0 w500 h5 cBlue Range0-1000
OnMessage( 0x200, "WM_MOUSEMOVE" ) 
return

F1:: 
Gui Show, x337 y840 w500 h5, Swing Timer
Goto Mainloop

GuiEscape:
GuiClose:
    ExitApp



Mainloop:
Loop 
	{
	Loop 100 
		{
		
		/*
		PixelSearch, FoundX, FoundY, 540, 380, 660, 415, 0xFFFFFF, 3, Fast
		if ErrorLevel = 1

		PixelSearch, FoundX, FoundY, 540, 465, 660, 500, 0xFFFFFF, 3, Fast
		if ErrorLevel = 1

		PixelSearch, FoundX, FoundY, 540, 380, 580, 500, 0xFFFFFF, 3, Fast
		if ErrorLevel = 1

		PixelSearch, FoundX, FoundY, 620, 380, 660, 500, 0xFFFFFF, 3, Fast
		if ErrorLevel = 0
			Goto EndOfLoop
		*/
		
		GetKeyState, state, F2
		if state = D 
			Goto EndOfLoop
		
		GuiControl,, MyProgress, +10
		Sleep 10
		}
	EndOfLoop:
	GuiControl,, MyProgress, 0
	}
return
	

WM_MOUSEMOVE( wparam, lparam, msg, hwnd )
{
	if wparam = 1 ; LButton
		PostMessage, 0xA1, 2,,, A ; WM_NCLBUTTONDOWN
}

~x::ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, lmstearn, roeleboele, ulysim and 386 guests