← Back to team overview

sikuli-driver team mailing list archive

[Question #690084]: Sikulixapi-2.0.4 not working after creating a jar of my Java SWt desktop application

 

New question #690084 on Sikuli:
https://answers.launchpad.net/sikuli/+question/690084

Hi,

I have add sikulixapi-2.0.4 jar in my project's build path as external jar and implemented the functionality which I required. Its is working fine as fas a considered running the application in eclipse IDE. But when I export it as jar sikuli doesn't work at all. As I tried to run my jar via commandline to se verbose it enters the loop in while I havw written Sikuli logic but never ever passes the condition and feels like goes in infinite loop nor gives any error. Also I don't think there might be any error in my code. Here is the code below.

----------------- Code starts --------------------
@Override
	public String call() throws Exception {
		// ImagePath.add(System.getProperty("user.dir"));
		ImagePath.add(System.getProperty("user.dir") + File.separator 
				+ "images");
		Screen screen = null;
		try {
			System.out.println("Starting screen capture...");
			screen = new Screen();
			while (true) {
				if (screen.exists(createFullPathOfPatternImages(OKAY_DIALOG_AFTER_EXECUTION)) != null) {
					System.out.println("Dialog loaded!");
					screen.click(createFullPathOfPatternImages(SCRIPT_COMP_OKAY_BUTTON));
					// Call captureAndSaveScreen function for capturing
					// and saving screenshot.
					captureAndSaveScreen(filePath, fileName);
					// Continue closing process.
					screen.click(createFullPathOfPatternImages(TOAD_TITLE));
					screen.keyDown(Key.ALT);
					screen.keyDown(Key.F4);
					screen.keyUp(Key.ALT);
					screen.keyUp(Key.F4);
					break;
				} else {
					System.out.println("Waiting for dialog...");
					screen.wait(createFullPathOfPatternImages(OKAY_DIALOG_AFTER_EXECUTION), 2.0);
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return "";
	}
--------------------- Code Ends -------------------------
I have implemented it as a thread to run when the image matches with my desktop application.

Kindly help and suggest the steps required. I am new to Sikuli.

Thanks

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.