I need help detecting an image on screen
Posted: 12 Jan 2023, 00:15
Before I come to the forums, I do a little bit or research first. I want to make a code that detects an image in a video game called Elder Scrolls Online. So, I came across an old post that explained how to do this and the code they provided was this:
The problem is that it does not work. The image is located at C:\Users\username\Desktop\eso1.bmp
The coordinates where the image appears in the game screen are FoundX, FoundY, 814,999, 1102, 1061
The only message that appears is the "Could not conduct the search' which happens only if ErrorLevel = 2
the documentation says the following:
I got the code from this post viewtopic.php?t=31136
so basically, I am asking exactly what the guy on that post is asking, but the code just does not work!
Code: Select all
IF NOT A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%"
ExitApp
}
SetWorkingDir, %A_ScriptDir%
CoordMode, Mouse, Client
CoordMode, Pixel, Client
CoordMode, ToolTip, Client
SetKeyDelay,50,50
Z::
ImageSearch, FoundX, FoundY, 814,999, 1102, 1061, C:\Users\username\Desktop\eso1.bmp
CoordMode Pixel ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *Icon3 %A_ProgramFiles%\Elder Scrolls Online\Elder Scrolls Online.exe
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%.
send, {e}
}
return
The coordinates where the image appears in the game screen are FoundX, FoundY, 814,999, 1102, 1061
The only message that appears is the "Could not conduct the search' which happens only if ErrorLevel = 2
the documentation says the following:
Any help is appreciated.ErrorLevel is set to 0 if the image was found in the specified region, 1 if it was not found, or 2 if there was a problem that prevented the command from conducting the search (such as failure to open the image file or a badly formatted option).
I got the code from this post viewtopic.php?t=31136
so basically, I am asking exactly what the guy on that post is asking, but the code just does not work!