sceiler Posted February 28, 2013 Posted February 28, 2013 Hello,I am new to Autoit and I want to automatically select a specific button, then click a specific button opened in a new window, fill out a form and send the form.Here is the page: http://www.buchsys.de/mannheim/angebote/aktueller_zeitraum/_Badminton_fuer_Sie___Ihn.htmlIt is for my university where we can book or reserve badminton courts. I am only interested in the green buttons as the orange ones are not possible to book.Example:On the table Mittwoch 16:00 - 17:00 on the second row is a green button. I found out with firebug that the button name="BS_Kursid_29759" . My problem is, how do I select this button which changes every week? If I have got this then I believe it shouldnt be a big problem to do the rest. #include <IE.au3>$IE = _IECreate("www.google.de")$Button = _IEGetObjByName ($IE, "btnG")_IEAction($Button,"click")Is my code until now.
somdcomputerguy Posted February 28, 2013 Posted February 28, 2013 Does the id of the button change? - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
Exit Posted February 28, 2013 Posted February 28, 2013 (edited) #include <IE.au3> $oIE = _IECreate("http://www.buchsys.de/mannheim/angebote/aktueller_zeitraum/_Badminton_fuer_Sie___Ihn.html") $oElements = _IETagNameGetCollection($oIE, "Input") For $oElement In $oElements ConsoleWrite("Tagname: " & $oElement.tagname & @LF & " Outerhtml: " & $oElement.outerhtml & @LF) If StringInStr($oElement.outerhtml, "buchen") Then ExitLoop _IEAction($oElement, "click") Next _IEQuit($oIE) ConsoleWrite("*************************" & @LF) WinWait("Anmeldung", "", 10) $oIE = _IEAttach("Anmeldung") $oElements = _IETagNameGetCollection($oIE, "Input") For $oElement In $oElements ConsoleWrite("Tagname: " & $oElement.tagname & @LF & " Outerhtml: " & $oElement.outerhtml & @LF) If StringInStr($oElement.outerhtml, "buchen") Then ExitLoop _IEAction($oElement, "click") Next ConsoleWrite("*************************" & @LF) $oElements = _IETagNameAllGetCollection($oIE) For $oElement In $oElements Switch $oElement.tagname Case "INPUT" ConsoleWrite("Tagname: " & $oElement.tagname & @LF & " Outerhtml: " & $oElement.outerhtml & @LF) If StringInStr($oElement.outerhtml, ' name="sex" value="M" ') Then _IEAction($oElement, "click") If StringInStr($oElement.outerhtml, ' name="vorname" ') Then _IEPropertySet($oElement, "innertext", "Donald") If StringInStr($oElement.outerhtml, ' name="name" ') Then _IEPropertySet($oElement, "innertext", "Duck") If StringInStr($oElement.outerhtml, ' name="email" ') Then _IEPropertySet($oElement, "innertext", "Somebody@gmx.de") If StringInStr($oElement.outerhtml, ' name="telefon" ') Then _IEPropertySet($oElement, "innertext", "089/47110815") ; and here some more to fill. ;-) Case "SELECT" ConsoleWrite("Tagname: " & $oElement.tagname & @LF & " Outerhtml: " & StringReplace($oElement.outerhtml, "<option value=", @LF & @TAB & @TAB & "<option value=") & @LF) _IEFormElementOptionselect($oElement, "S-POP") EndSwitch Next Edited February 28, 2013 by Exit App: Au3toCmd UDF: _SingleScript()
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