[英]How to write java program in Sikuli?
我已經使用SIKULI記錄了GUI桌面應用程序,如下所示:
App.open ("C:\\Program Files\\acd\\bin\\VPNClient.exe")
sleep(1)
type ("mganda1")
sleep(1)
click( ) //click OK
我想將此腳本轉換為Java。 所以我嘗試如下:
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");
//如何在此處模擬類型,睡眠和單擊功能?
我正在搜索Java示例以了解對象關系以及如何使用它來模擬記錄的腳本。 請提供您是否知道有助於我的鏈接。
最好的問候,馬杜
程序完成后,請按照以下方式進行:
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");
請以這種方式進行操作,-在包“ img”中創建一個圖像文件夾-復制img文件夾中的所有相應圖像-將文件夾中的圖像名稱分配給其他變量
要執行操作,請使用以下命令:
s.type("mganda1");
s.sleep(time);
s.click("ok.png");
問候,Npesik
馬杜,
我不確定為什么您將腳本錄制為與sikuli共進午餐。 yu使用的所有命令都不會調用任何圖像,並且都可以在不使用sikuli ide的情況下編寫。
我將對您的原始sikuli / jython腳本進行以下更改
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?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.