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.
After finding an image on the second monitor, this Action return data like this: 2060,136,60,56,0
Suppose that the image location is stored in the Variable ImageLoc
(set by the user). Then parts of the image data (properties) may be referenced in other actions like Move and Click Mouse using the following notation:
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.
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 “ImageLoc” is just an example Variable (which you the use 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.