trying to make a loop with counter

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
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
eletronauta
Posts: 1
Joined: Mon Jan 03, 2022 4:20 pm

trying to make a loop with counter

Post by eletronauta » Mon Jan 03, 2022 4:31 pm

Hi guys, i am begginer with i macros and i am having an issue.
Using google chrome for macbook.

This is the code that i need, but it is not working.

VERSION BUILD=1011 RECORDER=CR
SET !ERRORIGNORE YES

SET !VAR1 60BL...0WP
SET !VAR2 NSUk...5I7
SET !VAR3 DTPh...NM3
SET !VAR4 aK4h...gzE
SET !VAR5 bLu6...hF2

FOR (i=1; i<=5; i++)
{
URL GOTO=https://www.uol.com
TAG POS=3 TYPE=DIV ATTR=TXT:Id:<SP>{{!VARi}}
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 1
TAG POS=2 TYPE=DIV ATTR=TXT:START<SP>RACE!
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 17
TAG POS=2 TYPE=DIV ATTR=TXT:Check<SP>Result
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 10

}


I aprreciate if anyone could help me.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: trying to make a loop with counter

Post by chivracq » Mon Jan 03, 2022 5:25 pm

eletronauta wrote:
Mon Jan 03, 2022 4:31 pm
Hi guys, i am begginer with i macros and i am having an issue.
Using

Code: Select all

google chrome for macbook.
This is the code that i need, but it is not working.

Code: Select all

VERSION BUILD=1011 RECORDER=CR
SET !ERRORIGNORE YES 

SET !VAR1 60BL...0WP
SET !VAR2 NSUk...5I7
SET !VAR3 DTPh...NM3
SET !VAR4 aK4h...gzE
SET !VAR5 bLu6...hF2

FOR (i=1; i<=5; i++)
{
URL GOTO=https://www.uol.com
TAG POS=3 TYPE=DIV ATTR=TXT:Id:<SP>{{!VARi}}
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 1
TAG POS=2 TYPE=DIV ATTR=TXT:START<SP>RACE!
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 17
TAG POS=2 TYPE=DIV ATTR=TXT:Check<SP>Result
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 10

}


I aprreciate if anyone could help me.

Hum, try to select the "correct" Sub-Forum when you open a Thread, this one has nothing really specific to the 'iMacros for CR' Sub-Forum, I'll move it to the 'General' one... :!:

+ FCIM...! :mrgreen: (Read my Sig..., and the Forum Rules that you didn't read... :idea: )
=> "Using google chrome for macbook." is not "enough"...
=> iMacros for CR v10.1.1, 'Free'/'PE'/'Trial'...?, CR97...?, OS=macOS...?
"macbook" is "Hardware", not an OS, => OS = macOS...?, v...?
If OS=macOS => iMacros = v10.1.1 'Free'. ('Linux' and 'macOS' are not supported for the 'PE' (+ 'Trial') Version(s)...)

The `FOR` Command you are trying to use is not an '.iim' Command, it looks like the 'JavaScript' `for` Method, but this is not supported "natively" in pure '.iim' Scripts... (except inside the `EVAL()` or `URL GOTO=javascript` Commands/Syntax), or if you were using iMacros v8.x/v9.x for FF which supports the JS Scripting Interface), => Simply use the Built-in Loop Mechanism from the iMacros GUI/Side-Panel (and loop your Script x5 times)... :idea:

(+ The 'Free' v10.x for CR Version that you are "probably" using only supports 3 Vars, => `!VAR[1-3]`, `!VAR[4-5]` are not supported... :!: )
- (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...
techimac
Posts: 482
Joined: Fri Feb 20, 2015 9:27 pm

Re: trying to make a loop with counter

Post by techimac » Mon Jan 10, 2022 1:55 pm

Run code in loop of 5

Code: Select all

SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 30
SET !TIMEOUT_STEP 5

SET !VAR1 EVAL("var array = ['60BL...0WP','NSUk...5I7','DTPh...NM3','aK4h...gzE','bLu6...hF2'];array[{{!LOOP}} - 1];")

URL GOTO=https://www.uol.com
TAG POS=3 TYPE=DIV ATTR=TXT:Id:<SP>{{!VAR1}}
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 1
TAG POS=2 TYPE=DIV ATTR=TXT:START<SP>RACE!
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 17
TAG POS=2 TYPE=DIV ATTR=TXT:Check<SP>Result
TAG POS=1 TYPE=DIV ATTR=ID:imacros-highlight-div
WAIT SECONDS = 10
Available for custom iim, javascript iMacros scripts
Post Reply