Selecting from drop-down menus

Information related to the use of iMacros for form filling and data upload.
Post Reply
User avatar
Tech Support
Posts: 5003
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Selecting from drop-down menus

Post by Tech Support » Thu Nov 16, 2006 9:48 am

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/suscripcion/frames.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
deeboh
Posts: 4
Joined: Tue Nov 21, 2006 1:43 am

Re: Selecting from drop-down menus

Post by deeboh » Tue Nov 21, 2006 1:54 am

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
The Autumn wind is a Raider
Pillaging just for fun
He'll knock you 'round and upside down
And laugh when he's conquered and won
Hannes, Tech Support

Post by Hannes, Tech Support » Tue Nov 21, 2006 12:51 pm

What site do you have problems with?


Hannes
RJM
Posts: 1
Joined: Fri Feb 16, 2007 8:38 pm

loop through all elements in dropdown

Post by RJM » Fri Feb 16, 2007 8:48 pm

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?
User avatar
Tech Support
Posts: 5003
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Tue Feb 20, 2007 11:21 am

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
PeteWebber
Posts: 0
Joined: Thu Nov 20, 2008 11:29 am

Re: Selecting from drop-down menus

Post by PeteWebber » Thu Nov 20, 2008 11:44 am

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!
Hannes, Tech Support

Re: Selecting from drop-down menus

Post by Hannes, Tech Support » Thu Nov 20, 2008 1:36 pm

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.
bwatson
Posts: 0
Joined: Tue Jun 09, 2009 10:56 pm

Re: Selecting from drop-down menus

Post by bwatson » Tue Jun 09, 2009 11:05 pm

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?
nitinkhanna
Posts: 2
Joined: Sun Jul 26, 2009 8:26 am

Re: Selecting from drop-down menus

Post by nitinkhanna » Sun Jul 26, 2009 8:49 am

I am recently trying to code through iMacros. And I didn't get what is happening here, please make me understand the code
Hannes, Tech Support

Re: Selecting from drop-down menus

Post by Hannes, Tech Support » Tue Aug 11, 2009 9:42 am

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.
Post Reply