Pause/Continue? - Time of Day? - Random?

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
Post Reply
brianjuk
Posts: 4
Joined: Wed Apr 22, 2015 2:18 pm

Pause/Continue? - Time of Day? - Random?

Post by brianjuk » Wed Apr 22, 2015 2:28 pm

Greets Peeps!

My name is Brian and I live in the south west of the UK.

I'm a happy/new iMacros user - Firefox plugin - and I am extremely impressed with its functionality - and price...FREE! YAY!

I have a particular problem that I hope someone can give me some advise on please.

I have written a macro that takes information from a .csv file and loops - [Play (Loop)] - 100 times.

The .csv file has 100 lines in three columns, and I would like my script to run 30 times and then 'Pause' for an allotted [Random?] time and then 'Continue'.

Here is a sample piece of code that I am using:

Code: Select all

VERSION BUILD=8920312 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*148.27 + 130.27); randomNumber;")
SET !VAR2 EVAL("var randomNumber=Math.floor(Math.random()*8.27 + 5.27); randomNumber;")
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE aaa.csv
SET !DATASOURCE_COLUMNS 3
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=https://myhostingprovider.uk/index.cgi
WAIT SECONDS={{!VAR2}}
TAG POS=1 TYPE=A ATTR=HREF:/install.cgi?install=ascript&&TITLE:A<SP>SCRIPT
WAIT SECONDS={{!VAR2}}

VARIOUS OTHER LINES OF CODE

WAIT SECONDS={{!VAR2}}
URL GOTO=https://www.google.co.uk
WAIT SECONDS={{!VAR1}}

I have had a good look through this forums search engine and on the web, but honestly can't find a solution to my problem. I suspect that the answer lies with the use of Visual Basic, but .vb etc is not my forte and I don't have 10 years - or even 6 months - of spare time to educate myself enough to solve this problem for my self.

If someone would be kind enough to help me out with this particular problem, I feel sure that it would not only assist me, but other people wishing to do the same thing.

Many thanks in advance.... :D
ZmanZoo
Posts: 21
Joined: Mon Feb 16, 2015 8:24 pm

Re: Pause/Continue? - Time of Day? - Random?

Post by ZmanZoo » Wed Apr 22, 2015 6:20 pm

heylo,

I don't have a solution, but you will have to go with a programming code to achieve what you want. JavaScript is probably the way you want to go.
http://www.w3schools.com/js/default.asp I'd bookmark that, then take a look at

http://www.w3schools.com/js/js_if_else.asp
http://www.w3schools.com/js/js_switch.asp
http://www.w3schools.com/js/js_loop_while.asp

do/while is what you want you'd just have to make something like below (you'd have to read up on javascript I'm clueless)

Code: Select all

do {
     imacros code to execute;
     i++;
 }
while (i < 30);
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Pause/Continue? - Time of Day? - Random?

Post by chivracq » Wed Apr 22, 2015 6:52 pm

brianjuk wrote:Greets Peeps!

My name is Brian and I live in the south west of the UK.

I'm a happy/new iMacros user - Firefox plugin - and I am extremely impressed with its functionality - and price...FREE! YAY!

I have a particular problem that I hope someone can give me some advise on please.

I have written a macro that takes information from a .csv file and loops - [Play (Loop)] - 100 times.

The .csv file has 100 lines in three columns, and I would like my script to run 30 times and then 'Pause' for an allotted [Random?] time and then 'Continue'.

Here is a sample piece of code that I am using:

Code: Select all

VERSION BUILD=8920312 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*148.27 + 130.27); randomNumber;")
SET !VAR2 EVAL("var randomNumber=Math.floor(Math.random()*8.27 + 5.27); randomNumber;")
SET !DATASOURCE_DELIMITER ;
SET !DATASOURCE aaa.csv
SET !DATASOURCE_COLUMNS 3
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=https://myhostingprovider.uk/index.cgi
WAIT SECONDS={{!VAR2}}
TAG POS=1 TYPE=A ATTR=HREF:/install.cgi?install=ascript&&TITLE:A<SP>SCRIPT
WAIT SECONDS={{!VAR2}}

VARIOUS OTHER LINES OF CODE

WAIT SECONDS={{!VAR2}}
URL GOTO=https://www.google.co.uk
WAIT SECONDS={{!VAR1}}
I have had a good look through this forums search engine and on the web, but honestly can't find a solution to my problem. I suspect that the answer lies with the use of Visual Basic, but .vb etc is not my forte and I don't have 10 years - or even 6 months - of spare time to educate myself enough to solve this problem for my self.

