Code: Select all
#Requires AutoHotkey v2.0
; Define the area for the image search
left := 0
top := 0
right := 1000
bottom := 600
imagePath := "img.png" ; Adjust the path to where your image is stored
; Perform the image search within the specified area
ImageSearch &OutputVarX, &OutputVarY, left, top, right, bottom, img.png
; Check if the image was found
if (foundX != "")
{
; Image found, click on the coordinates
MouseClick "left", &OutputVarX, &OutputVarY
MsgBox "Image found and clicked "
}
else
{
; Image not found
MsgBox "Image not found."
}
return
I have the above code, the img.png is the same folder as the ahk file.
But when I run it, the AHK app keeps on showing error message
Warning: This variable appears to never be assigned a value.
▶ 011: ImageSearch(&OutputVarX, &OutputVarY, left, top, right, bottom, img.png)
What could be wrong?
Here is a recording of the error in video
https://vento.so/view/a5bfb0a8-3f94-42c3-bb04-0858598c9e81?utm_medium=share