Pyscreencapture is a command line utility that provides the window ID to the screencapture -l command, allowing you to automate and remotely take screenshots of specific windows on Mac OS X.

You're able to filter window IDs fitting a criteria, then those window IDs are substituted in for the command 'screencapture -l window_id' plus any additional flags you want to pass the command.

It uses a thin wrapper over the Objective-C Quartz Compositor windowing library to allow us to find window IDs based on criteria, such as its title or if it's visible/minimized/etc. Then it passes the window ID to the command-line screencapture utility.

To pass flags to screencapture, simply append the flag plus its value to your screencapture.py command. This will only work if the flag name isn't overshadowed by screencapture.py's flags. This will be fixed at some point.

Grab it here: https://github.com/thismachinechills/pyscreencapture

Use it like this:

    python3 screencapture.py Chrome -t nerd shit