autoitx4java.jar,README.md

#AutoItX4Java

AutoIt is a very useful automation scripting language for Microsoft Windows. It allows for GUI automation using a very simple syntax and can be useful for testing Windows applications. It is packaged with AutoItX which supports accessing AutoIt functions through COM objects.

AutoItX4Java uses JACOB to access AutoItX through COM and strives to provide a native Java interface while maintaining the simplicity of AutoIt. Getting started is simple.

Download JACOB.

Download and install AutoIt.

Add jacob.jar and autoitx4java.jar to your library path. Note that this project (autoitx4java.jar) is comprised of one code file so you can alternatively just include AutoItX.java in lieu of autoitx4java.jar.

Place the jacob-1.15-M4-x64.dll file in your library path.

Start using AutoItX.

###Example

File file = new File("lib", "jacob-1.15-M4-x64.dll"); //path to the jacob dll

System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());

AutoItX x = new AutoItX();

String notepad = "Untitled - Notepad";

String testString = "this is a test.";

x.run("notepad.exe");

x.winActivate(notepad);

x.winWaitActive(notepad);

x.send(testString);

Assert.assertTrue(x.winExists(notepad, testString));

x.winClose(notepad, testString);

x.winWaitActive("Notepad");

x.send("{ALT}n");

Assert.assertFalse(x.winExists(notepad, testString));

####Troubleshooting

Both AutoItX3 and Jacob dll's come in x86 and x64 versions. Ensure you use the correct dlls.

If AutoItX isn't disposing itself properly make a call to ComThread.Release() when you are done using AutoItX.

Refer to JACOB documentation: JacobThreading and Object Lifetime

####Note

If you do not want to install AutoIt, you can just grab AutoItX3.dll and register it with: regsvr32.exe AutoItX3.dll

AutoItX4Java is comprised of one file so you can either use the jar or copy the .java file into your source.

If you get errors like: "Can’t co-create object" then ensure you have the AuotItX dll registered. If you need to manually register the 64 bit version, use: "\Windows\SysWOW64\regsvr32.exe AutoItX3_x64.dll" otherwise use "regsrv32.exe AutoItX3.dll".

####Warning

AutoItX4Java is not completely tested. Use at your own risk.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值