Below is a script to automatically take screenshots. It is not beautiful, but it demonstrates how to take screenshots with perl and also how to take screenshots the non-interactive way in gnome/X. the import command as shown can be used to take screenshots from the command line in linux, gnome... etc. #!/ usr/bin/perl -w# By Matthew Jones, 2010.# This script takes a screenshot of the current desktop.# and saves the screenshot to a file in X directory every# N seconds Y number of times. # Script Relies on:# 1) Perl# 2) X session running in current environment# 3) Availability of "import" commnad installed in env.use Time::localtime;my $argNum = $#ARGV + 1;if((($argNum=="1") && ($ARGV[0] eq "H"))){print "Usage:\n";print "autoCam.pl directory times seconds format\n";print "directory - location images are saved.\n";print "times - number of images taken.\n";print "seconds - number of seconds between screenshots\n";print "format - file format, ie: png, jpg, ps\n";}elsif($argNum!="4"){print "Missing Arguments\n";print "Usage:\n";print "autoCam.pl directory times seconds format\n";}elsif($argNum="4"){my $directory = $ARGV[0];my $times = $ARGV[1];my $seconds = $ARGV[2];my $format= $ARGV[3];my $counter = 0;while($counter<$times){$counter++; my $localEpoch = time(); system("import -window root $directory/$localEpoch.$format");sleep($seconds);}} |