1. Download the JACOB jav COM bridge -
http://sourceforge.net/projects/jacob-project/
2.Download the AutoIt Zip file option - http://www.autoitscript.com/site/autoit/downloads/
4.Navigate to where you have placed Jacob Zip and extract it
5. Create Lib folder in you project
7. Navigate the where you downloaded the AutoItX4java.jar file and copy into you Lib folder
8. Your Lib Folder should contain the below files -
8.1. AutoItX4Java.jar
8.2. Jacob.jar
8.3. Jacob-1.18-M2-x64.jar
8.4. Jacob-1.18-M2-x86.jar
9. Create one more folder called "Autoit" in side the Lib
10. Navigate the folder where you have extracted AutoIT and copy the AutoItX3.dll and the AutoITX3-X64.dll into the Lib/Autoit directory.
10. In Eclipse, right click on the project and click on the Refresh
11. Right click on the project again and select properties
12. Under the Java Build Path, Click on the Libraries tab.
13. Click on the Add JARS Button
14. Navigate to the Lib folder that we created and add the below
14.1 AutoIt4Java.jar
14.2 Jacob.Jar
15. Now we have register the AutoIt dll what we placed in our tools/ Autoit directory
15.1 If you are using the 32 bit system
15.1.1. Click on Start button
15.1.2. Enter "regsvr32 'youpath\AutoitX3.dll'
EX :- regsvr32 C:\Users\Madhu.m\Desktop\AutoitX3.dll
15.2 If you are using the 64 bit system
15.1.1. Click on Start button
15.1.2. Enter "regsvr32 'youpath\AutoitX3-X64.dll'
EX :- regsvr32 C:\Users\Madhu.m\Desktop\AutoitX3-X64.dll
Yahoo - That's now you can use AutoItX method directly from Eclipse
Find the sample code for calculator below
public static void main(String[] args) throws InterruptedException {
String jacobDllVersionToUse;
if (jvmBitVersion().contains("32")){
jacobDllVersionToUse = "jacob-1.18-M2-x86.dll"
}
else {
jacobDllVersionToUse = "jacob-1.18-M2-x64.dll";
}
File file = new File("lib", jacobDllVersionToUse);
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") ;
}
Note :- To get the Calculator buttons ids (any properties) . Use the Au3info application. That you can see in the auto installation directory.