На форумах AutoHotkey сообщалось, что CoordMode может быть тем, что влияет на PixelSearch.Обнаружил, что код работает путем добавления CoordMode, Pixel, Screen в первой строке, как показано ниже.
CoordMode, Pixel, Screen
;Pres P on keyboard to test
p::SearchPixels()
`::exitapp
^1::Reload
SearchPixels(){
Global Var
;DefinRegion
SomeText = Found
;Coordinates gotten from the DefineBox(TLX, TLY, BRX, BRY, BW, BH) function found in DefineBox.ahk not added here for brevity.
;Screen size of 1920x1080
TLX = 650
TLY = 905
BRX = 1281
BRY = 983
Gui,+LastFound +AlwaysOnTop -Caption +Owner
Gui,+HWND_G
CustomColor = EEAA99 ; Can be any RGB color.
Gui, Color, %CustomColor%
Size := 12
FontType := "Verdana"
Gui, Font, s%Size%, %FontType%
GUIWidth = 500
GUIHeight = 50
Gui, Add, Text, x0 y1 W%GUIWidth% H%GUIHeight% cLime +Center vVar, 0
; Make all pixels of this color transparent and make the text itself translucent (150):
WinSet, TransColor, %CustomColor% 150
TLXn := TLX - 10
TLYn := TLY - 10
BelowSearchArea := TLYn + GUIHeight
CenterX := ((BRX - TLXn) / 2) + TLXn - (GUIWidth / 2)
Gui, Show, x%CenterX% y%BelowSearchArea% W%GUIWidth% H%GUIHeight%
Loop
{
;small adjustment based on something on my screen that I'm not sure about.
PixelSearch, FoundX, FoundY, TLXn, TLYn, BRX, BRY, 0xFFFFFF, 1, Fast RGB
if ErrorLevel {
GuiControl,,Var, 0
} else {
GuiControl,,Var, 1
}
}
Gui, Destroy ; Destroy the GUI
Return
}