How to create a screen capture a specific OS X window from the command line?

1

1

Is there a way to capture a screenshots of a specific window (even if that window is covered by other windows) from the command line, non-interactively? It seems that the built-in screencapture command only allows capturing windows with the -w flag, which requires the user to interactively pick the window for capturing, so this isn't a solution.

GJ.

Posted 2015-11-27T11:36:30.787

Reputation: 8 151

Answers

3

It seems to be possible with a the -l flag for screencapture, a flag which isn't documented in the man as of 10.11.1 ...

The flag has to get the window ID as a parameter, and the ID can be found using https://apple.stackexchange.com/questions/56561/how-do-i-find-the-windowid-to-pass-to-screencapture-l

GJ.

Posted 2015-11-27T11:36:30.787

Reputation: 8 151