title: Imacros script to find text and alert if not found
body: <p>I can extract text and make a msgbox if not found using JS, but i need to know how to do it in imacros.</p>
  
  <p>The javascript that i use is here <a href="http://www.javascripter.net/faq/searchin.htm" rel="nofollow">http://www.javascripter.net/faq/searchin.htm</a></p>
  
  <pre><code>var TRange=null;
  
  function findString (str) {
   if (parseInt(navigator.appVersion)&lt;4) return;
   var strFound;
   if (window.find) {
  
    // CODE FOR BROWSERS THAT SUPPORT window.find
  
    strFound=self.find(str);
    if (!strFound) {
     strFound=self.find(str,0,1);
     while (self.find(str,0,1)) continue;
    }
   }
   else if (navigator.appName.indexOf("Microsoft")!=-1) {
  
    // EXPLORER-SPECIFIC CODE
  
    if (TRange!=null) {
     TRange.collapse(false);
     strFound=TRange.findText(str);
     if (strFound) TRange.select();
    }
    if (TRange==null || strFound==0) {
     TRange=self.document.body.createTextRange();
     strFound=TRange.findText(str);
     if (strFound) TRange.select();
    }
   }
   else if (navigator.appName=="Opera") {
    alert ("Opera browsers not supported, sorry...")
    return;
   }
   if (!strFound) alert ("String '"+str+"' not found!")
   return;
  }
  </code></pre>