Jump to content

How to change the Selector setting in dropdown via autoit remotely.


Recommended Posts

Can someone help me get back on track?

I know the first line in the autoit file should be using the form element, but there is no form name or ID.

so I would like to address it direct knowing the name of the selector....

Local $oSelect = _IEFormElementGetObjByName($oIE, "tomselector")

Is this possible..

Html stuff...
<select name=tomselector>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>

Autoit stuff
Local $oSelect = _IE GetObjByName($oIE, "tomselector")
_IEFormElementOptionselect($oSelect, "Mercedes", 1, "byText")
Sleep(1000)
_IEFormElementOptionselect($oSelect, "mercedes", 1, "byValue")
Sleep(1000)
_IEFormElementOptionselect($oSelect, 0, 1, "byIndex")
Sleep(1000)

I only need one method above to set the options, but I was trying all 3 to see if I could get anyone to work.

Thanks

Link to comment
Share on other sites

This is what my selector is wrapped in..and it might help some one help me figure out how to address the selector remotely by autoit. As you can see I don't have the normal form to reference and it has no name..

So is it possible to address the selector using the table which has no name but does have a class.

<div class="form">
  <table class="inner">
    <select name=tomselector>
    <option value="volvo">Volvo</option>
   <option value="saab">Saab</option>
   <option value="mercedes">Mercedes</option>
   <option value="audi">Audi</option>
</select>
</table>
</div>
Link to comment
Share on other sites

There was a space left in the func '_IE GetObjByName '

Using a local htm file with your html stuff inside, this works for me

#include <IE.au3>

$oIE = _IECreate("file:///C:/Documents%20and%20Settings/user/desktop/1.htm")
Sleep(1000)

$oSelect = _IEGetObjByName($oIE, "tomselector")
_IEFormElementOptionselect($oSelect, "Saab", 1, "byText")
Sleep(1000)
_IEFormElementOptionselect($oSelect, "mercedes", 1, "byValue")
Sleep(1000)
_IEFormElementOptionselect($oSelect, 3, 1, "byIndex")
Edited by mikell
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...