Skip to content

Instantly share code, notes, and snippets.

@Gosha
Last active December 23, 2019 15:57
Show Gist options
  • Save Gosha/6814850ef1b489b10a7a0635df228da4 to your computer and use it in GitHub Desktop.
Save Gosha/6814850ef1b489b10a7a0635df228da4 to your computer and use it in GitHub Desktop.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
WinActivate unknown.png
findAndClick(image, plusminusX1 := 0, plusminusY1 := 0) {
find_image:
ImageSearch, FoundX, FoundY, 251, 418,702, 929, %image%
if (ErrorLevel = 2) {
MsgBox Could not conduct the search for image %image%
Exit, 1
}
else if (ErrorLevel = 1) {
Sleep 500
Gosub, find_image
}
Random, GotoX, FoundX + plusminusX1, FoundX
Random, GotoY, FoundY + plusminusY1, FoundY
MouseMove, GotoX, GotoY
Mouseclick, left
}
findAndClick(".\blackrabbit.PNG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment