Lore

If it's worth remembering, it's worth writing down, if I find the time, and remember...

User Tools

Site Tools


imagesearch

This is an old revision of the document!


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.

Download

I've put it up on GitHub.

1)
User Defined Functions in AutoIt, usually collected in to a .au3 library.
imagesearch.1525977677.txt.gz · Last modified: 2018/05/10 14:41 by thekojukinator