Jan 16, '04 10:19:00AM • Contributed by: simX
There are some apps out there that simply refuse to allow you to take a screenshot of them -- this is usually limited to games which hijack the keyboard so that they intercept your screenshot command before Mac OS X itself can notice it, and perhaps Classic applications. But, I figured out a way to get a screenshot anyway.
The secret is Grab (in Applications -> Utilities), the much-maligned application that's pretty much useless for taking screenshots since you might as well use the regular key combos. Grab's one redeeming feature, though, is its great "Timed Screenshot" feature, which allows you to get your screen all set up perfectly within 10 seconds before it takes the capture. Unfortunately, you can't change that interval, so you still may not be able to set up the screen fast enough for Grab to work.
But AppleScript comes to the rescue! Although Grab itself is not scriptable, you can use UI Scripting to control it, and this allows us to lengthen this interval. First, we need to activate GUI scripting. Under Panther, go to System Preferences -> Universal Access, and check "Enable access for assistive devices". For Jaguar, you must enable this as well, but you must also first download a GUI scripting package from Apple (which doesn't seem to be hosted on their site anymore -- anyone got a link?).
Now, open up Script Editor, paste in the following code, and save it as a script applet (an app that you can double click which will execute the code):
tell application "Grab" activate end tell tell application "System Events" tell application process "Grab" click menu item "Timed Screen" of menu ¬ "Capture" of menu bar item "Capture" of menu bar 1 activate delay 50 click button "Start Timer" of window "Timed Screen Grab" end tell end tell
This script is a 60 second time-delay screenshot. It delays for 50 seconds, then starts the Grab timer, which is 10 seconds. Of course, just change the number in the "delay 50" line for whatever you want -- the effective time interval is always that number plus 10 seconds. Now run the script, and then set up your screen in however long you need -- no more rushing to get that screenshot to work!
An interesting side effect of this in some apps is that it allows you to get out of the app even if it hijacks the screen and doesn't allow you to switch to other apps without quitting. Since Grab automatically opens up your timed screenshot once it's taken it, sometimes it forces your application to go in the background, which could be a plus in some circumstances.