How to activate native screenshot(s) from KM?

I take a ton of screenshots throughout the day. Is there a way to activate the native Mac screenshot “copy to clipboard with rectangular selection” normally on the hand twisting command+option+shift+4?

I’d like to include that in a more hand-friendly conflict palette I use for other tasks for the same workflow in which I take so many screenshots.

Use the action “screen capture”.

Sorry I should’ve been more specific (or not have posted so late), what I really need is the screenshot copy to clipboard with rectangular selection, normally on the hand twisting command+option+shift+4. Edited above to reflect this.

You can access screencapture via the shell:

screencapture -i -c

will make an interactive (rectangular selection) screenshot and copy it to the clipboard.

For more options type man screencapture in the Terminal.

For a working macro example that uses that shell command see my Enhanced Screenshot macro.

Along with the other suggestions, here's a simple example. This starts the Screenshot process. If you cancel the screenshot, nothing happens. Otherwise it saves the screenshot to a jpg file using a sequential number. Change as needed.

Screenshot with Selection.kmmacros (6.2 KB)

At Tom demonstrates, there's a fair amount of flexibility once you attach a keystroke to an Execute Shell Script Action.

I use a couple of shell scripts which create a small shadow (using the ImageMagick convert command), and open the screen shot file in Preview. e.g.

#!/bin/bash

TARGET="$HOME/Desktop/Screen shot "$(date +"%Y-%m-%d at %H.%M.%S").png
cd /tmp
screencapture -s a.png
/usr/local/bin/convert a.png \( +clone -background black -shadow 50x3+2+2 \) +swap -background white -layers merge +repage "$TARGET"
rm a.png
cd ~
open -a preview "$TARGET"

or

#!/bin/bash

TARGET="$HOME/Desktop/Screen shot "$(date +"%Y-%m-%d at %H.%M.%S").png
cd /tmp
screencapture -T5 -woC a.png
/usr/local/bin/convert a.png \( +clone -background black -shadow 50x3+2+2 \) +swap -background white -layers merge +repage "$TARGET"
rm a.png
cd ~
open -a preview "$TARGET"
1 Like

I can’t get this macro to work. This is supposed to take a screenshot and save the shot to a file in the documents folder, right? Well, nothing happens when I run this macro.

also i should note that when i run this macro what happens is that the command shift 4 button runs which on a mac informs you of the pixel dimensions of the cursor.

That means that the macro is working, since it's designed to let you select a portion of the screen with that pixel dimension cursor, not a screenshot of the entire screen. If you want it to save a screenshot of the entire screen, just delete the -i text from the Execute Shell Script action so that it looks like this:

54 PM

If you are referring to @ComplexPoint’s script, it is saving to the Desktop (not to Documents):

< … >
TARGET="$HOME/Desktop/Screen shot "$(date +"%Y-%m-%d at %H.%M.%S").png
< … >