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
action:Find_Image_on_Screen [2016/03/12 13:59]
AlainLifchitz add ImageLoc.Midx & ImageLoc.Midy + orthograph
action:Find_Image_on_Screen [2023/09/15 02:21] (current)
peternlewis
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 structure ​in other actions like [[action:Move_or_Click_Mouse|Move and Click Mouse]] using the following notation:+The //Find Image on Screen// action finds a specified ​image on the screen in specified area and stores the image location and fuzziness (left,​top,​width,​height,​fuzz) ​in a Keyboard Maestro ​[[manual:Variables|Variable]].
  
-* ImageLoc.x — Horizontal position of upper left corner. +{{ findimageonscreen.png?​nolink&​503x201 | Find Image on Screen }}
-* ImageLoc.y — Vertical position of upper left corner. +
-* ImageLoc.Midx — Horizontal position of center. +
-* ImageLoc.Midy — Vertical position of center. +
-* 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 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 specify ​the image to search based on:
  
-This action ​cannot fail per sebut it can fail to find the image, ​in which case the variable will be set to the empty string.+* 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 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 [[manual:​Variables|Variable]] `ImageLocation` (chosen by you in the action). ​ Then parts of the image data (properties) may be referenced in other actions like [[action:​Move_or_Click_Mouse|Move and Click Mouse]] using the following notation: 
 + 
 +* 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. 
 + 
 +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 [[token:​FoundImage|%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 [[token:​FoundImage|%FoundImage%]] is a token provided by the Keyboard Maestro Engine.
  
 ===== How To Use ===== ===== How To Use =====
Line 21: Line 40:
 ===== Example ===== ===== Example =====
  
-{{:​action:​find.image.on.screen.kmmacros|}} +{{:​action:​find.image.on.screen2.kmmacros|Find Image on Screen.kmmacros}} 
-{{ :action:find.image.on.screen.png?nolink |}}+ 
 +{{ find-image-on-screen2.png?​nolink&​503x591 | Find Image Example }} 
 +{{ find-image-on-screen3.png?nolink&​452x456 ​Find Image Results ​}}
  
 ===== See Also ===== ===== See Also =====
  
-----+==== Actions ====
  
-=== Actions === +* [[action:​Highlight Location|Highlight Location]] 
- +* [[action:​Move or Click Mouse|Move or Click Mouse]]
-The [[action:​Move or Click Mouse|Move or Click Mouse]] ​action.+
 * [[:​Actions|See all Actions]] * [[:​Actions|See all Actions]]
  
-===  Conditions ===+====  Conditions ​====
  
-The [[condition:​Found Image|Found Image]] ​condition.+* [[condition:​Found Image|Found Image]]
 * [[:​Conditions|See all Conditions]] * [[:​Conditions|See all Conditions]]
  
-===  Collections ===+====  Collections ​====
  
-The [[collection:​Found Images|Found Images]] ​collection.+* [[collection:​Found Images|Found Images]]
 * [[:​Collections|See all Collections]] * [[:​Collections|See all Collections]]
- 
----- 
  
 ==== Forum ==== ==== Forum ====
Line 49: Line 67:
 - [[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/​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/​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://www.google.fr/search?q=site:​forum.keyboardmaestro.com+Find+Image+on+Screen|Keyboard Maestro Forum topics about Find Image on Screen]]+- [[https://forum.keyboardmaestro.com/​search?​q=Find%20Image%20on%20Screen|Keyboard Maestro Forum topics about Find Image on Screen]]
action/Find_Image_on_Screen.1457809158.txt.gz · Last modified: 2016/03/12 13:59 by AlainLifchitz