Imacros loop through http links

dgupster

Newbie
Joined
Feb 13, 2013
Messages
2
Reaction score
0
I am writing a script to loop through a bunch of keep links on a game. I have a csv file with all of the http links

I would like to goto a random link in the csv file each time instead of one after the other.

the script will log into one character, do a bunch of tasks including going to one of the links in the csv file
then log out and into the next character,

after logging into all of the characters it loops back to the start

below is the code i have. It is work in that it will go to each new link in order.

Can i put the "datasource_line {{loop}}" line in the goto url line?

Can i use a random number generator to set !var1 to the random number, then use the !var1 in the url goto line?

Can i use the !var in the {{!col1}} eg. url goto ={{!col{!var1}}}

SET !ERRORCONTINUE YES


CMDLINE !DATASOURCE C:\Users\guppy_000\Documents\invades.txt
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !DATASOURCE_COLUMNS 4
TAB T=1


wait seconds=5


wait seconds=5
URL GOTO={{!COL1}}
'do some stuff
URL GOTO={{!COL2}}
'do some stuff
URL GOTO={{!COL3}}
'do some stuff
URL GOTO={{!COL4}}
'do some stuff

Thanks in advance
 
Last edited:
Yes you can use a random number generator and set a var to that number. I use EVAL and here is some code to get you started

' SELECT RANDOM NUMBER BETWEEN 1-100
SET !VAR1 EVAL("var randomNumber = Math.floor(Math.random() * 100) + 1; randomNumber;")
SET !DATASOURCE_LINE {{!VAR1}}
 
Back
Top