Macro: Extract Found Image Image and Replace with Path

I used to place images embedded directly into macros, but I had so many of them (hundreds) that it bogged down the KM Editor app because that app writes the entire set of macros to a file about one second after the keyboard is idle. That's a lot of writing, causing a lot of lag in the KM Editor. It was very annoying.

So now I tend to save my images to files instead, but if you do that you have to be careful because screen scaling can totally change your images' resolutions. I have a 4K monitor, and worse, I change the scaling in the System Preferences to a non-standard value. This setup is a frequent cause of accidental re-scaling of images when storing images in files, especially when using the MacOS Preview app. When the image file is loaded by the KM macro, the image can be scaled to a totally different size and the KM Engine is unable to find the image. But if you do it right, it's an effective method.

Sometimes I load dozens of images into a folder, and my KM macro loads each of the files into a Find Image action and stops when it finds a hit. In that case, the name of the file could be used to correspond to the name of the thing that was found, and my macro's next steps could be based on the file's name. So for example if a file contained the image of an OK button, I could name the file "OK Button" and when that file matched something on screen, my macro would know what it found.

When preparing dozens of images for storing into a file, what I do is create a macro that gets triggered on a System Clipboard change, and then I press the MacOS key that lets me collect an image with the mouse, and when it gets copied to the system clipboard, the macro recognizes that a new image was in the clipboard, and it saves the image into the required folder, using %RandomUUID%.jpg as the filename. Once I've collected all the images I need, I manually change the filenames. However now that Monterey has really good voice recognition, I should be using my voice to specify the file name.