0

I have 2 macros I need to run in Firefox. They both run perfectly as iim's but I need to get them to run together

Macro1: It reads a text file with a number of links on it, loads the link, and moves on to the next

var macro1 = "CODE:";
macro1 += "VERSION BUILD=8300326 RECORDER=FX" + "\n";
macro1 += "" + "\n";
macro1 += "SET !DATASOURCE C:\\Users\\user1\\Documents\\REPORT_LINK_EXT_OBG.TXT" + "\n";
macro1 += "SET !DATASOURCE_LINE {{!LOOP}}" + "\n";
macro1 += "URL GOTO={{!COL1}}" + "\n";

Macro2: Extracts links for each page that macro1 opens. Problem is, there can be anywhere from 1 to 50 links that macro 2 needs to extract before macro1 moves on again.

var macro2 = "CODE:";
macro2 += "VERSION BUILD=7500718 RECORDER=FX" + "\n";
macro2 += "SET !TIMEOUT_TAG 2" + "\n";
macro2 += "SET !LOOP 2" + "\n";
macro2 += "SET !EXTRACT_TEST_POPUP NO" + "\n";
macro2 += "TAG POS={{!LOOP}} TYPE=A ATTR=HREF:*WeldDataLog.aspx?* EXTRACT=HREF" + "\n";
macro2 += "TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:aspnetForm ATTR=ID:ctl00_Main_ucReportHeader_pnlView_txtReportNumber EXTRACT=TXT" + "\n";
macro2 += "'----------------------------------\\/\\/\\/\\/\\/----Change this" + "\n";
macro2 += "SAVEAS TYPE=EXTRACT FOLDER=C:\\Users\\user1\\Documents FILE=LINK_EXT3test.TXT" + "\n";

I essentially need

Do macro1 Do macro2 Loop Loop

Can anyone help me get these 2 macros to work with instead of against each other?

1 Answer 1

1
iimPlay(macro1)

var link1=iimGetLastExtract();

var link2_array=new Array();

for(var i=0; i<50; i++)
{

iimPlay(macro2)
link2_array[i]=iimGetLastExtract();


}

Would something like this work for you?

To check if the link is extracted properly you can use this

iimPlay(macro)
var link=iimGetLastExtract();

if(link=="EANF")
{

//link is not there

}
else
{

// link is there

}

To change position of imacros command.

var macro;

macro ="CODE:";
macro +="TAG POS={{n}} TYPE=A ATTR=HREF:someurl.com EXTRACT=HREF";

for (var i=1;i<=10;i++)
{

iimSet("n",i)
iimPlay(macro)

}
Sign up to request clarification or add additional context in comments.

2 Comments

So close. This will navigate to the first report, and extract the first link 50 times. How do I get it to change href position, and stop when the last link is extracted? I'll work on tweaking this. Thank you so much!
You can use if clause and for example if returned varialbe is equal to #EANF# then you've extracted the last link. In order to change the position you can use POS={{n}} and before you call the macro it would be iimSet("n",some_number) . I will write this in my post .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.