LOOP

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
rouge02
Posts: 10
Joined: Mon Sep 28, 2009 5:45 pm
Location: Trinidad and Tobago

Re: LOOP

Post by rouge02 » Sun Apr 03, 2011 12:38 pm

Again looping the entire script is quite easy.. mainly interested in looping just a couple of specific lines within the script.
I just want to thank everyone for all their comments and advice on this topic.
I've leaned quite a lot since then and have refined most of my scripts to be a lot more efficient with the help I've gotten here,
and one of my co-workers. Still seeking to learn more about looping specific lines of script within the iMacro script itself,
so keep those comments coming in. Thanks
thankyou
Posts: 1
Joined: Fri Aug 29, 2014 10:09 pm

Re: LOOP

Post by thankyou » Fri Aug 29, 2014 10:12 pm

xNeroX wrote:A neat trick to script a loop into the macro itself. use this
SET !LOOP -500
(This will trick the Macro into repeating 500 times)
Just REGISTER to say for you thank you,you made my day man :D best short answer. :D
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: LOOP

Post by chivracq » Sat Aug 30, 2014 1:23 pm

thankyou wrote:
xNeroX wrote:A neat trick to script a loop into the macro itself. use this
SET !LOOP -500
(This will trick the Macro into repeating 500 times)
Just REGISTER to say for you thank you,you made my day man :D best short answer. :D
This is brilliant indeed, I didn't know this Trick...! Thanks 'ThankYou' for bumping it, and thanks to 'xNeroX' as well of course for sharing the Trick...
(Tested on iMacros v8.8.2 for FF, Pale Moon v24.7.1 (=FF31), Win7-64.)

Another way that I use to have a Macro to loop itself is to have the Macro to call itself at the end of the Macro with 'URL GOTO', but you then enter an infinite Loop (that you have to stop at some point manually)... And another annoying drawback is that if you have the Macro running/looping in one FF Instance and you are doing something else in another FF Instance, the Macro will run at the next Loop in the exact Tab that has the Focus in the 2nd FF Instance...:

Code: Select all

URL GOTO=imacros://run/?m="Macro to loop.iim"
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: LOOP - be careful

Post by skippyto » Mon Sep 01, 2014 8:56 am

Hi,

Be careful with that kind of fast solution, this trick is useful only if you want your loop to be stopped if an error occurs while runnig your macros.
SET ERRORIGNORE YES is a way to continue on error but you won't know at the end if it happened or not...

As mentionned earlier in the thread, the best way to loop is to use a "for" or a "while" loop in a js.
You'll save a lot time on errror investigation as you can save macros return code (which is a good information) or/and play a second macro to take a screenshot when an error happen and/or replay the last loop if the error is a timeout or a loading page error...

Skippyto.
Cdangerdouglas
Posts: 1
Joined: Mon May 22, 2017 8:39 pm

Re: LOOP

Post by Cdangerdouglas » Mon May 22, 2017 8:47 pm

Hi @ABooth, would your code work if I wanted to loop a macro 200 times and then loop a separate macro100 ines?
Would I just replace the "i" variable with a new letter and reference a different .iim file? I am not too familiar with js. Any help is appreciated.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: LOOP

Post by chivracq » Tue May 23, 2017 1:13 am

Cdangerdouglas wrote:Hi @ABooth, would your code work if I wanted to loop a macro 200 times and then loop a separate macro100 ines?
Would I just replace the "i" variable with a new letter and reference a different .iim file? I am not too familiar with js. Any help is appreciated.
CIM...! :mrgreen:
Always mention your FCI when you open a Thread or post for the first time in some existing Thread, many Commands are not implemented in all Browsers/Versions... Especially 8 years later, ah-ah...!: Original Thread is from 2009, we are now in 2017...!

+ I see 3 Posts in this Thread from @ABooth on Page_1, all from 2009, quote which one or which Script you refer to, I would be (positively!) surprised if @ABooth replied directly...

Your Qt is a bit vague, be more precise... :idea:
=> Not sure what "a separate macro100 ines" means...? :?
=> Maybe interesting Threads for you if you search the Forum on "Nested Loops", but again, your Qt is not clear..., so I'm not sure if it's relevant for you...

[And to whomever created this Thread, you are "lucky" I was not around at that time, the Thread Title is a bit useless, "LOOP", ah-ah...! Try searching the Forum with "loop" as a Search Keyword...! But on the other hand, I think I saw some very interesting Posts in this Thread which probably never get found because of the useless Thread Title, @TechSup, maybe an idea to give this Thread a bit more Descriptive Thread Title...?]
But I'll read the Content of the Thread if previous Poster follows up a bit correctly...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: LOOP - be careful

Post by chivracq » Tue May 23, 2017 1:35 am

skippyto wrote:Hi,

Be careful with that kind of fast solution, this trick is useful only if you want your loop to be stopped if an error occurs while runnig your macros.
SET ERRORIGNORE YES is a way to continue on error but you won't know at the end if it happened or not...

As mentionned earlier in the thread, the best way to loop is to use a "for" or a "while" loop in a js.
You'll save a lot time on errror investigation as you can save macros return code (which is a good information) or/and play a second macro to take a screenshot when an error happen and/or replay the last loop if the error is a timeout or a loading page error...

Skippyto.
Hum sorry @skippyto, I never saw your Reply, I guess it was meant at me... (from my previous Reply)

Hum, I see the cleverness in "...and/or replay the last loop if the error is a timeout or a loading page error...", but hum, 3 years later, so I've come a little bit further with my "Techniques", ah-ah...!, I am able to that in pure '.iim', (and I check much more than only "timeout or a loading page error"), and still using this Trick (Negative Loop), many of my Macros decide dynamically by themselves how many times they need to run (I simply hit 'Play' and they know if they only need to run once or several times...) and from several Checkpoints in the middle if some extra Run(s) need(s) to run for the full Macro or only part(s) of it... And all that in pure '.iim'..., oops...! :oops:

But hum, I often have a very bad Internet Connection (surfing on some nice Neighbour's), only between 02h-06h at night I can trust that a Macro will run a bit correctly, so all my Macros are very "Error-resistant", in order to "guarantee" some "Reliability", ah-ah...!
Hum, and even then they are able to decide by themselves if they go for Reliability or for Speed, depending on "my" Connection and "other" Parameters... (+ heavy Logging and Reporting, for me to check if I need to modify some Threshold..., but they can even modify those Thresholds by themselves...)
But hum, that reminds me to have a look at some Macros of mine that run completely automatically and that I never (need to) check, I had noticed some mini-"Glitch" when the Summer/Winter Time/DST Change was taking place, ah-ah...! Even if I think the Pb/"Bug" was OS related (Task Scheduler on Win10-x64), (and solved only after a Reboot), but I could still "foresee" it and implement some Workaround from within the Macro(s) it/themself/ves to keep working correctly without the need for a quick Reboot asap after a DST Change...

Oh yeah...!, and that's one of the "main" Reasons as well why I "like" and use 'Negative Loop' a lot, as it offers a way to loop an '.iim' Macro (without the need for a '.js' Script) when launched from a '.BAT' File and/or from the OS Task Scheduler, ah-ah...! 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply