mercredi 2 août 2017

iMacros: Pauze after x amount of loops (Javascript)

What I've read so far is that pausing in between loops is only possible in javascript. I have a hard time getting my code to work in Javascript.

What i want my code to execute: Go to a website and click a button. Loop trough the sites different sub domains via my datasource text file. I want to run 90 loops (going trough 90 sub domains) pause for 1 hour, continue the loop for another 90 and pause again for 1 hour etc etc.. (my datasource text file consists of 1000+ sub domains).

This i my code:

SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*10 + 2); randomNumber;") /*after a button is pushed wait for a random number of seconds*/ 
SET !TIMEOUT_PAGE 120
SET !ERRORIGNORE YES
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE data_list.txt
SET !DATASOURCE_COLUMNS 1
URL GOTO=http://ift.tt/2vo8IPT}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Button
WAIT SECONDS=

This works fine i can put an x amount of loops and the code Will run just fine. But i can't / don't know how to pause after 90 loops in javascript.

This is how far i got in converting my code to javascript:

var macro;
var rand = "Math.floor(Math.random()*10 + 2)"; /*after a button is pushed wait for a random number of seconds*/ 
macro =  "CODE:";
macro +=  "SET !TIMEOUT_PAGE 120" + "\n"; 
macro +=  "SET !TIMEOUT_TAG 0" + "\n"; 
macro +=  "SET !ERRORIGNORE YES" + "\n"; 
macro +=  "SET !DATASOURCE ACCOUNTS_NO.txt" + "\n"; 
macro +=  "SET !DATASOURCE_COLUMNS 1" + "\n"; 
macro +=  "SET !DATASOURCE_LINE " + "\n"; 
macro +=  "URL GOTO=http://ift.tt/2tYZoi9}}" + "\n"; 
macro +=  "TAG POS=1 TYPE=BUTTON ATTR=TXT:Button" + "\n"; 
macro +=  "WAIT SECONDS = " + "\n"; /***this does not seem to work in javascript*/**
iimPlay(macro)

The random number in javascript does not work. Also the code to loop for 90 times, pause for 1 hour and continue still needs to be added.

Can anybody please help out?




Aucun commentaire:

Enregistrer un commentaire