Said Crispin Wellington on Thu, Apr 11, 2002 at 06:03:32PM +0800:

> I use import.
> 
> import -window root filename.png
> 
> It automatically saves in the format specified in the filename
> extension. png, jpg etc.
> 
> To wait before a capture go...
> 
> sleep 5; import -window root filename.png
> 
> I just mention it because knowing things on the command line will come
> in useful one day. (like capturing a screen remotely).

I wrote the attached script years ago to do the same thing, but to name
the shot according to the date and time, as well as increment the
filename if a similarly-named shot exists.

-- 
[!] Justin R. Miller <[EMAIL PROTECTED]>
    PGP 0xC9C40C31 -=- http://codesorcery.net

    http://news.independent.co.uk/world/asia_china/story.jsp?story=281067

#!/bin/sh

umask 133
DATE=`date [EMAIL PROTECTED]

if [ $# -ne 1 ]; then
        printf "Usage:\n  screenshot delay (in seconds)\n\n"
else
        if [ -f /tmp/$DATE.jpg ]; then
                COUNT=`ls /tmp/$DATE*.jpg |wc -w |awk '{printf $1}'`
                sleep $1
                import -silent -window root /tmp/$DATE'.'$COUNT.jpg
        else
                sleep $1
                import -silent -window root /tmp/$DATE.jpg
        fi

fi

Attachment: pgp3OWQrZu26H.pgp
Description: PGP signature

Reply via email to