1

In my macro1.iim , I search google for Iron Maiden. If a certain keyword is found in the results (example: the word "eddy") I want to extract the word "eddy" and save it to a text file. If the word is not found I want to wait 10min and search again.

Thinking eval or making a vbs script?
Could someone show me how do I do this?

I've tried this:

`VERSION BUILD=7500718 RECORDER=FX
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 15
TAB T=1     
TAB CLOSEALLOTHERS
ONDIALOG POS=1 BUTTON=OK CONTENT=
URL GOTO=http://google.com/search=ironmaiden/
TAG POS=1 TYPE=P ATTR=TXT:eddy EXTRACT=TXT
SET !VAR1 EVAL("var s=\"{{!EXTRACT}}\";var txt=/eddy/i;
if (s.match(eddy)) iimPlay(macro2)
else WAIT=10000 seconds {{!LOOP}}")`
António Almeida
  • 9,620
  • 8
  • 59
  • 66
user2055234
  • 17
  • 2
  • 8

1 Answers1

1

Here is one way you can do it with iMacros JavaScript scripting.

//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:eddy EXTRACT=TXT"+"\n";



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")
{

//save it to text file
}
else
{

    iimDisplay("Waiting for 10 minutes")
iimPlay(macroWait)
}

}

You can use this answer to save the data in text file.

Community
  • 1
  • 1
edinvnode
  • 3,497
  • 7
  • 30
  • 53