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:
- Updated relevant functions to return an array of [x,y] coordinates on success, and False on failure. Original search functions returned True/False success status, while coordinate results were stored in external variables passed in by reference.
- Updated relevant functions with an extra parameter for a window handle, making it possible to limit the search area to the boundaries of a specified window.
- Added the ability to handle multi-monitor desktops by re-defining desktop boundaries in to new Global variables $desktopLeft, $desktopTop, $desktopRight, $desktopBottom, $desktopWidth, and $desktopHeight.
Syntax
Coming soon™…
Download
ImageSearch is my updated package. It includes the original ImageSearch and MSVC DLLs, along with the updated ImageSearch.au3 library.