How to select all values from a list starting with certain..

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
whanaki
Posts: 8
Joined: Sun Jan 18, 2009 11:54 am

How to select all values from a list starting with certain..

Post by whanaki » Sun Jan 18, 2009 12:00 pm

Hi,

I want to script something that surfs to a page selects all options from a multi-select box that start with a certain number and then submits the page and extracts the returned data. As additional values starting with the same number might be added at any time I want to make the selection on the multi-select box only based on the first 5 numbers and the rest be wildcard.

However I can't get this working. The multi-select box contains three entries with three values all containing 10469. I tried:

TAG POS=1 TYPE=SELECT FORM=NAME:selector ATTR=NAME:d_ppos_auswahl CONTENT=$*10469*

AND

TAG POS=1 TYPE=SELECT FORM=NAME:selector ATTR=NAME:d_ppos_auswahl CONTENT=%*10469*
but only the first occurrence is selected.

What am I doing wrong?

Cheers
Martin
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: How to select all values from a list starting with certain..

Post by Tech Support » Wed Jan 21, 2009 4:28 pm

Do you want to select all values in the listbox or only a subset?
whanaki
Posts: 8
Joined: Sun Jan 18, 2009 11:54 am

Re: How to select all values from a list starting with certain..

Post by whanaki » Wed Jan 21, 2009 9:22 pm

Hi,

I wish to select only a subset. The multi select box has about 200 entries and I only want the ones starting with or containing a certain value.

Cheers
Martin
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Re: How to select all values from a list starting with certain..

Post by Tech Support » Thu Jan 22, 2009 2:58 pm

...I only want the ones starting with or containing a certain value.
By default, the TAG SELECT command can select either all values or the values you specify. The use of the * symbol is not yet possible for this purpose.

The use of CONTENT=$*berry* selects only the FIRST element that matches *berry*, and not all list elements that would match it!

So you need to split the task in two steps:

1. Extract all values from the select box
TAG... EXTRACT=TXTALL

2. Then use these values to create a list of values that you want to select
TAG TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=$Apple:$*berry*:$Peach
or
TAG TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=1:3:8

See also http://wiki.imacros.net/TAG#The_EXTRACT_Parameter
whanaki
Posts: 8
Joined: Sun Jan 18, 2009 11:54 am

Re: How to select all values from a list starting with certain..

Post by whanaki » Thu Jan 22, 2009 8:01 pm

Hi,

thanks for the idea of splitting the task up. If I understand correctly I go to the page, select all values, hand them over to e.g. Excel where I parse the extract result to find the relevant values and then give these values back to the iMacro script so I can then select only the specific values.

From what it seems there is no way of doing this solely in iMacro, correct?

Cheers
Martin
Post Reply