如何在Java中调用AutoIT UDF [英] how can I call AutoIT UDF within Java
本文介绍了如何在Java中调用AutoIT UDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的查询是如何使用COM(组件对象模型)在Java中调用autoIT的各种UDF(用户定义函数),就像下面提到的示例代码一样:
My query is how do I call the various UDF (user defined functions) of autoIT in Java using COM (component object model) just like the sample code mentioned below:
有点像这样:
File file = new File("lib" , "jacob-1.18-x64.dll");
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
AutoItX x = new AutoItX();
x.run("calc.exe");
x.winActivate("Calculator");
x.winWaitActive("Calculator");
//Enter 3
x.controlClick("Calculator", "", "133") ;
Thread.sleep(1000);
//Enter +
x.controlClick("Calculator", "", "93") ;
Thread.sleep(1000);
//Enter 3
x.controlClick("Calculator", "", "133") ;
Thread.sleep(1000);
//Enter =
x.controlClick("Calculator", "", "121") ;
推荐答案
您不能通过AutoItX使用现有的AutoIt代码.如果要使用AutoIt,有两种选择:
You cannot use existing AutoIt code using AutoItX. You have two options if you want to use AutoIt:
-
编译一个可以执行所需操作的AutoIt脚本,然后从Java程序中调用它.
Compile an AutoIt script that does what you want and call it from your Java program.
将UDF转换为Java/AutoItX
Convert the UDF to Java/AutoItX
这篇关于如何在Java中调用AutoIT UDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文