Saturday, August 28, 2010

automate taking screencaps

Scenario: You want to take screen-shots of an application at regular intervals ( every 5 minutes ) and save it in a folder. The files are renamed with the current date and time.
There are many uses of this. If you want to archive graphs, or if you want to to monitor usage of the applications etc.

First you need to get the window-ID of the application window that you want to monitor:
run:

xwininfo

this will create a crosshair cursor,which when you click on the application will extract the ID.

Pass this window id into the following script. i have given 0x3a000, which is the windowID of the application i wanted to monitor.

Linux makes your life easy.


while [ 1 ]; do sleep 600;import -window 0x3a0004c -quality 40 /home/ishu/snaps/`date +%Y_%m_%d_%H_%M_%S`.jpg; done


No comments: