How to write java program in Sikuli?
I have recorded a GUI desktop application using SIKULI as shown below:
App.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe")
sleep(1)
type ("mganda1")
sleep(1)
click( ) //click OK
I want to convert this script to Java. So I try as below:
package com.arcot.test.vpn;
import org.sikuli.script.*;
public class AuthLogin {
public static void main(String[] args) {
Screen s = new Screen();
App myApp = new App("application-identifier") ;
myApp.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe");
// How to simulate the type, sleep and click functions here?
I am looking for Java examples to understand the relation of objects and how to use them to simulate recorded scripts. Please provide if any of you know the links that help me.
Regards Madhu
source to share
After your program, proceed as follows:
package com.arcot.test.vpn;
import org.sikuli.script.*;
public class AuthLogin {
public static void main(String[] args) {
Screen s = new Screen();
App myApp = new App("application-identifier") ;
myApp.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe");
Please get started with this, -Create one image folder inside your "img" package -Copy all matching images to the img folder -Use the image names in the folder for different variables
To perform operations, use the follwing command:
s.type("mganda1");
s.sleep(time);
s.click("ok.png");
Regards, Npesik
source to share
Madhu,
I'm not sure why you wrote a script for lunch this app with sikuli. All the commands you use do not trigger any images and can be recorded without sikuli.
I would make the following changes to the original sikuli / jython script
App.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe")
sleep(1)
//change to
wait(path to image, FOREVER)
//By changing to a wait there is an implicit find as defined by the path to the image
type ("mganda1")
//if there are issues verifying focus invoke type with the img option
sleep(1)
//use wait instead of sleep
click( ) //click OK
//What are you clicking on?
As far as Java is concerned, here's a link to the javadocs Sikuli
source to share