Use AppleScript to capture PDF screenshots in 10.4

Jun 14, '05 09:22:00AM

Contributed by: Anonymous

Apple decided to change the default file format of screen captures from PDF to PNG in OS X 10.4.x. In so doing, they also did not take the time to make a preference setting so users can pick their own preferred format of working with images. This workaround uses two scripts to bring back the default PDF format for output using the Scripts menu, leaving the standard keyboard shortcuts generating files in PNG format.

Note: Users of previous versions of Mac OS X who would like to have PNG output instead of their native PDF output can simply modify the line set format_ to "pdf" to read set format_ to "png" in each of the below scripts. There you go, two hints for the price of one!

First, create the scripts. Open Script Editor from /Applications/AppleScript, and first paste in the Screen Capture PDF script. This script will do a full-screen capture to PDF. Save the file with the name _Screen Capture PDF and save it in /Library/Scripts (depending on your account's permissions, you may have to first save it to the Desktop, then move it to this folder manually). Set the Format to Application, and check the Run Only box (leave the other two options unchecked).

Next, create a new empty script, and paste in the Selection Capture PDF script. Save this one as _Selection Capture PDF, also in /Library/Scripts, with Format set to Application and Run Only checked.

If you haven't done so already, enable the Scripts menu. Run the AppleScript Utility application in /Applications/AppleScript. At the bottom is a check box next to Show Script Menu in menu bar -- make sure this is checked! Below that is a check box next to Show Library scripts; make sure this is also checked. Below that are two radio buttons/circles, in which I have "Bottom" selected. Close the AppleScript Utility

The tools are now ready to use. On the top right of your Mac's menubar will be the black scripts icon (it looks like a curled sheet of paper). Select that, and near the top will be the two scripts. If you want to take a shot of the entire screen, use _Screen Capture PDF. If you want to only take a snapshot of a part of the screen, use _Selection Capture PDF, and then use your mouse to draw a box with the mouse button (left mouse button on non-Apple mice).

[robg adds: I tested these and they both work. If you have more than one screen and would like them all captured, change ...screencapture -mt"... to ...screencapture -t"... in the first script. You could also modify the file type from PDF to something else, though the screensaver documentation doesn't define the syntax for any of the types. This hint is *not* marked Tiger-only, as these scripts will work in 10.3, as noted above.]

Comments (6)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050528001954858