如何在Sikuli中编写java程序?

发布于 2024-10-27 14:30:25 字数 612 浏览 3 评论 0原文

我使用 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示例来理解对象关系以及如何使用它来模拟录制的脚本。如果有人知道对我有帮助的链接,请提供。

此致, 马杜

I have recorded the GUI desktop application using SIKULI as 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 into Java. So I am trying 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 searching for java examples to understand the objects relation and how to use it to simulate the recorded scripts. Please provide if any of you know the links that help me.

Best regards,
Madhu

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

潦草背影 2024-11-03 14:30:25

程序结束后,请按以下方式进行:

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"); 

问候,
恩佩斯克

After your program, proceed in following way:

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");

Kindly proceed in this way,
-Create one image folder inside your package "img"
-Copy all the respective images in the img folder
-Assign the image names in a folder to a different variables

For doing operations, use follwing command:

s.type("mganda1");   
s.sleep(time);    
s.click("ok.png"); 

Regards,
Npesik

内心荒芜 2024-11-03 14:30:25

Madhu,

我不知道你为什么录制脚本来与 sikuli 一起使用该应用程序。你使用的所有命令都不会调用任何图像,并且都可以在没有 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?

关于 Java,这里是 Sikuli javadocs 的链接< /a>

Madhu,

I'm not sure why you recorded the script to lunch that app with sikuli. All of the commands yu use don't invoke any images and can all be written without the sikuli ide.

I would make the following changes to your 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?

Regarding Java, here's the link to Sikuli javadocs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文