[solved] SET & Extract via Java

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
pl4n3
Posts: 1
Joined: Wed May 23, 2012 1:38 pm

[solved] SET & Extract via Java

Post by pl4n3 » Sat May 26, 2012 5:10 pm

Hello iOpus community,

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();
			}
		}
	}
}


Ok, the first thing I do not understand is: iim.invoke("iimPlayCode", "SET !REPLAYSPEED SLOW");
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.
Zack
Posts: 3
Joined: Fri Jul 25, 2014 9:16 am

Re: [solved] SET & Extract via Java

Post by Zack » Tue Aug 05, 2014 10:29 am

I'm sorry how did you correct in the end? I would like to understand how the method works IRETURN() that are very concerned on how to capture the error is written to the file iMacros.log
Post Reply