Fill the web page from CSV file based on a List box

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
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
jyotirmaya
Posts: 30
Joined: Wed Jul 27, 2016 6:25 pm

Fill the web page from CSV file based on a List box

Post by jyotirmaya » Tue Aug 21, 2018 6:51 pm

I am using Browser Firefox 48.0
iMacros for Firefox 9.0.3
Windows 7 Professional 64-bit Operating system

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database
TAB T=1     
' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file
'CSV = Comma Separated Values in each line of the file
SET !DATASOURCE DATABASE.csv

'SET !DATASOURCE_COLUMNS 8
'Start at line 2 to skip the header in the file
SET !LOOP 2
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}}

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%1
WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt3yr CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt3yr0 CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprecd3 CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprecd4 CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcd2 CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcd3 CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcdprev CONTENT={{!COL8}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcdprev0 CONTENT={{!COL9}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcurrent CONTENT={{!COL10}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtRntaream3yr CONTENT={{!COL11}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtRntaream3yr0 CONTENT={{!COL12}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent3rdprcd CONTENT={{!COL13}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent3rdprcd0 CONTENT={{!COL14}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent2ndprcd CONTENT={{!COL15}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent2ndprcd0 CONTENT={{!COL16}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrentprvprcd CONTENT={{!COL17}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrentprvprcd0 CONTENT={{!COL18}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrentcurrent CONTENT={{!COL19}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessM3yr CONTENT={{!COL20}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessM3yr0 CONTENT={{!COL21}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess3prcd CONTENT={{!COL22}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess3prcd0 CONTENT={{!COL23}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess2prcd CONTENT={{!COL24}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess2prcd0 CONTENT={{!COL25}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessPvsprcd CONTENT={{!COL26}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessPvsprcd0 CONTENT={{!COL27}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessCurent CONTENT={{!COL28}}
ONDIALOG POS=1 BUTTON=OK CONTENT=
ONDIALOG POS=2 BUTTON=OK CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_btnsave
WAIT SECONDS=2
I have a CSV file which have 28 columns and 2500 rows. I am using the above code to fill the the data in website. In column A of my CSV file starting from A2 to 2500 I have the values of the List box of the website. I want the macro to open the web page based on the value of column A and fill the information of column B to AB. A loop will be possible ?
chivracq
Posts: 8192
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill the web page from CSV file based on a List box

Post by chivracq » Tue Aug 21, 2018 10:23 pm

jyotirmaya wrote:I am using

Code: Select all

Browser Firefox 48.0
iMacros for Firefox 9.0.3 
Windows 7 Professional 64-bit Operating system

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database
TAB T=1     
' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file
'CSV = Comma Separated Values in each line of the file
SET !DATASOURCE DATABASE.csv

'SET !DATASOURCE_COLUMNS 8
'Start at line 2 to skip the header in the file
SET !LOOP 2
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}}

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%1
WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt3yr CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txt3yr0 CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprecd3 CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprecd4 CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcd2 CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcd3 CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcdprev CONTENT={{!COL8}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtprcdprev0 CONTENT={{!COL9}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcurrent CONTENT={{!COL10}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtRntaream3yr CONTENT={{!COL11}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtRntaream3yr0 CONTENT={{!COL12}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent3rdprcd CONTENT={{!COL13}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent3rdprcd0 CONTENT={{!COL14}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent2ndprcd CONTENT={{!COL15}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrent2ndprcd0 CONTENT={{!COL16}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrentprvprcd CONTENT={{!COL17}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrentprvprcd0 CONTENT={{!COL18}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtrentcurrent CONTENT={{!COL19}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessM3yr CONTENT={{!COL20}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessM3yr0 CONTENT={{!COL21}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess3prcd CONTENT={{!COL22}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess3prcd0 CONTENT={{!COL23}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess2prcd CONTENT={{!COL24}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcess2prcd0 CONTENT={{!COL25}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessPvsprcd CONTENT={{!COL26}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessPvsprcd0 CONTENT={{!COL27}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_txtcessCurent CONTENT={{!COL28}}
ONDIALOG POS=1 BUTTON=OK CONTENT=
ONDIALOG POS=2 BUTTON=OK CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_btnsave
WAIT SECONDS=2
I have a CSV file which have 28 columns and 2500 rows. I am using the above code to fill the the data in website. In column A of my CSV file starting from A2 to 2500 I have the values of the List box of the website. I want the macro to open the web page based on the value of column A and fill the information of column B to AB. A loop will be possible ?
Not sure where you want to use your 'Col_A' as I don't see any '{{!COL1}}' in your Script, the following Line with a 'TYPE=SELECT' Element is for a DDLB indeed:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%1
Then I don't really understand your "I want the macro to open the web page based on the value of column A", but if you want to use '!COL1' for that 'SELECT' Element, you need, like explained in the Wiki, to specify it outside the '$'/'%'/'#' (Name/Value/Index) Selector like in:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%{{!COL1}}
=> With "1" in your DataSource...
Last edited by chivracq on Wed Aug 22, 2018 12:34 pm, edited 1 time in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
jyotirmaya
Posts: 30
Joined: Wed Jul 27, 2016 6:25 pm

Re: Fill the web page from CSV file based on a List box

Post by jyotirmaya » Wed Aug 22, 2018 5:23 am

Not sure where you want to use your 'Col_A' as I don't seen any '{{!COL1}}' in your Script, the following Line with a 'TYPE=SELECT' Element is for a DDLB indeed:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%1
Then I don't really understand your "I want the macro to open the web page based on the value of column A", but if you want to use '!COL1' for that 'SELECT' Element, you need, like explained in the Wiki, to specify it outside the '$'/'%'/'#' (Name/Value/Index) Selector like in:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%{{!COL1}}
=> With "1" in your DataSource...
its working thanks
I have changed the code from

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%1
into

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%{{!COL1}}
Now I can play the LOOP with the List Box information stored in column A in Data source.

Thank you JF Chivracq :) :P :D
iMacros rocks :D
chivracq
Posts: 8192
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Fill the web page from CSV file based on a List box

Post by chivracq » Wed Aug 22, 2018 1:48 pm

jyotirmaya wrote:its working thanks
I have changed the code from

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%1
into

Code: Select all

TAG POS=1 TYPE=SELECT FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_ddlkhata CONTENT=%{{!COL1}}
Now I can play the LOOP with the List Box information stored in column A in Data source.

Thank you JF Chivracq :) :P :D
iMacros rocks :D
Ah OK, good-good then, I wasn't sure I had understood correctly what you wanted...

But yep, this is "Standard" Use of iMacros indeed, and this Syntax is perfectly documented in the Wiki for the 'TAG' Command for DDLB's...
You should know that 'TAG' Wiki Page by heart by now, I would think, after using iMacros for 2 years, ah-ah...! :wink:

I saw you opened a new Thread, I'll have a look... as you now use the Forum very correctly, with perfect Follow-up..., and sharing your Final Script...! Very good...! :D
Hum, btw..., about my initial "Rant" about what I call the "Indian High Caste Behaviour Syndrome", here is just one more Example... :roll:
Took a while to get their FCI (partially) mentioned, I did my Testing and posted a Script, they checked my Script, which probably works correctly and solved their Pb..., and they never bothered to follow up since..., tja... :(
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
jyotirmaya
Posts: 30
Joined: Wed Jul 27, 2016 6:25 pm

Re: Fill the web page from CSV file based on a List box

Post by jyotirmaya » Wed Aug 22, 2018 1:59 pm

Feeling bad that he didn't followed up, but hoping that he will follow up. I am sorry from that guy. I would have react the same as you reacted because after getting help also if he will not respond then this type of feeling is obvious but besides that I am extremely thankful to you as you never mind these type of behaviour and you keep helping us. :)
Post Reply