Keyword search / wait until keyword is found

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