Screen Capture to File

How can I save screen capture into file instead of clipboard?
Or, can I save the screen capture into clipboard, then save clipboard to a file as an image file?
Another option I found is screencapture shell, but I can’t use it because I need to target specific window, and I can’t find id of window using jxa. It seems like the program needs to support apple script in order to get the window id using JXA.
If there’s a way to get the id of frontmost window with KM, I could probably use shell.

Search this forum for “screenshot” and you’ll find lots of threads on the subject.

1 Like

Use the Screen Capture action to capture to a named clipboard, and then the Write to a File action to write it to disk.

You could. The above suggestion uses a Named Clipboard which keeps the capture off the System Clipboard, but you could use the System Clipboard if you want.

1 Like

That worked! Awesome! Thanks!


is there any way to make it fully save as the image file? I have tried saving with all of the PNG JPEG etc choices in Keyboard Maestro when you write to file and works well, but the only thing is it saves the image file to a text edit file document, any way to make it save directly to JPEG?

Hey Dan,

Are you perhaps forgetting to give the saved file the correct file suffix?


Hi Chris and thanks for your response. I might be- would i be putting that at the end of the name field? Here is what i have now there- do i just put a .jpeg at the end and it will create a new jpeg every time?

/Users/danklim/Pictures/Screenshots from logic evernote recording sessions/screenshot %ShortDate% %LongTime%

or do you mean somewhere else?

Hey Dan,

Yes – try that. Make sure when you write the file that the file name ends with .jpg (I would use .jpg rather than .jpeg myself).

Try that and see if it works.

Report back, and we’ll go from there.


1 Like

Is it possible to paste from a clipboard Screen Capture as a jpg? It pastes as a TIFF and I am trying to automate a workflow that I can send text to an Android phone and TIFF doesn't ever seem to send though the files are very small so data is not the issue.

I don't see anything in the help that lets you choose what format is captured to the clipboard for a Screen Capture. Perhaps there is some odd workaround of using write to a file and then capturing the write to a file back to the same clipboard.

Hi, @skillet. If you look on the Screen Capture wiki page you’ll see information regarding the use of screencapture in a shell script. That command allows you to set the format. See: screencapture Man Page - macOS -

You could likely use the Write to a File action to write as a jpeg, and then use the Set Clipboard to File Reference action to set the clipboard to a reference to that file - might work. Or the Read a File action might work, but internally Keyboard Maestro has a preference for tiffs for images.

Thank you for the info I'll resort to this if I am not able to figure it keeping it in Keyboard Maestro though KM actions.

Okay thank you, perhaps that might be something for a new version of Keyboard Maestro to be able to chose what format the Screen Capture action uses. I'll see if I can get the work around to work.

Hi, @skillet. Maybe I'm not clearly understanding your objective, but maybe this will help:

Download: Screen Capture.kmmacros (2.1 KB)


  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 13.4.1 (22F770820d)
  • Keyboard Maestro v10.2

Note that when you run the macro a selection cross-hair will appear. You can toggle to a camera icon to go into window selection mode.