First, please excuse my bad English. I'm from Germany and my language skills are "outdated".
I'm trying to make a Java project that controls iMacros via Command Line Interface.
I've found in the forum, the possibility to control iMacros from Java with Jacob.
My current program code looks like this:
Code: Select all
//IMPORTS like: com.jacob.activeX.ActiveXComponent;
public class example
{
private ActiveXComponent iim;
public void iReturn()
{
iret = iim.invoke("iimGetErrorText").toString();
if(iret.equals("OK (1)")) { System.out.println("OK"); }
else { System.out.println("BOT: Error = "+iret); }
}
public void example()
{
Thread et = new Threadexample();
et.start();
}
class Threadexample extends Thread
{
public void run()
{
while ( ! isInterrupted() )
{
iim = new ActiveXComponent("imacros");
iim.invoke("iimInit");
iim.invoke("iimPlayCode", "CLEAR");
iReturn();
iim.invoke("iimPlayCode", "SET !REPLAYSPEED SLOW");
iReturn();
iim.invoke("iimPlayCode", "URL GOTO=http://whatismyipaddress.com/");
iReturn();
iim.invoke("iimPlayCode", "TAG POS=1 TYPE=H2 ATTR=TXT:* EXTRACT=TXT");
iReturn();
String path="C://test//";
iim.invoke("iimPlayCode", "SAVEAS TYPE=EXTRACT FOLDER="+path+" FILE=Extract.csv");
iReturn();
try
{
Thread.sleep( 500 );
}
catch ( InterruptedException e )
{
System.out.println("Interrupt: ThreadLogin");
interrupt();
}
interrupt();
}
}
}
}
Does it work this way? Or do I have to use iimSet ()? And if so, how?
I need a method to write an extracted text to a String variable. How can I do that?
Or do I have to read the extracted file and then write to a variable?
How can I implement this in threads?(read extracted file)
I work with Eclipse and iMacros Enterprise 8
I solved the problem by myself.