Looping an iMacro That I Want Scheduled (OSX Command Line)

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Looping an iMacro That I Want Scheduled (OSX Command Line)

by windsurferk on Mon Jan 03, 2011 2:12 pm

I have a macro that I can successfully run using the "Play(Loop)" button, but I would like to be able to run the loop as a scheduled job on OSX. I understand from this article: http://wiki.imacros.net/iMacros_for_Fir ... ne_Support that I can run an iim from the command line interface via applescript, but I can't figure out how to make the macro loop.

Is there a way to either a) call this macro as a loop and pass in the max loop parameter OR b) embed the loop within the macro itself? Here is the macro I am running:

VERSION BUILD=7031111 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.anyurl.com
TAG POS={{!LOOP}} TYPE=A ATTR=HREF:http*
WAIT SECONDS=6
BACK
windsurferk
 
Posts: 7
Joined: Tue Jun 22, 2010 5:57 pm

Re: Looping an iMacro That I Want Scheduled (OSX Command Lin

by Tom, Tech Support on Wed Jan 05, 2011 7:27 am

Hi Windsurferk,

Good question! For iMacros Browser users (on Windows) there exists the -loop command line switch for this purpose.

For Firefox users, what you want to do is write a Javascript to control your loop:

MyLoop.js:
Code: Select all
var i;
for (i = 1; i < 4; i++) {
     iimSet("loop", i); // Note: Change {{!LOOP}} in your macro to {{loop}}
     iimPlay("MyMacro");
}

You can then call this Javascript from a URL, e.g. http://run.imacros.net/?m=MyLoop.js and start it from the Firefox command line.

Please subscribe to the iMacros Newsletter to be informed about the upcoming iMacros for Firefox *Mac* Scripting interface. Then you will be able to do the loop and much more using python.
Regards,

Tom, iMacros Support
Tom, Tech Support
 
Posts: 3350
Joined: Mon May 31, 2010 9:59 am

Re: Looping an iMacro That I Want Scheduled (OSX Command Lin

by windsurferk on Wed Jan 05, 2011 8:21 am

Wow. Thanks Tom. That's exactly what I needed. It took me a few mins, but I figured out that I needed to save that .js inside the iMacros "Macros" directory in order for that URL to work. Then I just created an applescript that looks like this:

do shell script "/usr/bin/open /Applications/Firefox.app 'http://run.imacros.net/?m=MyLoop.js'"

Thanks again for the response on this. I can't wait to set ALL my iMacros to run on a schedule!
windsurferk
 
Posts: 7
Joined: Tue Jun 22, 2010 5:57 pm

Javascript Loop Control - How to Fire URL outside of Loop

by windsurferk on Tue Jan 11, 2011 12:04 pm

Tom-
One more question related to this. I'm using the Javascript loop method, and am setting the loop to run 100 times since the actual number of hyperlinks on the page varies day to day. I'd like to figure out a way to, after the macro crawls all the links on the page, fire another URL (basically outside the loop).

Is this possible? Thanks in advance.
windsurferk
 
Posts: 7
Joined: Tue Jun 22, 2010 5:57 pm


Return to iMacros for Firefox

Who is online

Users browsing this forum: Google [Bot] and 9 guests

-->