Code: Select all
#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.
#Persistent
Process, Exist, Game.exe
if (ErrorLevel = 0)
{
Random, rand, 5000, 10000
SetTimer, DO, %rand%
return
DO:
WinWaitActive, Game
Click, 1469, 852 ; start game
Sleep %rand% ;
Click, 793, 201 ; hero upgrade
Sleep %rand% ;
return
}
else
{
Run, C:\Games\Game.exe ;
Sleep, 5000 ;
return
}