How to create a macro that can select one from a series of radio buttons?
Top  Previous  Next

Q: How can I create a macro that can select one from a series of radio buttons? I want to avoid setting up separate macros for each selection.

A: You can use variables to select a radio button. For example, instead of using one of these three lines:

TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT=yes
TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT=no
TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT=maybe


You can use:

TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:/cgi-bin/Info.cgi ATTR=NAME:lunch CONTENT={{choice}}

and set
{{choice}} to either "yes", "no" or "maybe". Please note that this value might be case sensitive. This depends on the website that processes this input.

To assign a value to the variable, you can use either the
SET command, the -var_varname varvalue command line argument or the iimSet command of the Scripting Interface.




Page URL http://www.iopus.com/imacros/help/faq_select_radio.htm