If someone would be kind enough to help me out with this particular problem, I feel sure that it would not only assist me, but other people wishing to do the same thing.

Many thanks in advance.... :D
FCIM...! :mrgreen: => iMacros for FF v8.9.2, FF37...?, OS...?
ZmanZoo wrote:heylo,

I don't have a solution, but you will have to go with a programming code to achieve what you want. JavaScript is probably the way you want to go.
http://www.w3schools.com/js/default.asp I'd bookmark that, then take a look at

http://www.w3schools.com/js/js_if_else.asp
http://www.w3schools.com/js/js_switch.asp
http://www.w3schools.com/js/js_loop_while.asp

do/while is what you want you'd just have to make something like below (you'd have to read up on javascript I'm clueless)

Code: Select all

do {
     imacros code to execute;
     i++;
 }
while (i < 30);
=> Yep, you can do it in JavaScript of course, but it's fairly easy to achieve in pure .iim, search my Posts on "Conditional WAIT" and/or "Nested Loops" as I've already answered this (or similar) Question(s) several times, and in your case, your Condition will be based simply on '{{!LOOP}}'...
- (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...
brianjuk
Posts: 4
Joined: Wed Apr 22, 2015 2:18 pm

Re: Pause/Continue? - Time of Day? - Random?

Post by brianjuk » Thu Apr 23, 2015 12:04 pm

Many thanks for your help Peeps - much appreciated! :D

iMacros for FF v8.9.2, FF37.0.2, Win7 Ultimate 32 bit :mrgreen:

Is there any way to base the execution of actions in the .iim on either 'computer time' or 'server time' like in .htaccess?

Code: Select all

RewriteEngine On
ServerSignature Off
RewriteBase /
Options +FollowSymlinks
RewriteCond %{TIME_HOUR}%{TIME_MIN} >0000
RewriteCond %{TIME_HOUR}%{TIME_MIN} <0159
RewriteRule ^index\.php$ /Welcome.html
Also, for any developers/admins, the following 'Pseudocode' would be very useful if a web page only part loaded and caused the {{!LOOP}} to throw an error because the HTML of the page had not fully loaded into the browser.

Code: Select all

SET !ERRORIGNORE YES
SET !ERRORIGNORE REFRESH
Anyway, enough of my pratling and back to the drawing board...

Thanks again..! :)
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Pause/Continue? - Time of Day? - Random?

Post by chivracq » Thu Apr 23, 2015 2:37 pm

Server Time, I don't know and don't think so (unless you can get it via some JavaScript Command (I don't know this '.htaccess' and how you use it...)) but Computer Time is easily accessed via the iMacros '{{!NOW}}' Built-in Variable.
- (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...
brianjuk
Posts: 4
Joined: Wed Apr 22, 2015 2:18 pm

Re: Pause/Continue? - Time of Day? - Random?

Post by brianjuk » Fri Apr 24, 2015 7:13 am

chivracq wrote:Server Time, I don't know and don't think so (unless you can get it via some JavaScript Command (I don't know this '.htaccess' and how you use it...)) but Computer Time is easily accessed via the iMacros '{{!NOW}}' Built-in Variable.
TYVM!chivracq! I shall have a look at the {{!NOW}} variable in the Wiki. :?:

If I work out a solution, I will of course, post and share my findings... :mrgreen:
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Pause/Continue? - Time of Day? - Random?

Post by chivracq » Fri Apr 24, 2015 11:43 am

brianjuk wrote:
chivracq wrote:Server Time, I don't know and don't think so (unless you can get it via some JavaScript Command (I don't know this '.htaccess' and how you use it...)) but Computer Time is easily accessed via the iMacros '{{!NOW}}' Built-in Variable.
TYVM!chivracq! I shall have a look at the {{!NOW}} variable in the Wiki. :?:

If I work out a solution, I will of course, post and share my findings... :mrgreen:
OK, but post as well if you get stuck and where exactly you get stuck and how far you've come but it's not complicated...
And if you searched my Posts on "Conditional WAIT", you have your Answer in those 2 Threads, with some minor Adaptation...:
- Re: Replay if error ?
- Re: Any way to "WAIT UNTIL IP CHANGE" OR seomthing?

And if you want to understand a little bit more in depth how it all works, you can read this complete Thread:
- Decision Making using iMacros/Possible Workarounds
.
- (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