The Find Image on Screen action finds a specified image on the screen in a specified area and stores the image location and fuzziness (left,top,width,height,fuzz) in a Keyboard Maestro Variable.
You can specify the image to search based on:
You can also specify the fuzz allowed in the match, as well as whether to display the possible matches (generally used for debugging), and whether the image must be unique, or if not, which of the acceptable images to choose (the best, the topmost (v9.0+), leftmost (v9.0+), bottommost (v9.0+), or rightmost (v9.0+)).
You can search the entire desktop, or you can restrict your search to a specific screen or window, or to a specific area on the screen.
There is an option in the action (gear) ⚙ menu to have the action wait until the image appears (v11.0+).
Suppose that the image location is stored in the Variable ImageLocation
(chosen by you in the action). Then parts of the image data (properties) may be referenced in other actions like Move and Click Mouse using the following notation:
If this action fails to find the image, the variable will be set to the empty string.
After an action like this is executed, and an image was found, then the %FoundImage% token (v8+) will return the data of the last found image.
Please note that “ImageLocation” is just an example Variable (which you the user can set), whereas %FoundImage% is a token provided by the Keyboard Maestro Engine.
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.
Note that in the above screen shot, the WINDOW(0,Left)
function is referring to the frontmost window in the frontmost app. To refer to other windows in the frontmost app, you need to change the index
parameter of the WINDOW function.