I’m looking for a way to contruct a macro which 1) finds an image which may exist in multiple locations on a page, and 2) returns the number of instances of the image on the page.
Does anyone know of a way to do this?
I’m looking for a way to contruct a macro which 1) finds an image which may exist in multiple locations on a page, and 2) returns the number of instances of the image on the page.
Does anyone know of a way to do this?
Use the For Each action with the Found Images collection to find each image. Use the Set Variable to Calculation action to set a variable to 0 to start with, and to add one to it each time through the loop.
I didn't know how to do this until I found Peter's suggestion.
Here's what I came up with for anyone looking to do the same.
Count Image Matches.kmmacros (2.8 KB)
Oh and you'll also get a warning for not using 'VarName' but I didn't see any other way (and it still works).
I'm extremely novice. How do I get that result, say, into the clipboard, ready for pasting?
Which result? This macro counts 0 to multiple occurrences of the same image, but doesn't capture one.
I'm not sure I understand your use case because you would have already provided the image that this macro looks for.
Can you tell us more regarding what you want to do?
Thanks! I should have given more info.
I have a healthcare application. On one of those screens lists the day’s scheduled patients.
I’m looking to automate the counting of patients who are no-shows that day. The only way to do this is to search for the number of occurrences of “no show” on the screen. It’s not a text-searchable method, unfortunately, so I have to use image recognition.
This script works wonderfully, and shows the number of “no show” images on the screen. I just want to be able to paste the result—the number of occurrences of the “no show” phrase—into a spreadsheet.