Keyword search / wait until keyword is found

Moderator: iMacros Moderators

Keyword search / wait until keyword is found

by Hannes, Tech Support on Tue Jan 05, 2010 1: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)   
}
Hannes, iOpus Support
Hannes, Tech Support
 
Posts: 2120
Joined: Thu Sep 21, 2006 6:27 am

Return to How-To's and Examples for Firefox / JavaScript Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

Website Monitoring