Save screen image to the KM Images folder and use it in the Move and Click Image File with Path

I commonly have to use move and click Image command and like to save the images I used in ~/Keyboard\ Maestro/Images folder.

Typically I make a screenshot of the part of the screen with the image, save it, change the file name to be easily identifiable one, move the png file to the KM/Images folder, open the new Move and Click on Image in the file action and the add the image to the path within an action.

Since I am doing this so often, I thought to create a macro, but wonder if there is shortcut available already, or perhaps someone created a macro for this purpose, similar to pretty amazing
Custom Icon Manager by @noisneil .

I'd like to know which image editor you are using that doesn't change the DPI of screenshots. Most of the apps I've used to edit images change the DPI of the image so the edited versions tend to be unusable.



@Airy, not sure what are you asking. Is it about one of my previous discussions re: DPI change for screenshot after upgrade to Sonoma ?

In your first paragraph you said that you take screenshots and save the images. I don't know which application you are using when you are doing that. The only thing I want to know is what is the name of the app you are using to view and edit your screenshots. Most apps that I've tried change the DPI of the image resulting in unusable files for KM's Find Image actions.

@Airy I use screen capture CLI via terminal command or Cmd-Shift-5, Cmd-Shift-3, Cmd-Shift-4, depending on circumstances. Shottr is a nice app if you want extra functions.

Typically if you have a mac with retina resolution, the screenshot dpi should be at 144, if not - 72.
There is glitch in Sonoma (although it was reported on the earlier versions as well) that switches dpi down to 72 on retina macbook. Setting up an option of showing a floating thumbnail solved this for me (option under Cmd-Shift-5. Also shottr bypasses this problem as well.

Ok I will consider shottr, but I'm using your method at the moment.

Does the macro I linked to above to the job for you?

@noisneil yes - I was playing with it and trying to make it work.

I save all my image files in one directory and many macros may be referring to the same images, so UUID system of saving files in multiple directories does not work for me.

I basically need to screenshot the image on the screen, name it, save it to /Image directory and then add the path to the move and click.

So far I have the following blocks:

  1. When I am trying to save the image from the clipboard to the file, it does not save as an image
  2. I am not sure why, but the way you copy image to the move and click path does not work for me.

03 image.kmmacros (28.2 KB)

What am I doing wrong, @noisneil ?

You were close! You needed to add the extension .png at the end of the filename.

I've taken the liberty of streamlining the action creation by pasting the XML rather than inserting an action and then editing it.

Generate Click at Found Image Action.kmmacros (44 KB)

Macro screenshot

@noisneil this is truly amazing - I think you should post it as a separate entry as many folks may want to have this macro. I am still trying to figure out the magic of your xml, but it'll take me some time :slight_smile:

1 Like

Here's how I did that:

  • I inserted a click at found image action and selected Edit > Copy as > Copy as XML.
  • I pasted this into a text editor and located this line pair:
  • I inserted the image file path variable to get this:
  • In order to paste this XML into the Set System Clipboard to Text action, you have to "break" the XML. If you don't, the action will be pasted rather than the XML text. To do this, you can just add some random junk text to the start of the XML like this:
write anything you like here<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
  • Once it's pasted, you can delete the junk text.
1 Like

very cool - thank you for your guidance

1 Like