The Jawin library does not support 64bit. However, there's a replacement called JACOB (http://sourceforge.net/projects/jacob-project/). It's pretty easy to use and the main steps given below still hold. Just replace any reference to jawin with the appropriate JACOB one. Additionally, I have posted a small HowTo here.
[End of update]
[Update]
When running iMacros from Java, you may also be interested in using the iMacros Java wrapper class: http://forum.imacros.net/viewtopic.php?f=14&t=1147
[End of update]
[update]
A tutorial for using NetBeans instead of Eclipse can be found here: http://forum.imacros.net/viewtopic.php?f=6&t=7183
[End of update]
Preliminaries:
1) Download Jawin (http://jawinproject.sourceforge.net/, version 1.0.19, released under this license: http://jawinproject.sourceforge.net/LICENSE.txt), extract to local folder
[Update] Version 2.0-alpha1 also works fine.[End of update]
2) Start Eclipse
Start new project (usign jawin) in Eclipse:
1) File --> New --> Project
2) Java --> Java Project --> Next
3) Enter name: "iMacrosScriptingInterface" --> Next
4) Libraries --> Add External Jars" --> select jawin.jar from the Jawin\lib directory --> Finish
5) Right-click iMacrosScriptingInterface in Package Explorer tab
6) Import --> General --> File System --> Next
7) Browse --> jawin-dir\bin\jawin.dll --> Finish
New Class in project
1) Select iMacrosScriptingInterface in the Package Explorer tab
2) File --> New --> Class
3) Name: iMacrosTest --> Finish
Writing/Runnign an example
1) Open iMacrosTest.java
2) Copy the following code to iMacrosTest.java:
Code: Select all
//This code makes use of jawin from http://jawinproject.sourceforge.net/
//jawin license: http://jawinproject.sourceforge.net/LICENSE.txt
//two imports from jawin.jar
import org.jawin.DispatchPtr;
import org.jawin.win32.Ole32;
public class iMacrosTest {
public static void main(String[] args) {
try {
Ole32.CoInitialize();
DispatchPtr app = new DispatchPtr("imacros");
//Calling iMacros methods
app.invoke("iimInit", null);
app.invoke("iimPlay", "CODE:URL GOTO=http://www.iopus.com");
app.invoke("iimPlay", "CODE:TAG POS=1 TYPE=A ATTR=TXT:iMacros EXTRACT=TXT");
//manually cast return values to correct type
String iret = app.invoke("iimGetLastExtract").toString();
app.invoke("iimExit");
System.out.println(iret);
Ole32.CoUninitialize();
}
catch (Exception e){
e.printStackTrace();
}
}
}
[Update]Changed TAG command to comply with web page layout.[End of update]
3) You might want to select the full code and have it automatically be indented with "CTRL-i"
4) Menu: Run --> Run...
5) Rightclick Java-Application --> New
6) Under "Classpath" you should find the jawin.jar
7) Under "Common" check both Debug and Run
8) Click Run
this can later be accessed by the Run-Button:
The Java class will now be compiled and started. It will open an iMacros browser window that visits http://www.iopus.com