User Tools

Site Tools


action:Find_Image_on_Screen

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
action:Find_Image_on_Screen [2015/12/19 11:38]
ccstone
action:Find_Image_on_Screen [2020/12/08 21:28]
JMichaelTX [Find Image on Screen Action]
Line 1: Line 1:
-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.+====== ​Find Image on Screen ​Action ======
  
-The image location is stored in the variable may be referenced as a structure ​in other actions like [Move and Click Mouse](http://​wiki.keyboardmaestro.com/​action/​Move_or_Click_Mouseusing the following notation:+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,​fuzzin a Keyboard Maestro [[manual:Variables|Variable]].
  
-* ImageLoc.x — Horizontal position of upper left corner. +{{ findimageonscreen.png?​nolink&​503x201 | Find Image on Screen }}
-* 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 specify the image to search based on:
  
-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.+* An image pasted in to the action
 +* An image from the System ClipboardTrigger Clipboard ​or a Named Clipboard (v9.0+). 
 +* An image loaded from a file (v9.0+). 
 +* An image from elsewhere on the screen (v9.0+).
  
-You can optionally ​display ​all the matches ​on the screen which can be helpful in determining the right amount ​of fuzz to use.+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+)).
  
-In v7.0+, you can search ​for the image on:+You can search the entire desktopor you can restrict your search ​to a specific screen or window, or to a specific area on the screen.
  
-* all screens. +Suppose that the image location is stored in the [[manual:​Variables|Variable]] `ImageLocation` ​(chosen by you in the action).  Then parts of the image data (propertiesmay be referenced in other actions like [[action:​Move_or_Click_Mouse|Move and Click Mouse]] using the following notation:
-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](:​Text_Fields)the numbers can be calculations including [functions](: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.+* ImageLocation.x — Horizontal position of upper left corner. 
 +* ImageLocation.y — Vertical position of upper left corner. 
 +* ImageLocation.width — the Width of the match (same as the source image)
 +* ImageLocation.height — the Height of the match (same as the source image)
 +* ImageLocation.fuzz — the Fuzz of the match
 +* ImageLocation.MidX — Horizontal position of center. 
 +* ImageLocation.MidY — Vertical position of center.
  
-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.+If this action ​fails to find the image, the variable will be set to the empty string.
  
-{{:action:find.image.on.screen.kmmacros|}} +After an action ​like this is executed, and an image was found, then the [[token:FoundImage|%FoundImage%]] token (v8+) will return the data of the last found image.
-{{ :​action:​find.image.on.screen.png?​nolink |}}+
  
 +Please note that "​ImageLocation"​ is just an example Variable (which you the user can set), whereas [[token:​FoundImage|%FoundImage%]] is a token provided by the Keyboard Maestro Engine.
 +
 +===== How To Use =====
 +
 +{{page>::​Found_Image#​How To Use&​noheader&​nofooter}}
 +
 +===== Example =====
 +
 +{{:​action:​find.image.on.screen2.kmmacros|Find Image on Screen.kmmacros}}
 +
 +{{ find-image-on-screen2.png?​nolink&​503x591 | Find Image Example }}
 +{{ find-image-on-screen3.png?​nolink&​452x456 | Find Image Results }}
 +
 +===== See Also =====
 +
 +==== Actions ====
 +
 +* [[action:​Highlight Location|Highlight Location]]
 +* [[action:​Move or Click Mouse|Move or Click Mouse]]
 +* [[:​Actions|See all Actions]]
 +
 +====  Conditions ====
 +
 +* [[condition:​Found Image|Found Image]]
 +* [[:​Conditions|See all Conditions]]
 +
 +====  Collections ====
 +
 +* [[collection:​Found Images|Found Images]]
 +* [[:​Collections|See all Collections]]
 +
 +==== Forum ====
 +
 +- [[https://​forum.keyboardmaestro.com/​t/​can-i-zoom-the-picture-i-have-saved-in-click-at-found-image-action/​2103/​2|Can I zoom the picture I have saved in "Click at found image" action?]]
 +- [[https://​forum.keyboardmaestro.com/​t/​how-to-search-for-multiple-found-image-actions/​3093|How To Search For Multiple "Found Image" Actions]]
 +- [[https://​forum.keyboardmaestro.com/​t/​find-image-on-screen-using-clipboard-image/​3510/​4|Find Image on Screen using Clipboard Image?]]
 +- [[https://​forum.keyboardmaestro.com/​t/​km-cant-see-portion-of-screen-i-just-pasted-into-it/​3547/​3|KM can't see portion of screen I just pasted into it]]
 +
 +- [[https://​forum.keyboardmaestro.com/​search?​q=Find%20Image%20on%20Screen|Keyboard Maestro Forum topics about Find Image on Screen]]
action/Find_Image_on_Screen.txt · Last modified: 2023/09/15 02:21 by peternlewis