Poor Man's Screenshot Automation
Sam Cooper
A picture is worth a thousand words
Automation for Mac Screenshot Naming and Annotation
Domain: Mac
Tools: Automator, Preview
Time: 20 min
"A picture is worth a thousand words"
I find myself taking screenshots often. This quick bit of workflow automation on the Mac is a game changer.
Once your fingers have wired in the perennial `Cmd-Shift-4 : spacebar : mouse click` approach you are almost always ready to grab something.
- Working with someone and they are doing something esoteric that you have never seen before? Think you might need it later? *Snap it*.
- - Someone is throwing up slides that you know will take you a while to extract what you need from them? *Snap it*
- - Someone screwed up and is screensharing a bit more then they intended? (I'm not saying do anything nefarious. But honestly, information is power, and the ability to gather information and use it is the name of the game yeah?) *Snap it*
- - When in doubt, *Snap it*
Ok, done with hyping the snapshot lifestyle. Either you are in or out. If you want to take it up a notch then keep reading :)
The Basics
A quick review:
- `Cmd-Shift-3` - hotkey combo to snap the whole screen
- `Cmd-Shift-4` - my previous goto, the hotkey option which snaps a window
- `Cmd-Shift-5` - bring up the GUI to manage screenshotting (to modify the default folder where snapshots land: select the `Options > Other location...` menu item).
Baby Steps unto now
The limits of my screenshotting customization up until this point have been to change the default folder from `~/Desktop` to `~/Documents/screenshots`
This folder is now filled with screenshot sprawl.
I have gajillion files with names like `screenshot_2025-01-26_15-12-47`.
This isn't the worst. I can flip through them, previewing and finding what I need to usually...
But what if I know that I'm taking a screenshot that I'm going to want to find again?
Enter some poor man's automation:
Preview is the focal point on the Mac for screenshots since it's the default image viewer and Preview has decent image annotation tools.
The goal of this excercise will be to streamline our Preview workflow by:
1. When I perform a custom screenshot have the file opened in Preview automatically. Navigating in the Finder down do the most recent snapshot everytime is painful.
2. Allow for easy renaming of the screenshot. Snapshots happen fast and I want to be able to rename them fast while the file is in front of me.
1. Custom Snapshot that opens in Preview
- Add another hotkey combo (`Cmd-Shift-8`) that takes the screenshot
- Once captured the image will open in Preview immediately
Overview
There is a CLI tool in Mac OS that performs screenshots: `screencapture`.
We can drive it via an applescript.
I prefer to capture just the window so have called it with `-W` in the script below. Bonus: while in capture mode you can hit the spacebar to go into crosshair mode.
The applescript can be created in Automator as a Quick Action.
It will then be availble in your keyboard shortcuts.
Instructions
1. Open Automator
2. Create a new Quick Action using the intro screen or `File > New` should get you going.
3. Change the `Workflow recieves current` selection to `no input` and leave it set to `any application`
5. From the left side of Automator search for `Run Applescript` and drag it into the automation window.
6. Paste the below code into the script window:
```on run {input, parameters}
set screenshotsPath to POSIX path of (path to documents folder) & "screenshots/"
set timeStamp to do shell script "date +%Y-%m-%d_%H-%M-%S"
set fileName to "screenshot_" & timeStamp & ".png"
do shell script "screencapture -W " & quoted form of (screenshotsPath & fileName)
do shell script "open " & quoted form of (screenshotsPath & fileName)
return input
end run
```
7. Test the Applescript by hitting the "Play" (Arrow) button.
8. Save the Quick Action and call it `ScreenshotAndOpen`.
9. To setup the keyboard shortcut: Open System Preferences and go to the Keyboard screen.
10. Select the `Keyboard Shortcuts...` button.
11. From the categories on the left hand side select `Services`
12. Then in the checkbox box option displayed in the main windows open the `General` group and you should see your QuickAction called `ScreenshotAndOpen`.
13. Double click on the keycombo box on the right hand side and you will be able to put in your custom key combination. I've gone with `Cmd-Shift-8` to provide to make it similar to the previous screen capture combinations (with the 8 key being a bit easier to reach).
A note about System Preferences > Screen and System Audio Recording
When you create your own script to do the screen capture you will need to enable it for each App.
Often you will need to restart that application after allowing it to accept screen capture in your System Preferences.
You can control this in your:
System Preferences > Privacy & Security > Screen & System Audio RecordingThere you can allow access.
Perform this for apps you are using to screenshot and you should be set.
You should now be able to take screenshots using `Cmd-Shift-8` and have them open up right away in Preview.
2. Allow for easy renaming of the screenshot
Preview has a hotkey combo for Save As, but not for Save. (doh!)
There is a File > Rename... option that is exactly what we want (but alas no hotkey).
Fortunately, Keyboard Shortcuts supports us making an Application shortcut based on the menu name.
You can set this up so any App with the menu item `Rename...` can be triggered with Cmd-Shift-R
With that, you have a nice hotkey drive snapshotting solution.
Note: these instructions were written using Mac OS Sequoia 15.2