ImageSearch ErrorLevel 2 When Image is on Secondary Drive (Windows 10)

Report problems with documented functionality
egocarib
Posts: 86
Joined: 21 May 2015, 18:21

ImageSearch ErrorLevel 2 When Image is on Secondary Drive (Windows 10)

12 Aug 2017, 14:55

Has anyone else encountered this?

I am running windows 10.
I am using AHK v2.0-a074 (x64).

When I use ImageSearch with a source image on a secondary drive (D:\), it fails with ErrorLevel 2.

Code: [Select all] [Download] GeSHi © Codebox Plus

ImageSearch, foundX, foundY, 0, 0, 1000, 1000, D:\Test\img.png


When I use the same code but move the image to the C:\ drive, it works successfully.

Code: [Select all] [Download] GeSHi © Codebox Plus

ImageSearch, foundX, foundY, 0, 0, 1000, 1000, C:\Test\img.png
obeeb
Posts: 140
Joined: 20 Feb 2014, 19:15

Re: ImageSearch ErrorLevel 2 When Image is on Secondary Drive (Windows 10)

13 Aug 2017, 21:25

You should use quotes if you use v2, try "D:\Test\img.png" the weird thing is actually that your second example works. See example in the documentation. https://lexikos.github.io/v2/docs/commands/ImageSearch.htm
egocarib
Posts: 86
Joined: 21 May 2015, 18:21

Re: ImageSearch ErrorLevel 2 When Image is on Secondary Drive (Windows 10)

14 Aug 2017, 16:50

Hmm, this does not appear to be drive related after all. I made a simpler script and the problem disappeared. I assume this was some kind of user error on my part, but I'll report back if that's not the case.

RE: obeeb, I don't think that's correct

Code

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



Output

Code: [Select all] [Download] GeSHi © Codebox Plus

1>>  X=321 Y=321 ErrorLevel=0
2>> X= Y= ErrorLevel=2
3>> X=321 Y=321 ErrorLevel=0
4>> X=321 Y=321 ErrorLevel=0
5>> X= Y= ErrorLevel=2
6>> X=321 Y=321 ErrorLevel=0
obeeb
Posts: 140
Joined: 20 Feb 2014, 19:15

Re: ImageSearch ErrorLevel 2 When Image is on Secondary Drive (Windows 10)

14 Aug 2017, 18:18

I tried with AutoHotkey_2.0-a081.

The ouput of your code is:

Code: [Select all] [Download] (Untitled.txt)GeSHi © Codebox Plus

temp.ahk (4) : ==> Function calls require a space or "(".  Use comma only between parameters.
Specifically: ImageSearch, oX, oY, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, "C:\Temp\Test.png"

This is in accordance with the documentation: https://autohotkey.com/v2/v2-changes.htm
There is no comma between the function name and parameters, so MouseGetPos(, y) = MouseGetPos , y (x is omitted). A space or tab is required for clarity.

After I fixed all those errors I got an error caused by using unquoted string

Code: [Select all] [Download] (Untitled.txt)GeSHi © Codebox Plus

temp.ahk (7) : ==> The leftmost character above is illegal in an expression.
Specifically: \Temp\Test.png

After fixing all of those the program finally runs but then there is an error with %A_ScreenWidth% because instead of doing what it did in v1 it dereferences the screen width and then you have a variable that starts with a number(illegal).

The only logical conclusion I can reach at this point is that you are using v1.1 and have ImageSearch() and OutputDebug() functions defined in one of your function libraries.
egocarib
Posts: 86
Joined: 21 May 2015, 18:21

Re: ImageSearch ErrorLevel 2 When Image is on Secondary Drive (Windows 10)

14 Aug 2017, 18:31

I am using AHK v2.0-a074, as I stated in the original post. Changes that have occurred in v2 since then are not relevant to this discussion.

Nor is the original post. Apologies for wasting anyone's time.
obeeb
Posts: 140
Joined: 20 Feb 2014, 19:15

Re: ImageSearch ErrorLevel 2 When Image is on Secondary Drive (Windows 10)

14 Aug 2017, 20:33

Yeah, there were some major syntax changes in 78 version, sorry that I doubted you know which version you use ;-).

I will offer you a friendly general suggestion(not related to this particular thread), before you report a bug make sure it exists in the latest version.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests