braam Posted July 7, 2007 Share Posted July 7, 2007 Ok, so I started playing around with AutoIt and web sites last night. I have used AutoIt before, many moons ago, and started off by sending keys and lots of tabs, until I read about the IE.au3 :-) Just to set the record, I am not a programmer at all, so please be gentle :-) With lots of reading and copy and paste and adjusting, I got to log into a website (www.everydns.net) and I got to update all the MX records on my domains (hosted with google pages), but this morning I wanted to extend my "program" to also add a new domain for me. On the login site I am using this code: $domain = InputBox("Domain Name", "Enter domain name, i.e. domain.co.za") $username1 = InputBox("Username", "Enter username") $password1 = InputBox("Password", "Enter password", "", "*") $oIE = _IECreate() _IENavigate($oIE, "http://www.everydns.net") ; get pointers to the login form and username and password fields $oform = _IEFormGetObjByName($oIE, "login") $ologin = _IEFormElementGetObjByName($oform, "username") $opassword = _IEFormElementGetObjByName($oform, "password") $oLoginbutton = _IEFormElementGetObjByName($oform, "Submit") ; Set field values and submit the form _IEFormElementSetValue($ologin, $username1) _IEFormElementSetValue($opassword, $password1) $oLoginbutton.click I know it probably not very elegant, but it does the trick. My challenge on the "create a new domain record" form is that the submit button has no name defined. It looks like this: <input type="text" name="newdomain" value="eg: everydns.net"><div align="right"><input type="submit" value=">> (basic)"></div> So, I get it to insert the domain name ($domain = InputBox("Domain Name", "Enter domain name, i.e. domain.co.za")) but then cannot click the button called >> (basic) It has gone from being functional to being a challenge! Any ideas, please? Thanks! Braam. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 7, 2007 Share Posted July 7, 2007 $oIE = _IECreate()_IENavigate($oIE, "http://www.everydns.net"); get pointers to the login form and username and password fields$oform = _IEFormGetObjByName($oIE, "login")$ologin = _IEFormElementGetObjByName($oform, "username")$opassword = _IEFormElementGetObjByName($oform, "password")$oLoginbutton = _IEFormElementGetObjByName($oform, "Submit"); Set field values and submit the form_IEFormElementSetValue($ologin, $username1)_IEFormElementSetValue($opassword, $password1)$oLoginbutton.clickI know it probably not very elegant, but it does the trick. My challenge on the "create a new domain record" form is that the submit button has no name defined. It looks like this:<input type="text" name="newdomain" value="eg: everydns.net"><div align="right"><input type="submit" value=">> (basic)"></div>So, I get it to insert the domain name ($domain = InputBox("Domain Name", "Enter domain name, i.e. domain.co.za")) but then cannot click the button called >> (basic)Does it work with just _IEFormSubmit($oform), without trying to get fancy with the button object? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
braam Posted July 8, 2007 Author Share Posted July 8, 2007 Awesom! Thanks PsaltyDS, just got it working Link to comment Share on other sites More sharing options...
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