Page 1 of 1

Selecting from drop-down menus

Posted: Thu Nov 16, 2006 9:48 am
by Tech Support
As per the online user manual:

http://www.iopus.com/imacros/help/cmd_tag.htm

you can select from a drop-down menu in various ways. By position (or index), by name (prefix $) or by value (prefix %). Please see the following website for an example:

https://www.directseguros.es/servicios/ ... ames.html?

Code: Select all

FRAME F=5      
REFRESH 
TAG POS=1 TYPE=SELECT FORM=NAME:CarSearch ATTR=NAME:tradeMarkId CONTENT=4
Problem: A Select via name on this list is not recognised.

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:CarSearch ATTR=NAME:tradeMarkId CONTENT=$bmw
Solution: Sometimes the name is not exactly as it appears, it may for example contain additional spaces before or after the name. Therefore the wildcard character should be used:

Code: Select all

TAG POS=1 TYPE=SELECT FORM=NAME:CarSearch ATTR=NAME:tradeMarkId CONTENT=$*bmw*
Daniel Kerr
iOpus Support

Re: Selecting from drop-down menus

Posted: Tue Nov 21, 2006 1:54 am
by deeboh
Very nice choice for an example site :twisted:
However i'm still having issues with drop down menu's.

i'll keep looking through the forums for other examples.

Best,

Deeboh

Posted: Tue Nov 21, 2006 12:51 pm
by Hannes, Tech Support
What site do you have problems with?


Hannes

loop through all elements in dropdown

Posted: Fri Feb 16, 2007 8:48 pm
by RJM
I am presented with a dropdown menu that varies in its number of elements. I would like to loop through each of them. Is there a way to capture the number of elements in the dropdown list so that I can script this loop? Or am I going at this the wrong way?

Posted: Tue Feb 20, 2007 11:21 am
by Tech Support
Hi,

The best approach would be to loop until you get #EANF#, meaning that there are no further entries to be extracted.

You could also use this to count the number of entries but I think that calculation is then redundant for this purpose.

Daniel Kerr
iOpus Support

Re: Selecting from drop-down menus

Posted: Thu Nov 20, 2008 11:44 am
by PeteWebber
I'm having a problem here:

I want the macro to log into and fill in a form for the article directory ezinearticles.com - http://ezinearticles.com/

When I select a subcatagory of a main catagory (in this case - Business:Entrepreneurialism) the subcatagory is separated form the main catagory by a ":"

I have read on the wiki page here - http://wiki.imacros.net/TAG that:

"In multiple selection menus multiple selection can be achieved by listing indices separated by a colon (:)."

In have no problem getting the macro to record a catagory selction from the dropdown menu for a main catagory but it appears that after any sub catagory selection that includes a ":" I get this error:

"Runtime error: Unable to select entry specified by: %Business:Entrepreneurialism, line 9

I have tried swapping the % for a $ but I believe that the problem is that both the macro and the web page use the ":" character. I may be completely wrong, either way is there a way around this using wildcards?

*Edit* - I just substituted the : in the macro for a * and it works.

Answered my own question but thought I'd still post the question anyway!

Re: Selecting from drop-down menus

Posted: Thu Nov 20, 2008 1:36 pm
by Hannes, Tech Support
Thanks for sharing your solution!

Indeed, as the ":" is a special character in TAGs that select dropdowns, any ":" that appear in the selections (i.e. in the site's HTML code) need to be replaced by the wildcard character.

Re: Selecting from drop-down menus

Posted: Tue Jun 09, 2009 11:05 pm
by bwatson
This page has been very helpful. I do have one more question

I would like to have 3 to 5 options for my drop down menu. i.e:

TAG POS=1 TYPE=SELECT FORM=NAME:submitarticle ATTR=NAME:f_categoryid CONTENT=$*sports*
TAG POS=1 TYPE=SELECT FORM=NAME:submitarticle ATTR=NAME:f_categoryid CONTENT=$*football*
TAG POS=1 TYPE=SELECT FORM=NAME:submitarticle ATTR=NAME:f_categoryid CONTENT=$*nfl<SP>football*

In this manner I can go from a very generic category (for my articles) to a very specific one (if it exits). However if football or nfl football doesn't exist it automatically defaults to a blank (or first) selection and does not leave sports.

Is there any way to do a If statement so if a certain category exists I can select it. Or is there anyway to leave the previous selection the same if the second or third selection does not exist?

Re: Selecting from drop-down menus

Posted: Sun Jul 26, 2009 8:49 am
by nitinkhanna
I am recently trying to code through iMacros. And I didn't get what is happening here, please make me understand the code

Re: Selecting from drop-down menus

Posted: Tue Aug 11, 2009 9:42 am
by Hannes, Tech Support
bwatson wrote:Is there any way to do a If statement so if a certain category exists I can select it. Or is there anyway to leave the previous selection the same if the second or third selection does not exist?
There are no conditionals in the macros themselves, however, using scripting, you can use conditionals as well as loops. Cf. here.