There is so many ways to generate screenshots on linux machine, like ksnapshot
gnome-screenshot etc. There is one more command available  is 'import'. It is used for capture some or all of an X server screen and save the image to a file in the system. Try this on your system. On Terminal try:




$ import test.png



You can find that the mouse pointer changes to cross-hair. Draw a rectangle using your mouse, it will captured and saved it to your home directory named test.png. If you try this instead import
root test.png
it will took all the screen and save automatically. From this I   developed a perl script to schedule to get automatic screenshots. Here is the code.




#/usr/bin/perl
use POSIX qw(strftime);

my $range = 600;
my $dir = '/opt/screen-'.strftime('%d-%m-%Y', localtime);

  while(1)  {
   $sleepr = rand($range);
   $file = strftime('%T', localtime);   if(! -d $dir)  {

        mkdir $dir;
         
$command = "sleep".$sleepr."; import -window root ".$dir.'/'.$file."_".$sleepr.".jpg";
system($command);
}


Run the script, and minimize the terminal, it will generate a screenshot and store automatically within having a maximum delay of 10 minutes, $range represents the maximum time delay.

Category : , | Read More...... edit post

Followers

FeedCount

Latest Posts

thecoderinc

Subscribe Now