User Tools

Site Tools


action:Find_Image_on_Screen

**This is an old revision of the document!**

The Find Image on Screen action finds a specified image on the screen and stores the rectangle containing the match followed by the fuzz of the match (0-100), ie, (left,top,width,height,fuzz), in a variable.

The image location is stored in the variable may be referenced as a structure in other actions like Move and Click Mouse using the following notation:

  • ImageLoc.x — Horizontal position of upper left corner.
  • ImageLoc.y — Veritcal position of upper left corner.
  • ImageLoc.width — the width of the match (same as the source image).
  • ImageLoc.height — the height of the match (same as the source image).
  • ImageLoc.fuzz — the fuzz of the match.

You specify the image to match (usually got with a Command-Control-Shift-4 screen capture) by pasting an image into the image well. You also specify the amount of fuzziness allowed — because of transparency and anti-aliasing, almost all screen matches are fuzzy to some degree, but usually about 20% is a good place to start.

You can require the match to be unique (so if there are two or more good matches then the action will fail to find the image), or you can accept the best match even if there is more than one.

You can optionally display all the matches on the screen which can be helpful in determining the right amount of fuzz to use.

In v7.0+, you can search for the image on:

  • all screens.
  • the main screen.
  • the specified screen (counting from the left).
  • the front window.
  • the window with a specified title.
  • the window with a title containing a given string.
  • the window with a title matching a given regular expression.
  • the specified window (counting from the frontmost window).
  • a specified area on the screen.

Remember when specifying the area, as with all numeric fields, the numbers can be calculations including functions, and the fields expand to allow for longer expressions as soon as you type something other than a number, so this allows very precise control of where you can match.

This action cannot fail per se, but it can fail to find the image, in which case the variable will be set to the empty string.

find.image.on.screen.kmmacros

See Also


Forum

action/Find_Image_on_Screen.1457006859.txt.gz · Last modified: 2016/03/03 07:07 by AlainLifchitz