Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to write an apple script to use the "Grab" application in the Utilities folder to capture and print an application's window.

I can get to the part where I tell Grab to start window capture mode, but I can't seem to script clicking of another applications window to cause the correct window to be captured.

I have tried the "click at {x,y}" without success. All of the screen capture scripts I have found thus far do entire screen only with a command line tool. Does anyone have any suggestions?

share|improve this question
up vote 1 down vote accepted

You can use screencapture -l to target a specific window.

-l<windowid> capture this windowsid

You can find the IDs with AppleScript or Quartz Debug.

share|improve this answer
oh, very cool! Had not thought of that... – Peter B Sep 24 '12 at 19:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.