Jump to content

HTML Drop Down help (Solved)


zzghost
 Share

Recommended Posts

Hello,

I have been reading every tutorial and help document I can find trying to figure out how to capture from a website the content of a dropdown in order to populate it into a GUI with checkboxes to run some code based off of the selections...

Quote

<select name="ContentPlaceHolder1$selectCtr" id="ContentPlaceHolder1_selectCtr" class="form-group">
 <option selected="selected" value="">select ...</option>
 <option value="8494">Option1(8494)</option>
 <option value="106209">Option2(106209)</option>
</select>

I would like a script to read the options from this form-group and populate a gui. I have all the code written except this part, as of now I have to manually pull this from the site and dump into my code but it changes from time to time so I would like my code to be more flexible...

 

Hope this makes sense?

Edited by zzghost
Link to comment
Share on other sites

Please help, I think this is what you meant just trying to teach myself....

 

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "selectExample")
Local $oInputs = _IETagNameGetCollection($oIE, $oForm)
Local $sTxt = ""
For $oInput In $oInputs
    $sTxt &= $oInput.???? & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Test", $sTxt)

_IEQuit($oIE)

 

Link to comment
Share on other sites

You've got a few things wrong there. But here's a working example of what I was intending --

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Example("form")
Local $oElement = _IEGetObjByName($oIE, "selectExample")
Local $oOptions = _IETagNameGetCollection($oElement, 'option')
Local $sTxt = ""
For $oOption In $oOptions
    $sTxt &= $oOption.value & @TAB & $oOption.innerText & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Test", $sTxt)

_IEQuit($oIE)

 

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

×
×
  • Create New...