Jump to content
Sign in to follow this  
Falling

_IEFormElementOptionSelect() help please

Recommended Posts

Falling

hey

if on a form there is a select like this:

<select name="salutation" class="bod">

  <option value="">Select one...</option>
  <option value="1">Mr</option>
  <option value="2">Mrs</option>
  <option value="3">Ms</option>

</select>

How do i use _IEFormElementOptionselect() properly to select the 2nd value?

say under following circumstances:

1. Form index = 1.

so.

$oIE = _IECreate ($URL)  
$o_form = _IEFormGetCollection ($oIE,1)
_IEFormElementOptionselect($o_form ,"Mr");?????????????????????????

The above does not work...any idea why? thanks for any information!

Share this post


Link to post
Share on other sites
big_daddy

The above does not work...any idea why? thanks for any information!

If you download the latest beta that was just released this morning it has great examples for each function.

On that note try this:

#include <IE.au3>

$oIE = _IECreate ($URL) 
$oForm = _IEFormGetCollection ($oIE, 1)
$oSelect = _IEFormElementGetObjByName($oForm, "salutation")
_IEFormElementOptionselect($oSelect, "Mr", 1, "byText")

Edit: fixed code & refixed code

Edited by big_daddy

Share this post


Link to post
Share on other sites
DaleHohm

big_daddy beat me by seconds.

Although an addition is needed... this function takes the select object as input rather than the form...

#include <IE.au3>

$oIE = _IECreate ($URL)  
$oForm = _IEFormGetCollection ($oIE, 1)
$oSelect = _IEFormElementGetObjByName($oForm, "salutation")
_IEFormElementOptionselect($oSelect, "Mr", 1, "byText")

Dale

Edit: typo $oFrom -> $oForm

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
big_daddy

big_daddy beat me by seconds.

Although an addition is needed... this function takes the select object as input rather than the form...

#include <IE.au3>

$oIE = _IECreate ($URL)  
$oForm = _IEFormGetCollection ($oIE, 1)
$oSelect = _IEFormElementGetObjByName($oFrom, "salutation")
_IEFormElementOptionselect($oSelect, "Mr", 1, "byText")

Dale

Thanks, I got in a hurry and forgot about that. :D

Share this post


Link to post
Share on other sites
DaleHohm

Thanks, I got in a hurry and forgot about that. :D

:wacko: BTW, I do agree with the OP this this is the evil-est of the functions in the library... there is no way you can guess the syntax - you must read the docs and look at the examples.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites
Falling

where does $oFrom come from?

is it the same as $oForm?

Share this post


Link to post
Share on other sites
DaleHohm

where does $oFrom come from?

is it the same as $oForm?

Yup, typo.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.