EVENT Mode Use Loop

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
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

EVENT Mode Use Loop

Post by Tamilselvan » Tue Oct 13, 2020 1:22 am

Firefox 52.9.0 (32-bit)
iMacros 9.0.3
Win-7 (32-bit)

Hi,
I want to open record and extract voucher number save it to CSV file in EVENT mode by using loop.
I have tried my knowledge. I can get only one record.
Where can i use loop in Event mode. If any changes, please guide me.
m_FTO Open.jpg

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(2)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:2906015-ML* EXTRACT=TXT
SET Vr_No {{!EXTRACT}}

SET !EXTRACT {{Vr_No}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Vr_No.csv

TAB CLOSE 
TAB T=2
m_FTO Vr.jpg
I guess TR:nth-of-type(2)... (6) is changing when I Recorded One by one in Event Mode.. How to change it as single Statement by using loop..

Code: Select all

EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(2)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(3)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(4)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(5)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(6)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"

Thanks & Regards,
S. Tamilselvan.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVENT Mode Use Loop

Post by chivracq » Wed Nov 11, 2020 6:56 pm

Tamilselvan wrote:
Tue Oct 13, 2020 1:22 am

Code: Select all

Firefox 52.9.0 (32-bit)
iMacros 9.0.3
Win-7 (32-bit)
Hi,
I want to open record and extract voucher number save it to CSV file in EVENT mode by using loop.
I have tried my knowledge. I can get only one record.
Where can i use loop in Event mode. If any changes, please guide me.
m_FTO Open.jpg

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(2)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:2906015-ML* EXTRACT=TXT
SET Vr_No {{!EXTRACT}}

SET !EXTRACT {{Vr_No}}
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Vr_No.csv

TAB CLOSE 
TAB T=2
m_FTO Vr.jpg

I guess TR:nth-of-type(2)... (6) is changing when I Recorded One by one in Event Mode.. How to change it as single Statement by using loop..

Code: Select all

EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(2)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(3)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(4)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(5)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
'EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type(6)>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"

Thanks & Regards,
S. Tamilselvan.

OK, "quick Look" at this one, now that it has been moved to the "correct" Sub-Forum... 8)

Hum, looks like your FCI is not "correct" anymore, "1 month later", as you were using v8.9.7 for FF on Win10 in the Thread you opened last week...
But OK, no "big deal"...

Then yep, pretty simple, use a Var for the "changing part", either the raw '!LOOP' or some Var based on '!LOOP', like for example:

Code: Select all

SET !LOOP 2
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type({{!LOOP}})>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"
(And you loop it 6 times...)

Your 'TR' Elements range from [2,6] and start at "2", so you don't have to worry about "1", but "nth-of-type(1)" is also a valid Syntax if you ever needed it, even if iMacros doesn't record the "nth-of-type()" part for the 1st Instance of a (repeated) Element... 8)
- (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...
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Re: EVENT Mode Use Loop

Post by Tamilselvan » Fri Nov 13, 2020 12:37 am

Thanks a lot to Forum Admin
Now FCI
Firefox 52.9.0 (32-bit)
iMacros 8.9.7
Win-10 (64-bit)

Its worked me. :D Thank you very much .

Here its code :

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
'URL GOTO=http://mnregaweb4.nic.in/netnrega/FTO/fto_sign_detail.aspx?lflag=local&flg=M&page=b&state_name=TAMIL+NADU&state_code=29&district_name=TIRUVANNAMALAI&district_code=2906&block_name=Thellar&block_code=2906015&fin_year=2020-2021&typ=sec_sig_not&mode=b&source=&Digest=CHtClBE4ZVq9RShLvPu1yg
SET !LOOP 2
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type({{!LOOP}})>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:2906015-ML* EXTRACT=TXT
SET Vr_No {{!EXTRACT}}

SAVEAS TYPE=EXTRACT FOLDER=* FILE=Vr_No.csv

TAB CLOSE 
'TAB T=2
I need one more help if its possible to do that. In TAB=1 extract the text which i have been clicking link one by one; in TAB=2 extracted vr no. both extracted text should be saved in Vr_No.csv file separate column and remove the extracted text which is contains double quotes and more spaces between text.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: EVENT Mode Use Loop

Post by chivracq » Fri Nov 13, 2020 1:05 am

Tamilselvan wrote:
Fri Nov 13, 2020 12:37 am
Thanks a lot to Forum Admin
Now FCI

Code: Select all

Firefox 52.9.0 (32-bit)
iMacros 8.9.7
Win-10 (64-bit)
Its worked me. :D Thank you very much .

Here its code :

Code: Select all

VERSION BUILD=8970419 RECORDER=FX
TAB T=1
'URL GOTO=http://mnregaweb4.nic.in/netnrega/FTO/fto_sign_detail.aspx?lflag=local&flg=M&page=b&state_name=TAMIL+NADU&state_code=29&district_name=TIRUVANNAMALAI&district_code=2906&block_name=Thellar&block_code=2906015&fin_year=2020-2021&typ=sec_sig_not&mode=b&source=&Digest=CHtClBE4ZVq9RShLvPu1yg
SET !LOOP 2
EVENT TYPE=CLICK SELECTOR="HTML>BODY>FORM>DIV:nth-of-type(3)>TABLE:nth-of-type(4)>TBODY>TR:nth-of-type({{!LOOP}})>TD:nth-of-type(2)>A" BUTTON=0 MODIFIERS="ctrl"

TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=TD ATTR=TXT:2906015-ML* EXTRACT=TXT
SET Vr_No {{!EXTRACT}}

SAVEAS TYPE=EXTRACT FOLDER=* FILE=Vr_No.csv

TAB CLOSE 
'TAB T=2
I need one more help if its possible to do that. In TAB=1 extract the text which i have been clicking link one by one; in TAB=2 extracted vr no. both extracted text should be saved in Vr_No.csv file separate column and remove the extracted text which is contains double quotes and more spaces between text.

Alright, good to hear that the "nth-of-type({{!LOOP}})" Technique is working... :D

>>>

Then now, to extract the Link you've been clicking on 'TAB_1' => using the 'EVENT' Mode in your Script..., => that would be the 'FTO No' Entries, if I understand "correctly" from your Screenshot(s)...(?)

Then, pffff..., yep, that's possible..., I have a "Technique" to implement the 'EXTRACT' Mechanism using the 'EVENT' Mode :P :twisted: , but I've never posted it, and honesty, I'm very afraid it will be too "complicated" for you, ah-ah...!, it will take months...!, before you'll "maybe" get it to work, ah-ah...! :shock:
This wouldn't be an easy/quick Sub-Question with an "easy" Answer... One day maybe, for an "interesting" Thread where the 'EXTRACT' Mechanism "really" doesn't work..., and that would belong into the 'Data-Extraction' Sub-Forum...

=> Simply use the 'TAG' Mode and the "dedicated" 'EXTRACT' Mechanism, that's "the Way to go"...! That's the very Purpose of the 'EXTRACT' Mechanism/Command...! :idea:

I don't "know" why you chose for the 'EVENT' Mode to click/loop through those Links, in the first instance, the 'TAG' Mode would have done it just the same, and probably more easily... :|
Hum, OK..., I understand why you chose for the 'EVENT' Mode, as you are forcing opening every Link in a New Tab with the 'Ctrl^Click' on the Link... (I wasn't seeing the end of the 'EVENT' Statement because of the ]code[ Formatting...) OK, then, that's neat actually...! I'm nearly "impressed" actually you managed to implement that Functionality, ah-ah...! Very nice... :D
- (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