Help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
LuckyS1337
Posts: 55
Joined: 20 Mar 2023, 12:59

Help

Post by LuckyS1337 » 20 Mar 2023, 13:01

hey i need help.
all i want inside this loop, if not found up to 2 seconds, return. Is that even possible?

Code: Select all

Loop
{
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 165, 390, 361, 488, C:\Users\Profile\AppData\Roaming\Pvp\Images\Weapon1.png
Sleep, 5
}
Until ErrorLevel = 0
If ErrorLevel = 0
SendRaw, 
(LTrim
%f3%

)
sleep, 30

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Help  Topic is solved

Post by mikeyww » 20 Mar 2023, 15:00

Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v1.1.33
image := A_ScriptDir "\test.png"
If !FileExist(image) {
 MsgBox 48, Error, % "File not found.`n`n" image
 Return
}
wait  := 2000
end   := A_TickCount + wait
x1    := 165
y1    := 390
x2    := 361
y2    := 488
Loop {
 Sleep 25
 ImageSearch ,,, x1, y1, x2, y2, % image
} Until !ErrorLevel || A_TickCount > end
If ErrorLevel
     MsgBox 48, Status, Not found!
Else MsgBox 64, Status, Found!

Post Reply

Return to “Ask for Help (v1)”