Reputation: 1343
I have an Autohotkey script that uses ImageSearch a lot - actually, i have a bunch of my own functions that all use ImageSearch. It works fine when I run it on physical computers, but the search always fails when i run it on Amazon EC2 machine.
I don't use Remote Desktop (because when I did, ImageSearch failed with ErrorLevel 2 right after I closed connection). That's why I use VNC Server on EC2 machine and VNC Viewer on my computer. So the script runs fine, but ImageSearch always fails with ErrorLevel 1. The same script with the same images and stuff never fails on the physical machine.
So my guess is that ImageSearch uses some kind of library call, or somehow is dependent on hardware, and EC2 instances don't have the same settings for that as normal machines do. Where can I find the information on how the ImageSearch itself works - i mean internally (what calls it uses etc.).
Or, maybe, someone already had this type of issue (on EC2 or similar virtual environments) and knows solution?
Thanks!
Update: I somehow got it to work. Unfortunately can't tell how exactly - just randomly tried and finally it worked. Thanks!
Upvotes: 0
Views: 434
Reputation: 1705
I have found that ImageSearch is almost always worse than the alternatives, which include:
One of my main problems with ImageSearch is that it's mostly just way too hard to get it to work compared to the alternatives. If possible, you may try one of these methods if ImageSearch isn't working for you.
To answer your question about how ImageSearch works, though, Autohotkey is open-source. I myself haven't looked too deeply at the code, but it's available at the following sites. You can poke around and see what ImageSearch actually does in the C++.
Basic: (Lower link) http://www.autohotkey.com/download/OtherDownloads.htm
AHK_L: (Downloads link on right) https://github.com/Lexikos/AutoHotkey_L
Upvotes: 1