Jump to content
Sign in to follow this  
Tyw214

Incredibly confused by the Autoit Help file

Recommended Posts

Tyw214

I am a newbie to writing script, i've only dabbled with jQuery and html/css (which I find them easy enough for me to understand to get what I need done), but I am having an incredibly difficult time understanding the Autoit syntax/commands.

What I am trying to achieve sounds very simple but trying to write it in autoit script is pure frustration.

I basically need to select an option on a webpage with

url: www.example.com

<select name="Options" id="id_Options">
<option value="" selected="selected">---------</option>
<option value="1">Option 1</option>
<option value="2">Option 2</option>

I know the best way for me to do this is probably using the

_IEFormElementOptionSelect

But I am stumped at the example which also seem to require me to do use

_IEFormGetObjByName

AND

_IEFormElementGetObjByName

Usually, i'd just look up the syntax for those functions, but the explanation for each of the parameters in the function is incredibly jargon-filled. Not that I don't understand the meaning of it, but I fail to draw a logical connection between the parameters and its use in that specific function....

So can somebody just give me a simple sample script using the html I provided above? And Select an option? This is how far I got...

#include <IE.au3>
$s_URL = "http://www.myriadsupply.com/admin/product/product/add/"
Local $o_IE = IECreate ($s_URL)
_IELoadWait ($o_IE)

Share this post


Link to post
Share on other sites
spudw2k

You are on the right track. The Form on the desired page (which apparently requires a login so I cannot test) has an ID which is fed to _IEFormGetObjByName. Similarly the Option in question should have an ID which to provide to _IEFormElementGetObjByName.

If you run the example below you will see a demo page. if you examine the source code of the page you will find the corresponding object/element IDs ("ExampleForm" & "selectExample")

#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oSelect = _IEFormElementGetObjByName ($oForm, "selectExample")
For $i = 1 To 10
    _IEFormElementOptionSelect ($oSelect, "Freepage", 1, "byText")
    Sleep(1000)
    _IEFormElementOptionSelect ($oSelect, "midipage.html", 1, "byValue")
    Sleep(1000)
    _IEFormElementOptionSelect ($oSelect, 0, 1, "byIndex")
    Sleep(1000)
Next
Edited by spudw2k

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  

×