firefoxscriptingextractimacros

How to extract all instances of a word on a Google Search using iMacros?


//declaring the macro
var macroIronMaiden;

macroIronMaiden ="CODE:";
macroIronMaiden +="VERSION BUILD=7500718 RECORDER=FX"+"\n";
macroIronMaiden +="SET !EXTRACT_TEST_POPUP NO"+"\n";
macroIronMaiden +="SET !ERRORIGNORE YES"+"\n";
macroIronMaiden +="SET !TIMEOUT_PAGE 15"+"\n";
macroIronMaiden +="TAB T=1"+"\n";
macroIronMaiden +="TAB CLOSEALLOTHERS"+"\n";
macroIronMaiden +="ONDIALOG POS=1 BUTTON=OK CONTENT="+"\n";
macroIronMaiden +="URL GOTO=http://google.com/search=ironmaiden/"+"\n";
macroIronMaiden +="TAG POS=1 TYPE=P ATTR=TXT:Leyton EXTRACT=TXT"+"\n";

This isn't working, I want to extract any "LEYTON" text on the page.


var macroWait;

macroWait ="CODE:";
macroWait +="WAIT SECONDS=600";    
//Beginning///////

//this loop will search 10 times. Change number 10 for more times

for(var i=0;i<10;i++)
   {
    iimPlay(macroIronMaiden)
    var extract=iimGetLastExtract(); 
    if(extract.toLowerCase()=="eddy")

      {
      //go to yahoo.ca
      }
      else
      {
        iimDisplay("Waiting for 10 minutes")
        iimPlay(macroWait)
        //go back to top and search again.
      }
  }

The word "leyton" on the search results page is spelled "Leyton". How can I change this so it's not just lowercase letters?


[Using iMacros for FF v7.x]


Solution

  • Welcome to world of problems with iMacros. This could be the problem.

    macroIronMaiden +="TAG POS=1 TYPE=P ATTR=TXT:Leyton EXTRACT=TXT"+"\n";
    

    Check is the type on the page set the right way. It could be different then P. Could be DIV,SPAN or something else.

    If you want to change the text in JavaScript to lower case use.

    text=text.toLowerCase();
    

    and set it to iMacros with iimSet command. Visit this page too