Screendump (screencapture or - or pesky dialog box

Hello, Applescriptscenti;

I’d like to get an image of a particular window on a screen or even a particular location on the screen. I’m trying to capture frames of animation and need to make many screenshots, and then glue them together. Hence, a script that does not require interaction from the user would be useful.

I have two promising routes, but neither of them really work yet.

  1. /usr/sbin/screencapture: It seems straightforward to drive screencapture to capture the entire screen, but I can’t seem to find a way to have it capture a portion of the screen (or a particular window).

  2. Again, driving seems like it should work but when I try to drive it through the user interface using applescript, I need to get past the window that says “When the window you want is ready, click Choose Window, then click the window to capture it.”

How does one do this part in Applescript?

If there are any suggestions, I would greatly appreciate any advice.

Thanks very much.


I don’t know “” but, most probably, it uses the utility you mentioned in “1)”. As long as I know, you can’t capture nothing except the entire screen without user interaction. Unless you try simulating keystrokes using “System Events” and GUI scripting. But I don’t think this is quick enough to create an animation with an acceptable frame rate.
Personally, I’d capture the entire screen using “screencapture”, then attempt to crop the resulting images using my favorite manipulation tool (perhaps ImageMagick?).