#!/usr/local/bin/perl -w use strict; my $put_dir = '/home/user/screencaps/'; my ($topleftx, $toplefty, $width, $height, $delay, $num) = @ARGV; my $captime = time(); my $count; my $leave = 0; # gonna be like this: # import -window root -crop 300x200+200+200 foo.gif unless ($topleftx && $toplefty && $width && $height && $delay && $num) { $leave = 1; print <<'EOUSAGE' Usage: ./timed_import Filenames will be a UNIX timestamp set at script run followed by the number of the capture (ie. 1000959520-3.jpg) EOUSAGE } exit if $leave == 1; my $cropvalues = $topleftx . 'x' . $toplefty . '+' . $width . '+' . $height; $count = 1; while ($count <= $num) { my $filename = $captime . "-$count" . '.jpg'; my $cmd = 'import -window root -crop ' . $cropvalues . ' ' . $put_dir . $filename; my $devnull = `$cmd`; sleep($delay); $count++; }