#SingleInstance Force
SetControlDelay, -1
SetBatchLines, -1
SetWinDelay, -1
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
CoordMode, ToolTip, Screen
MouseMove, (A_ScreenWidth/2), (A_ScreenHeight/2)
BoxSize := 50  ; 调整搜索区域/框的大小。
IfNotExist, %USERPROFILE%\Downloads\Test_Pic.jpg
  UrlDownloadToFile, https://www.autohotkey.com/boards/download/file.php?id=8420, %USERPROFILE%\Downloads\Test_Pic.jpg

SplashImage, %USERPROFILE%\Downloads\Test_Pic.jpg, B FS18, Teast Image

Loop {
  PixelSearch, X, Y, X1, Y1, X2, Y2, 0x000000, 0, RGB Fast
  If (!ErrorLevel) {  ; 此示例以找到黑色为例,进行提示
    FrameColor := "Lime"
    GoSub, Box
    ToolTip, 找到像素, (X-40), (Y+57), 1
  } Else {
    FrameColor := "Red"
    GoSub, Box
    ToolTip, 搜索, (X-30), (Y+57), 1
  }
}
Return

~Esc::ExitApp

Box:
  WinGetPos,,, WindowWidth, WindowHeight, %WinTitle%
  MouseGetPos, X, Y
  ;	Uupper Left Corner		|	Lower Right Corner
  ;	Left		   Top		|	Right		Bottom
  X1 := (X-BoxSize), Y1 := (Y-BoxSize), X2 := (X+BoxSize), Y2 := (Y+BoxSize)
  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

 

声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。