Code: Select all
f1::
Loop {
ImageSearch,x,y,0,0,%A_ScreenWidth%,%A_ScreenHeight%,#Include %A_ScriptDir% "\exampleimage.png"
If !ErrorLevel
Click % x+10 " " y+10
Sleep 500
}
Code: Select all
f1::
Loop {
ImageSearch,x,y,0,0,%A_ScreenWidth%,%A_ScreenHeight%,#Include %A_ScriptDir% "\exampleimage.png"
If !ErrorLevel
Click % x+10 " " y+10
Sleep 500
}
Code: Select all
ImageSearch,x,y,0,0,%A_ScreenWidth%,%A_ScreenHeight%, %A_ScriptDir%\exampleimage.png
%A_ScriptDir%\exampleimage.png or % A_ScriptDir "\exampleimage.png" are absolute pathes, so the working directory doesn't matter. You should try to check the ErrorLevel set by ImageSearch.ImageFile
The file name of an image, which is assumed to be in %A_WorkingDir% if an absolute path isn't specified.
Code: Select all
f1::
CoordMode Pixel ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch,x,y,0,0,%A_ScreenWidth%,%A_ScreenHeight%, %A_ScriptDir%\exampleimage.png
if ErrorLevel = 2
MsgBox Could not conduct the search.
else if ErrorLevel = 1
MsgBox Icon could not be found on the screen.
else
MsgBox The icon was found at %FoundX%x%FoundY%.
That person said the directory doesn't matter isn't that conflicting with you saying it might not be in the right directory.....%A_ScriptDir%\exampleimage.png or % A_ScriptDir "\exampleimage.png" are absolute pathes, so the working directory doesn't matter.
Code: Select all
f1::
CoordMode Pixel
ImageSearch,x,y,0,0,1920,1080, %A_ScriptDir%\clickme.png
Click, %foundx%, %foundy%
Code: Select all
f1::
CoordMode Pixel
ImageSearch,x,y,0,0,1920,1080, C:\Scripting\clickme.png
Click, %foundx%, %foundy%
Code: Select all
f1::
ThisImageVariable := "C:\Scripting\clickme.png"
CoordMode Pixel
ImageSearch,x,y,0,0,1920,1080, %ThisImageVariable%
Click, %foundx%, %foundy%
Users browsing this forum: Bing [Bot] and 282 guests