Skip to content

Instantly share code, notes, and snippets.

@JoeGlines
Last active April 26, 2021 15:27
Show Gist options
  • Save JoeGlines/acc2d6e0858bae88e5471a638297025a to your computer and use it in GitHub Desktop.
Save JoeGlines/acc2d6e0858bae88e5471a638297025a to your computer and use it in GitHub Desktop.
;*******************************************************
; Want a clear path for learning AutoHotkey; Take a look at our AutoHotkey Udemy courses. They're structured in a way to make learning AHK EASY
; Right now you can get a coupon code here: https://the-Automator.com/Learn
;*******************************************************
#SingleInstance,Force
;~ CoordMode Pixel ; Interprets the coordinates below as relative to the screen rather than the active window.
;~ Supported Image filetypes are GIF, JPG, ICO, CUR, ANI and BMP images that are 16bit+
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, B:\Progs\AutoHotkey_L\Icons\Alpha\B.ico
if (ErrorLevel = 2)
MsgBox % "Could not conduct the search.`n`nThe SOURCE image does not exist"
else if (ErrorLevel = 1)
MsgBox % "The Image could not be found on the screen"
else {
MsgBox % "The icon was found at: X:=" FoundX " Y:=" FoundY
FoundX:=FoundX+15, FoundY:=FoundY+15 ;padding because it returns upper-left pixel location of image
click %FoundX% , %FoundY% ;Click the location that was found
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment