Selecting from drop-down menus

Information related to the use of iMacros for form filling and data upload.

Moderator: iMacros Moderators

Selecting from drop-down menus

by Tech Support on Thu Nov 16, 2006 2: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
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Re: Selecting from drop-down menus

by deeboh on Mon Nov 20, 2006 6:54 pm

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
deeboh
 
Posts: 4
Joined: Mon Nov 20, 2006 6:43 pm

by Hannes, Tech Support on Tue Nov 21, 2006 5:51 am

What site do you have problems with?


Hannes
Hannes, iOpus Support
Hannes, Tech Support
 
Posts: 2120
Joined: Thu Sep 21, 2006 6:27 am

loop through all elements in dropdown

by RJM on Fri Feb 16, 2007 1: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?
RJM
 
Posts: 1
Joined: Fri Feb 16, 2007 1:38 pm

by Tech Support on Tue Feb 20, 2007 4: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
User avatar
Tech Support
 
Posts: 5003
Joined: Tue Sep 20, 2005 12:25 pm

Re: Selecting from drop-down menus

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

Re: Selecting from drop-down menus

by Hannes, Tech Support on Thu Nov 20, 2008 6:36 am

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.
Hannes, iOpus Support
Hannes, Tech Support
 
Posts: 2120
Joined: Thu Sep 21, 2006 6:27 am

Re: Selecting from drop-down menus

by bwatson on Tue Jun 09, 2009 4: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?
bwatson
 
Posts: 0
Joined: Tue Jun 09, 2009 3:56 pm

Re: Selecting from drop-down menus

by nitinkhanna on Sun Jul 26, 2009 1: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
nitinkhanna
 
Posts: 2
Joined: Sun Jul 26, 2009 1:26 am

Re: Selecting from drop-down menus

by Hannes, Tech Support on Tue Aug 11, 2009 2: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.
Hannes, iOpus Support
Hannes, Tech Support
 
Posts: 2120
Joined: Thu Sep 21, 2006 6:27 am


Return to How-To's and Examples for Form Filling

Who is online

Users browsing this forum: No registered users and 1 guest

-->