Tyw214 Posted March 16, 2012 Posted March 16, 2012 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)
spudw2k Posted March 16, 2012 Posted March 16, 2012 (edited) 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 March 16, 2012 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now