PixelSearch with visual cue

Discuss other useful utilities, general computing tips & tricks, Internet resources, etc.
User avatar
Posts: 117
Joined: 19 Dec 2015, 00:20

PixelSearch with visual cue

18 Jun 2019, 13:10

Here is a fun little script I made to help me understand PixelSearch a bit better. I thought it might help other as well.
PixelSearch.gif (175.23 KiB) Viewed 553 times

Code: Select all

;<===================================== PixelSearch with visual cue =====================================>
#SingleInstance Force
Process, Priority, , Above Normal
SetControlDelay, -1
SetBatchLines, -1
SetWinDelay, -1
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
CoordMode, ToolTip, Screen
MouseMove, (A_ScreenWidth/2), (A_ScreenHeight/2)
IfNotExist, %USERPROFILE%\Downloads\Test_Pic.jpg
{	UrlDownloadToFile, https://www.autohotkey.com/boards/download/file.php?id=7789, %USERPROFILE%\Downloads\Test_Pic.jpg
} SplashImage, %USERPROFILE%\Downloads\Test_Pic.jpg, B FS18, Teast Image
{	PixelSearch, X, Y, X1, Y1, X2, Y2, 0x000000, 0, RGB Fast
	If (!ErrorLevel)
	{	FrameColor := "Lime"
		GoSub, Box
		ToolTip, Pixel Found, (X-40), (Y+57), 1
	} Else,
	{	FrameColor := "Red"
		GoSub, Box
		ToolTip, Searching, (X-30), (Y+57), 1
}	} Return
{	WinGetPos,,, WindowWidth, WindowHeight, %WinTitle%
	MouseGetPos, X, Y
	;	Uupper Left Corner		|	Lower Right Corner
	;	Left		   Top		|	Right		Bottom
	X1 := (X-50), Y1 := (Y-50), X2 := (X+50), Y2 := (Y+50) ;Adjust The Size of The Search Area/Box.
	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))
} Return
;<================================================= END =================================================>
Test_Pic.jpg (3.7 KiB) Viewed 322 times

Return to “Other Utilities & Resources”

Who is online

Users browsing this forum: No registered users and 2 guests