Keyword search / wait until keyword is found

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
Post Reply
Hannes, Tech Support

Keyword search / wait until keyword is found

Post by Hannes, Tech Support » Tue Jan 05, 2010 8:46 am

  • Run initial macro to visit some page (low !TIMEOUT as we don't want to wait for it to be fully loaded)
  • Run extraction macro in loop until keyword is found

Code: Select all

var macro;
macro = "CODE:";
macro += "VERSION BUILD=6311226 RECORDER=FX" + " \n "; 
macro += "TAB T=1" + " \n "; 
macro += "SET !TIMEOUT 1" + "\n"
macro += "URL GOTO=http://iopus.com/" + " \n "; 

iret = iimPlay(macro);

/* here comes the loop */
/* running as long as the keyword is not found*/
var loopcounter = 0;
while ( iimGetLastExtract().search("iMacros") == -1 )
{
	loopcounter ++;
	iimDisplay("Loop " + loopcounter);
	macro = "CODE:";
	macro +=  "SET !TIMEOUT_TAG 1" + "\n";
	macro +=  "FRAME F=0" + " \n "; 
	macro +=  "TAG POS=1 TYPE=IMG ATTR=WIDTH:92&&VSPACE:6&&HEIGHT:14&&ALT:Highlights&&SRC:shared/images/home_highlight.gif&&TXT:" + " \n "; 
	macro +=  "TAG POS=R1 TYPE=DIV ATTR=ALIGN:left&&TXT:iMacros<SP>is<SP>the* EXTRACT=TXT" + " \n "; 
	iret = iimPlay(macro)	
}
Post Reply