0

I have 20 iMacros (for browser) and they are specific to different URLs. I run these macros one after another, and then repeat or loop all of them 10 times.

But within that loop, i need those 20 macros to run in a random fashion and not as in list.

What I tried:

I loop one Macro named COLLECTION.iim 10 times using .js file

var i;
for (i = 1; i <= 10; i++)
{
iimSet("loop", i);
iimPlay("COLLECTION.iim");
}

COLLECTION.iim contains the following randomise code for 20 imacros

CMDLINE !DATASOURCE C:\LIST.txt
SET !VAR1 EVAL("var randomNumber = Math.floor(Math.random() * 20) + 1; randomNumber;")
SET !DATASOURCE_LINE {{!VAR1}}
URL GOTO=imacros://run/?m={{!COL1}}

LIST.txt contains those 20 macro names written one per each line like

1.iim
2.iim 
.
.
20.iim

But this is not working. If there is any other better or easier way, let me know too.

  • I am not that familiar with javascript,but perhaps u can show all code perhaps in www.pastebin.com if it's long.Or from the command line. eg I can enter the code u've given, and show the error I get. i.imgur.com/oaFDg9z.png Can you give the exact contents of each file. Not summarized but exact,and the error you get, so that anybody trying to run it can reproduce the exact same error? I've shown the contents of every file by doing e.g. type COLLECTION.iim etc but perhaps you can show the contents. perhaps pasting each file to pastebin.com so anybody(even a newb) can reproduce the error – barlop Jul 24 '14 at 17:13
  • i sorry if i didnt explain well but actually this is related to iMacros (search this word) its actually a automation language. I thought u might be knowing about it. It also has a javascript feature and thats how we can run javascript in it. This is not batch related question. Sorry for that. The error i am getting is from imacros engine .imacros has list of error codes too but the error which comes in this case is generic unknonwn I hope someone looks & helps with this question :( (if u know anyone who knows imacros..kindly give them a holler abt it). Thanks very much again for all your help – SuperUserMan Jul 24 '14 at 18:03
  • I know it's not batch..I just meant that if I can see the exact files and run it reproducing the same error that you do then there's a chance I might figure it out or have some ideas, anyhow I have to go out now but I'd note that normally u'd want stackoverflow.com for a programming question.I don't know whether your question is jscript or javascript.but you'd want to tag it accordingly.I did look up imacros b4, and it showed it used in the context of a webpage, though you didn't indicate that so maybe yours isn't in that context.Either way,Stackoverflow is better and meant for programming qs. – barlop Jul 24 '14 at 18:07
  • hey @barlop , can you have a look at this as script is your thing :) superuser.com/questions/798906/… – SuperUserMan Aug 16 '14 at 21:09
  • @macroscripts can you please help with this? – SuperUserMan Mar 18 '16 at 21:06
-1

He's trying to do the same thing I am.

Combine Loop: https://stackoverflow.com/questions/17959454/how-to-loop-only-a-series-of-steps-in-imacros

with Random: https://stackoverflow.com/questions/31773368/imacros-random-choose

Your issue might be similar (or same as): https://stackoverflow.com/questions/19519024/imacros-randomly-stops-in-a-loop

  • While SO's a sister site, links can still go away. Could you perhaps show how this fits together and what you're doing is? – Journeyman Geek Dec 10 '15 at 5:41
  • 2
    Is this even meant as an attempt to answer the question, or are you just pointing out similar questions and expressing an interest in seeing a solution? – G-Man Says 'Reinstate Monica' Dec 10 '15 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.