This is an old revision of the document!
Table of Contents
Image Search with AutoIt
Overview
I came across the need to be able to find something on the screen based on a reference image in my AutoIt scripts. However, this is not an available feature of AutoIt. There are functions available for checking individual pixels, but not images.
I found a solution in this thread. The key is the AutoHotkey ImageSearch function. Someone extracted the ImageSearch code from AutoHotkey, packed it up in to convenient DLLs, and put together a UDF 1) library that acts as a wrapper.
I took the UDF library and made the following improvements to it:
- Unordered List Item
Syntax
Coming soon™…
I started working on the syntax section, and decided to build a script with some examples, and then got carried away with improving the library. As it came, the functions returned coordinates by using pre-defined global variables that they took by reference and updated. I thought this was silly, so I adjusted them to properly return two-coordinate arrays on success. Also, while experimenting I realized that AutoIt doesn't have built-in macros or constants for the virtual desktop area of multiple monitors, so I figured out how to deal with that.
I need to polish things up, create the example script, re-upload the package, and then update this page.
Download
ImageSearch is my updated package. It includes the original ImageSearch and MSVC DLLs, along with the updated ImageSearch.au3 library.