Code: Select all
#SingleInstance Force
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
CoordMode, ToolTip
MouseMove, (A_ScreenWidth/2), (A_ScreenHeight/2)
UrlDownloadToFile, https://www.autohotkey.com/boards/download/file.php?id=7457, %USERPROFILE%\Downloads\Testerpic.jpg
SplashImage, %USERPROFILE%\Downloads\Testerpic.jpg, B FS18, Teast Image
Text1 = Black Pixel Found
Text2 = Searching Black Pixel
Loop,
{ WinGetPos,,, WindowWidth, WindowHeight, %WinTitle%
MouseGetPos, X, Y
;Uupper Left Corner Lower Right Corner
;Width1 Height1 Width2 Height2
X1 := (X-50), Y1 := (Y-50), X2 := (X+50), Y2 := (Y+50) ;Adjust the size
;For the Gui
FrameThickness := (1), FrameWidth := (X2-X1), FrameHeight := (Y2-Y1)
Gui, 1: Margin, %FrameThickness%, %FrameThickness%
Gui, 1: Color, %FrameColor%
Gui, 1: Add, Text, W%FrameWidth% H%FrameHeight% 0x6
Gui, 1: -Caption +AlwaysOnTop +ToolWindow +LastFound
Gui, 1: Show, NoActivate, Gui1
WinSet, TransColor, White
WinMove, %WinTitle%,, (X-(WindowWidth/2)), (Y-(WindowHeight/2))
PixelSearch, X, Y, X1, Y1, X2, Y2, ("0x000000"), BGR, 0, Fast
If (!ErrorLevel)
{ FrameColor := ("Lime")
MouseGetPos, X, Y
ToolTip, %Text1%, (X-52), (Y+57), 1
} Else,
{ FrameColor := ("Red")
MouseGetPos, X, Y
ToolTip, %Text2%, (X-58), (Y+57), 1
} } Return
~Esc::ExitApp