For some reason PixelSearch below is not working after adding the GUI even when used on a black PNG file with no white pixels. Needed it to work as part of a loop.
;Pres P on keyboard to test
p::SearchPixels()
Esc::exitapp
SearchPixels(){
;DefinRegion
TLX = 1104
TLY = 373
BRX = 1422
BRY = 452
SomeText := "Found"
Gui,+AlwaysOnTop
Gui, Add, Text, cLime, %SomeText%
Gui, Show, xCenter yCenter
PixelSearch, FoundX, FoundY, TLX, TLY, BRX, BRY, 0xFFFFFF, 3, Fast RGB
if ErrorLevel {
MsgBox Not Found
} else {
MsgBox %SomeText%
}
Gui, Destroy ; Destroy the GUI
Return
}
However it does work correctly in the code without GUI below. Is there a way to add GUI without making the loop not work?
;Pres P on keyboard to test
p::SearchPixels()
Esc::exitapp
SearchPixels(){
;DefinRegion
TLX = 1104
TLY = 373
BRX = 1422
BRY = 452
SomeText := "Found"
PixelSearch, FoundX, FoundY, TLX, TLY, BRX, BRY, 0xFFFFFF, 3, Fast RGB
if ErrorLevel {
MsgBox Not Found
} else {
MsgBox %SomeText%
}
Return
}