JavaScript macro link to a non JavaScript Macro?

Discussions and Tech Support specific to the iMacros Firefox Add-on.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
nma1919
Posts: 28
Joined: Fri Apr 17, 2009 1:56 pm

JavaScript macro link to a non JavaScript Macro?

Post by nma1919 » Sun Feb 14, 2010 2:42 pm

Code: Select all

    //imacros-js:showsteps no

    //Testing forum post [insert forum here]
    //Idea is to read something in common on the page and open each link in a new tab.
    var macro, retcode, url="", pos=1, stop=false;
    while(!stop)
    {
       macro="CODE:";
       macro+="TAB T=1\n";
       macro+="TAG POS="+pos+" TYPE=A ATTR=HREF:*[insert link]* EXTRACT=HREF\n";
       //macro+="TAG POS="+pos+" TYPE=A ATTR=HREF:*[insert link]* EXTRACT=HREF\n";
       
       retcode = iimPlay(macro);

       if (retcode < 0)               // an error has occured
       {
          errtext = iimGetLastError();
          alert("1st Error "+retcode+": "+errtext);
          stop=true;
       }
       
       //Stop if extract found nothing or counter is too high as a precaution
       if((url = iimGetLastExtract()) == "#EANF#" || pos > 100)
       {
          stop=true;
          break;
       }
       else
       {
          macro="CODE:";
          macro+="SET !TIMEOUT 1\n";
          macro+="SET !ERRORIGNORE YES\n";
          macro+="TAB T=1\n";
          macro+="TAB NEW OPEN\n";
          macro+="TAB T="+new Number(pos+1)+"\n";
          macro+="URL GOTO="+url+"\n";
          macro+="TAB T=1\n";
          
          retcode = iimPlay(macro);

          if (retcode < 0)               // an error has occured
          {
             errtext = iimGetLastError();
             alert("2nd Error "+retcode+": "+errtext);
             stop=true;
          }
          pos++;
       }
    }
I was successful in finding help with this particular macro. (Idea is to read something in common on the page and open each link in a new tab.) But I was unsuccessful in tweaking it.

I would like to open each link in a new tab (which it does), run a macro, then close that tab that the macro was run, and continue to the next link to repeat the process over again.

I've been trying for hours to figure this out and I just know it's possible. Thx in advance.

-Matt
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: JavaScript macro link to a non JavaScript Macro?

Post by Daniel, Tech Support » Mon Feb 15, 2010 2:02 pm

Hello,

So what is the particular difficulty, that you're facing now? Closing the tab where the macro run?
Well, why not add "TAB CLOSE" at the end of the macro? Could you please tell me where exactly you need help?

Best regards,
Daniel, iOpus Support
Post Reply