How to Loop Datasource_Line on every new TAB?

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
pumpymonkeybaby
Posts: 4
Joined: Sun Dec 16, 2018 8:37 pm

How to Loop Datasource_Line on every new TAB?

Post by pumpymonkeybaby » Sun Dec 16, 2018 8:46 pm

I put this together after following another post. It's working for one loop, but he issue is I need it to run through and start again at the proper row. I want it to start and go through Rows 2-6 and then when looped starting at 6 on to the next 5 and so on. Each row being a new tab, but only opening 5 at a time per loop. As is, it starts all over again at row 2. Any ideas what I'm doing wrong?

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB CLOSEALLOTHERS
SET !REPLAYSPEED SLOW
SET !DATASOURCE file.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET MyLoop {{!LOOP}}


SET !ERRORIGNORE YES

TAB T=1
ADD MyLoop 0
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=2
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=3
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=4
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=5
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to Loop Datasource_Line on every new TAB?

Post by chivracq » Sun Dec 16, 2018 10:17 pm

pumpymonkeybaby wrote:
Sun Dec 16, 2018 8:46 pm
I put this together after following another post. It's working for one loop, but he issue is I need it to run through and start again at the proper row. I want it to start and go through Rows 2-6 and then when looped starting at 6 on to the next 5 and so on. Each row being a new tab, but only opening 5 at a time per loop. As is, it starts all over again at row 2. Any ideas what I'm doing wrong?

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB CLOSEALLOTHERS
SET !REPLAYSPEED SLOW
SET !DATASOURCE file.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET MyLoop {{!LOOP}}

SET !ERRORIGNORE YES

TAB T=1
ADD MyLoop 0
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=2
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=3
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=4
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}

