Tuesday, 2 August 2016

auto screen capture | automatic screenshot | take a screenshot

auto screen capture | automatic screenshot  | take a screenshot


Requrie library : FileUtils

steps for implement (only one time)
1) clean and build make .jar
2) put on startup.

Results
it will take photo/screenshot on you machine activity.
now this jar will fully automated. if you shutdown your machine and started it will take screenshot automatic.
get data in your C:\\screen you set path on your machine to copy images

Note:-
This program will help you to trace your machine activity for your absense.
so it will help you to know your machine activity doing your absense.



package screenshots;

import java.awt.AWTException;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.apache.commons.io.FileUtils;

/**
 *
 * @author vishal.khokhar
 */
public class ScreenCapture extends Thread {

    public void run() {
        try {
            //here i set number of min to interval capture image
            //i.e. 1 for take every min to capture image

            int time = 1;

            String path="c://screen/";
            File file = new File(path);
            FileUtils.forceMkdir(file);

            while (true) {
                Rectangle rectangle = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
                BufferedImage capture = new Robot().createScreenCapture(rectangle);

                //Here first parameter is prefix image_name
                //And second parameter is suffix image_name
                //so imagename like "prefix+XXXXXXX+suffix" in middle will given unique name for each file

                ImageIO.write(capture, "png", File.createTempFile("vishal", "khokhar", file));

                try {
                    Thread.sleep(time * 60000);
                } catch (InterruptedException ie) {
                    ie.printStackTrace();
                }
            }
        } catch (AWTException awte) {
            awte.printStackTrace();
        } catch (IOException ie) {
            ie.printStackTrace();
        }
    }
}
 

Output Like 

 


1 comment: