Xealos Posted May 5, 2006 Share Posted May 5, 2006 (edited) I have a few questions about using AutoIt to automate some internet explorer tasks. I've downloaded and am currently using DaleHohm's IE.au3 functions. However, I'm new to AutoIt (I just started yesterday, heh), and I'm having some trouble putting these to good use. Here, in plaintext, is what I'd like to do, and afterwards, I'll show you the code I've gotten so far: Open a new IE window to a URL (stored in a variable $url) and maximize it. Wait 3 seconds, or until the URL is loaded (whichever comes first, obviously) Put data (stored in variable $subject) into an input with the name of subject. Put data (stored in variable $info) into a text area with the name of info. Hit the submit button with the name of doSend. Here's what I've gotten so far. If there's better ways to do this, please let me know. Been pulling my hair out over it, heh. $oIE= _IECreate() _IENavigate($oIE, $url,0) _IEPropertySet($oIE, "left", -4) _IEPropertySet($oIE, "top", -4) _IEPropertySet($oIE, "height", 1002) _IEPropertySet($oIE, "width", 1288) _IELoadWaitTimeout(3000) I couldn't figure out how to interact with the named form/input elements on the webpage, sadly. Can anyone offer any tips? Thanks so much! Edited May 5, 2006 by Xealos Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 5, 2006 Moderators Share Posted May 5, 2006 See how far this gets you (you must have the latest IE.au3 and beta) #include <IE.au3> _IELoadWaitTimeout (3000) $oIE = _IECreate ($friendurl) $oHWND = _IEPropertyGet ($oIE, "hwnd") WinSetState($oHWND, "", @SW_MAXIMIZE) $oForm = _IEFormGetCollection ($oIE, 0); if its the only or first form $oSubject = _IEFormElementGetObjByName ($oForm, "subject") $oMessage = _IEFormElementGetObjByName ($oForm, "body") _IEFormElementSetValue ($oSubject, $subject) _IEFormElementSetValue ($oMessage, $message) Link to comment Share on other sites More sharing options...
Xealos Posted May 5, 2006 Author Share Posted May 5, 2006 Ahh, great. Thank you SO much! That code mostly worked. I messed up and didn't mention it was the second form on the page. I changed the 0 to a 1 in the FormElementGet function and it worked like a charm. Now, the last hurdle I need to clear is a way to send a click to the Submit button. I saw the _IEAction("click",) function... But what argument should I use for the Submit button? Or am I totally heading in the wrong direction? Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 5, 2006 Moderators Share Posted May 5, 2006 Ahh, great. Thank you SO much! That code mostly worked. I messed up and didn't mention it was the second form on the page. I changed the 0 to a 1 in the FormElementGet function and it worked like a charm. Now, the last hurdle I need to clear is a way to send a click to the Submit button. I saw the _IEAction("click",) function... But what argument should I use for the Submit button? Or am I totally heading in the wrong direction?Just use: _IEFormSubmit($oForm) Link to comment Share on other sites More sharing options...
Xealos Posted May 5, 2006 Author Share Posted May 5, 2006 Oops... My newbie-ness is showing... Thank you, big_daddy! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted May 5, 2006 Moderators Share Posted May 5, 2006 Oops... My newbie-ness is showing... Thank you, big_daddy!No problem, glad I could help. 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