TAB OPEN NEW
TAB T=5
ADD MyLoop 1
SET !DATASOURCE_LINE {{MyLoop}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form-main-1 ATTR=ID:data-print-keywords-0 CONTENT={{!COL1}}
Your Post has nothing really specific to the 'iMacros for FF' Sub-Forum, I would think, especially if you don't mention your FCI, you could/should have opened your Thread in the 'General' Sub-Forum... (But no need to duplicate now...)
=> FCIM...! :mrgreen: (Read my Sig...)

Yep, your FCI is a bit unclear, I see some v8.9.7 for FF in your Script, but the 'TAB OPEN NEW' Syntax you are using has been deprecated for 8 or 10 years..., and strangely enough "put back in service" with v10.x for FF+CR and v12.x for iMB+IE, even if it indeed "backward-compatibly" still works/worked in v8.9.7, I think I had tested it a few months ago in that Version...

But OK, anyway, yep if I understand your Scenario correctly, you need to use some Var for every 'TAB T=n' like you use with your "MyLoop" for '!DATASOURCE_LINE', either the exact same Var, or using 'EVAL()' that you will compute Modulo[5] based on '!LOOP' or on your 'MyLoop'.

Your Script looks pretty strange anyway as 'TAB OPEN' + 'TAB T=n' will each time open a New Tab and switch to it but that Tab will be empty and any 'TAG' Statement won't do anything on those empty Tabs... :?
- (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...
pumpymonkeybaby
Posts: 4
Joined: Sun Dec 16, 2018 8:37 pm

Re: How to Loop Datasource_Line on every new TAB?

Post by pumpymonkeybaby » Sun Dec 16, 2018 10:30 pm

Apologizes. I didn’t include the complete code for each tab, just the meat of what I’m trying to input with 5 tabs open at a time. Close and then repeat. I just can’t get get it to repeat the loop correctly after the additional tab variables. It goes back to thinking it’s on the following row from the start. I’m sorry if this doesn’t make sense. Coding is not my first language ;)
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to Loop Datasource_Line on every new TAB?

Post by chivracq » Sun Dec 16, 2018 10:36 pm

pumpymonkeybaby wrote:
Sun Dec 16, 2018 10:30 pm
Apologizes. I didn’t include the complete code for each tab, just the meat of what I’m trying to input with 5 tabs open at a time. Close and then repeat. I just can’t get get it to repeat the loop correctly after the additional tab variables. It goes back to thinking it’s on the following row from the start. I’m sorry if this doesn’t make sense. Coding is not my first language ;)
Ah OK, makes a bit sense..., but hum, you missed the "FCIM" part, => if you can mention/clarify your FCI...? (for me to follow up...), I normally don't react to Threads when that Required Info is not mentioned...
- (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...
pumpymonkeybaby
Posts: 4
Joined: Sun Dec 16, 2018 8:37 pm

Re: How to Loop Datasource_Line on every new TAB?

Post by pumpymonkeybaby » Sun Dec 16, 2018 10:47 pm

8.9.7 for FF 49.0.1 on Win 10 x64 Creators Edition
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to Loop Datasource_Line on every new TAB?

Post by chivracq » Mon Dec 17, 2018 1:19 am

pumpymonkeybaby wrote:
Sun Dec 16, 2018 10:47 pm

Code: Select all

8.9.7 for FF 49.0.1 on Win 10 x64 Creators Edition
Ah OK, v8.9.7 for FF then indeed..., good...! (Best Version to use, still works until FF56, recommended = FF v55.0.3, but FF49 is OK also...)

OK, then, hum..., I see 2 "easy" ways to implement what you want, either you'll play your Script each time once, or you are going to loop it...

If you play it once (using the 'Play' Button), you either each time need to manually edit the 'SET !LOOP 2' => 'SET !LOOP 7' => 'SET !LOOP 12' => etc before each Run, which I guess won't be very "handy", or you could use your OS Clipboard (and the iMacros Built-in Var '!CLIPBOARD') to keep track of which Row to use at the beginning of your Script for the 'SET !LOOP n'.

Or if you are going to loop your Script (using the 'Play (Loop)' Button), then it's some "simple" Maths Equation:
Loop=1 => Rows[2-6]
Loop=2 => Rows[7-11]
Loop=3 => Rows[12-16]
... etc...

Your 'SET !LOOP 2' to skip the Header in your DataSource is not even needed, it actually makes "Things" more "complicated"...

And that will give stg like:
Loop=1 => 1-1=0 => 0x5=0 => 0+2=2 for Row=2 (and +1 (x4 times) for Rows[3-6].)
Loop=2 => 2-1=1 => 1x5=5 => 5+2=7 for Row=7 (and +1 (x4 times) for Rows[8-11].)
Loop=3 => 3-1=2 => 2x5=10 => 10+2=12 for Row=12 (and +1 (x4 times) for Rows[13-16].)
... etc... And I guess you get the "Principle"...! :wink:

Oh...!, and of course, you put some 'PAUSE' at the end of your Script for it to stop after opening/handling the 5 Tabs..., before starting a new Loop...

You could add a 'TAB T=1' at the end or at the beginning of your Script to make sure to go back to TAB_1, but it is not even really necessary as you use 'TAB CLOSEALLOTHERS', so all other Tabs will get closed anyway and "that" Tab will automatically become TAB_1...
- (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...
pumpymonkeybaby
Posts: 4
Joined: Sun Dec 16, 2018 8:37 pm

Re: How to Loop Datasource_Line on every new TAB?

Post by pumpymonkeybaby » Mon Dec 17, 2018 1:32 am

Forgive me, stg?

So if I replace the SET line with

Loop=1 => Rows[2-6]
Loop=2 => Rows[7-11]
Loop=3 => Rows[12-16]
Etc.

that would alllow it to loop properly?

Thank you so very much!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to Loop Datasource_Line on every new TAB?

Post by chivracq » Mon Dec 17, 2018 2:09 am

pumpymonkeybaby wrote:
Mon Dec 17, 2018 1:32 am
Forgive me, stg?

So if I replace the SET line with

Loop=1 => Rows[2-6]
Loop=2 => Rows[7-11]
Loop=3 => Rows[12-16]
Etc.

that would alllow it to loop properly?

Thank you so very much!
"stg" = "something"... ("sbd" = "somebody"...)

"that would alllow it to loop properly?"
=> Well, using the Equation for example I developed in my next Section...:
'!LOOP' [-1] [x5] [+2] ([+1]x4) (in 'EVAL()').
(Or '!LOOP' [x5] [-3] would also give the same Result..., but I remember "thinking" (a long time ago) that using [+] was a "better Practice" within Nested Loops rather than [-]...)
- (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...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to Loop Datasource_Line on every new TAB?

Post by chivracq » Fri Dec 21, 2018 1:58 am

Hum..., and...?, 3 days later, any Follow-up...!? :shock:

Did you understand my Explanations and did you manage to implement them in your Script...?
=> Post your Final Script... :idea:

(If you don't follow up (anymore) and don't post/share your Final Script (to finish the Thread a bit useful for other Users as well), I probably won't try to help you again, next time you open a Thread..., just saying... :idea: )
- (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