Turns out there might be an easier way, as the Apple screen-grabbing utility can be called from the command line.
Paths & Permissions. Unless youâve given Terminal âFull Disk Accessâ in system Preferences, donât try to use full paths or ~
-based ones. The Tinderbox default is your home folder, though run command and stipulate a different one. Otherwise, us a relative path from your home folder (and all folders of which exist!). So, to save to the Desktop use Desktop/file.png
and not ~/File/file.png
.
See the utilities man
page for options. As the plan is to take a user-defined shot you must use the -i
option. Two others are useful. -d
gives a UI dialog with a message if there is an error, e.g. as above with OS write permissions. -x
is useful if you want no feedback sound from the screen grab action.
Format. Grabs default to a PNG, though see the man page if you need other formats. The PNG is likely lightly compressed so you might want to pipe the image to something like imagoptim via its command line.
The demo file below has two stamps. The first makes a PNG in your hoe folder . It replaces spaces in the stamped noteâs $Name with underscores and writes the string passed to runCommand()
into the $Text of a note âlogâ, for error checking.
Stamp #2 does the same but adds a path element, writing the file to the Desktop, by way of further example.
Note the stampâs work with the all 3 of the text view panes: text/preview/export, but not that the whole area to be captured must be visible on screen before initiating a grab (i.e. no scrolling which grabbing).
Here is the test file: screengrab-demo.tbx (212.6 KB)
@satikusala, I think this gives you the core structure that you can enhance for your process, e.g. more complex file name or path, as everything can be done in Tinderbox and then passed to the command-line. Much easier than Automator in the end!
For those old enough to remember, the mighty Price Noggin was one of Oliver Postgateâs creations.