← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #237129]: how to use printscreen on laptop in java which requires to press the "fn" key

 

Question #237129 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/237129

    Status: Answered => Open

lakshmi is still having a problem:
Thanks for the answers. It did help.

Comment # 6:

Forgot to mention that I did try running the .class file. I am still getting the same error.
Copying the code below. Its just a simple class on google search.

public class GoogleSearch {
	public static void openApp(){
		App.open("C:\\Program Files\\Internet Explorer\\iexplore.exe");		
	}
		
public static void openGoogle() throws InterruptedException, FindFailed{
		Screen s = new Screen();
		s.type("img/1378697905588.png", "www.google.com.au");
		s.type("\n");
		s.type("img/1381291211278.png", "sikuli java tutorial");
		s.type("\n");
	}

public static void main(String[] args){
	openApp();
	try {
		openGoogle();
	} catch (FindFailed e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (InterruptedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

Comment # 5:
Well, it would be a good feature to add. Saving screen shots. I will try to look for an alternative for this.
ScreenImage img = s.capture();
		String tempFName = img.getFile();
		String name = tempFName.substring(tempFName.indexOf("-")+1,tempFName.indexOf(".png"));

<name> is passed to this method.

public static void takePictureOfError(String Name) throws IOException, AWTException {
//			new File("C:\\Lakshmi - EA\\Sikuli\\Image Files").mkdir();
			Toolkit toolkit = Toolkit.getDefaultToolkit();
			Dimension screenSize = toolkit.getScreenSize();
			Rectangle screenRect = new Rectangle(screenSize);
			Robot robot = new Robot();
			BufferedImage image = robot.createScreenCapture(screenRect);
			ImageIO.write(image, "png", new File("C:\\Lakshmi - EA\\Sikuli\\Image Files\\"+ Name));
}
This creates a file for me with the name as the image. but not sure with what extension. I am not able to view that file.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.