Screenshots extension for Alfred.app
This is an extension for Alfred, the amazing Mac OS X productivity app. It allows the user to initiate a screen capture process using Alfred's extension mechanisms, and supports a very flexible set of arguments that give the user the opportunity to customize the screenshot and how it will be used.
screen jpg # captures the whole screen into a JPG image file screen area clip # captures an area selected by the user, into the clipboard screen window 10 # captures a window selected by the user, after 10 seconds screen tiff full mail # captures the whole screen into a tiff file to be sent by email screen 12 open # captures the whole screen after 12 seconds, and opens the image file screen window preview # captures a window selected by the user and opens it in Preview.app
There are four kinds of arguments supported: scope, format, action and delay. The scope specifies what to capture on the screen; the format specifies what image format to use to store the screenshot, and the action specifies what to do with the captured screenshot.
The delay argument is the number of seconds to wait before starting the process of taking the screenshot. This might be useful if the user wants to prepare some conditions before actually start taking the screenshot. As a protection for excessively large numeric values, the script will never delay more than 30 seconds.
Here are the possible values for the different kinds of non-numeric arguments:
full: capture the whole screen (default)
selection: capture an area of the screen that the user must select
window: capture a specific window that the user must select
file: store the image as a file on disk (default)
clip: copy the captured screenshot to the clipboard
open: open the image with the default app
preview: open the image with Preview.app
All actions, except
clip, create a file on disk with the screenshot. The name of the file is generated with a fixed prefix string and the date and time of the screenshot in a suitable format. Images are generated in the first of the following folders that actually exists:
All these naming and location details for the image files can be customized only by altering the source code of the script.
Order and validation of arguments
Arguments can be given in any order. An unrecognized argument will abort the screen capture and a Growl notification will be shown, informing the user about the invalid argument.
In case of repeated arguments, or the presence of more than one argument of the same kind, note that the script ignores subsequent parameters of the same kind, and uses only the first parameter of each kind as the final value to be considered when actually executing the screen capture command. That is, for the example
screen area jpg window 12 clip png 10 open
the script will actually perform screenshot of an area of the screen, after delaying for 12 seconds, and will store a JPG image on the clipboard. The parameters
open will be ignored.