Jump to content

Setting any value from the _IEFormElementSetValue ?


Recommended Posts

So I have an IE drop down that I want to set the value in. The data in the drop down is not static. For example the drop contains individual names, not static values. I have no issues setting other static drop downs to get to this point in my code.

What I am trying to accomplish here is to just set the value to whatever. I do mind which name I pick from the drop down and it does not matter. What does matter is that it can not be the starting value of "Please Specify"

Here is the code that I have currently.

CODE
;;-------------Begin setting Connect IN refusal person.

$oIE_ConnectIN_refusal_person = _IEAttach ("Installed Base", "embedded")

$oForm_ConnectIN_refusal_person = _IEFormGetObjByName ($oIE_ConnectIN_refusal_person, "RemoteConn")

$oQuery_ConnectIN_refusal_person = _IEFormElementGetObjByName ($oForm_ConnectIN_refusal_person, "mydropdown99")

_IEFormElementSetValue ($oQuery_ConnectIN_refusal_person, "INEEDHELP_HERE")

_IELoadWait ($oIE_ConnectIN_refusal_person)

Valid values for mydropdown99 on the test that I am running are <SELECT size=1 name=mydropdown99><OPTION value="Please Specify">Please Specify</OPTION><OPTION value="MELANIE" selected>MELANIE</OPTION></SELECT>

I want to have MELANIE or any value other then Please Specify set.

Should I scrap this portion of the macro and go with mouse clicking for the drop down?

Edited by m0raca
Link to comment
Share on other sites

What about _IEFormElementOptionselect() and specifying byValue?

I understand what you are saying and from the example code on that function it defiantly appears to the be the one that I want to use! I am just struggling with the function, now is all. AutoIT is powerful, and I have made many macros in other macroUIs so this is going to take some getting used to.

I very much so appreciate the help!

Link to comment
Share on other sites

Nothing to struggle with :). If the first option in the drop-down is the default "Please Specify" the you can just use the _IEFormElementOptionselect() with byIndex like:

#include <IE.au3>

Dim $oIE, $oSelect

_IELoadWaitTimeout(15000)
$oIE = _IECreate('http://www.autoitscript.com/forum/index.php?&showforum=2')
$oSelect = _IEGetObjByName($oIE, 'f')
$oSelect.ScrollIntoView()
_IEFormElementOptionselect($oSelect, '1', 1, 'byIndex')
Link to comment
Share on other sites

Nothing to struggle with :). If the first option in the drop-down is the default "Please Specify" the you can just use the _IEFormElementOptionselect() with byIndex like:

#include <IE.au3>

Dim $oIE, $oSelect

_IELoadWaitTimeout(15000)
$oIE = _IECreate('http://www.autoitscript.com/forum/index.php?&showforum=2')
$oSelect = _IEGetObjByName($oIE, 'f')
$oSelect.ScrollIntoView()
_IEFormElementOptionselect($oSelect, '1', 1, 'byIndex')
Got it! Thank you! This is what it looks like on my end.

CODE
;;-------------Begin setting Connect IN refusal person.

$oIE_ConnectIN_refusal_person = _IEAttach ("Installed Base", "embedded")

$oForm_ConnectIN_refusal_person = _IEFormGetObjByName ($oIE_ConnectIN_refusal_person, "RemoteConn")

$oSelect_ConnectIN_refusal_person = _IEFormElementGetObjByName ($oForm_ConnectIN_refusal_person, "mydropdown99")

$oSelect_ConnectIN_refusal_person.ScrollIntoView()

_IEFormElementOptionselect($oSelect_ConnectIN_refusal_person, '1', 1, 'byIndex')

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