screencapture of a specified window

Hello,

Can anyone help me figure out a way use the screencapture command to take a screen capture of a specified window with out take a screen capture of the entire desktop or interactively.

Specifically here is what I am trying to do:
I have a 6 monitors with many different things going. I always have one Safari page open that displays charts and graphs that are displayed in Flash. Because most of the page is a Flash movie, there is no way I can think of to print that specific Safari page to a file without using screencapture. Plus, I need this to be automated.

Does any one know of a way to accomplish this? As always, thank you in advance for any help.

iBook G4 Mac OS X (10.4)

Posted on Oct 31, 2006 8:16 AM

Reply
6 replies

Oct 31, 2006 7:34 PM in response to Redshark

perhaps this is not of much help. But have you tried using the screencapture command?

%/usr/sbin/screencapture --help
screencapture: illegal option -- -
usage: screencapture [-icmwsWx] [files]
-i capture screen interactively, by selection or window
control key - causes screen shot to go to clipboard
space key - toggle between mouse selection and
window selection modes
escape key - cancels interactive screen shot
-c force screen capture to go to the clipboard
-m only capture the main monitor, undefined if -i is set
-w only allow window selection mode
-s only allow mouse selection mode
-W start interaction in window selection mode
-x do not play sounds
-S in window capture mode, capture the screen not the window
-C capture the cursor as well as the screen. only in non-interactive modes
-t<format> image format to create, default is png
files where to save the screen capture, 1 file per screen

Nov 1, 2006 10:51 AM in response to Nils C. Anderson

Sorry I did not clarify that more.

Yes I was talking about the screencapture command. What I cannot figure out is how to use it to capture a specific Safari window when multiple ones are open automatically. I see how I could take a screenshot of the whole desktop, take a screenshot interactively whereby I would have to select the window myself.

I was looking for a way where I could use the screencapture command to capture the Safari window is only the one I want without having to select the window myself. Does this make sense?

Nov 2, 2006 1:43 PM in response to Redshark

Is the Safari window always in the same place on the same monitor when you want to do this?

If so, have you tried using Applescript to script a capture via Grab where Grab captures a defined area of the screen?

I am guessing you want to do this either at a defined interval or just quickly when you spot something interesting. An Applescript would do this for you I think.

Nov 8, 2006 6:01 AM in response to Redshark

The Grap application is the best tool for your task if static screen shots and simple AppleScript-ing will automate your tasks.

Since you ask in the unix forum, here's how to start it 🙂
open /Applications/Utilities/Grab.app

If you need to capture motion, or have more options, then a third party program might be better suited for your needs. Try Snapz Pro - it does everything grab does, is much more powerful in what and when it can take screen shots, plus it captures movies of what is drawn on the screen. You can download and try it for free.

Nov 8, 2006 8:17 AM in response to Michael Bradshaw

Since I am still getting some follow-up on this, I will consider it answered. I took several tips from people on this thread as well as others on related Applescript threads. Here is what I did, just in case anyone else needs to know.

I made the monitor with the Safari page I wanted to capture my primary monitor. Then I just used the very nice screencapture command that I was inquirying about in this thread, to capture the screen. Next I used an applescript to change the URL of the Safari page so that I could screencapture another Safari page with a flash movie. I used an automator action to download other non-flash Safari pages as PDFs and then combined them all with the built in automator action.

Even though this is the UNIX forum here is the applescript I used and a link to the Automator action just in case anyone ever needs any of this info. In the end I used the UNIX command screencapture, Applescript and Automator to get the job done. Thank you for all the help!

tell application "Safari"
-- get reference to document by url
set d to first document whose URL is "someurl"
set URL of d to "newURL"
end tell

http://www.apple.com/downloads/macosx/automator/downloadurlsaspdfs.html

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

screencapture of a specified window

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.