Using iMacros with JAVA via JACOB (64bit support)

Share your tips, tricks and favorite iMacros macros, scripts and applications for web automation in general here.
Post Reply
Hannes, Tech Support

Using iMacros with JAVA via JACOB (64bit support)

Post by Hannes, Tech Support » Mon Aug 23, 2010 8:37 am

Three notes before we start:

1) The process of how to set up a JAVA project in Eclipse, and how to add external resources (.jar or .dll files), can be found in this thread: http://forum.iopus.com/viewtopic.php?f=6&t=2703
2) We selected JACOB (http://sourceforge.net/projects/jacob-project/) because it is free software (cf. their site for the license), and because it supports 64bit systems
3) Documentation on using JACOB is pretty sparse, especially for beginners. Maybe you want to help that great project.

And here's how to call iMacros from Java using JACOB (having an IDE like Eclipse or NetBeans in mind):

1) Download JACOB (http://sourceforge.net/projects/jacob-project/files/). You won't need the source package for our task.
2) Create a new Java project
3) Add references to
3a) jacob.jar
3b) jacob.dll (whose real name is something like "jacob-1.15-M3-x64.dll"
4) Use the following code sample as a beginning

Code: Select all

import com.jacob.activeX.*;

public class iMacrosJACOBtest {

	public static void main(String[] args) {
		
		System.out.println("Started.");

		// connect to iMacros Scripting Interface
		ActiveXComponent iim = new ActiveXComponent("imacros");
		
		System.out.println("Calling iimInit");
		iim.invoke("iimInit"); // call iimInit()
		
		System.out.println("Calling iimPlay");
		iim.invoke("iimPlay", "CODE:URL GOTO=http://www.google.de"); // call iimPlay()
	}
}
Post Reply