logikal16 Posted June 10, 2005 Share Posted June 10, 2005 Hey guys!Let me get started... all I want to do is load a page, such as mail.yahoo.com. The instant this page finishes loading data, It will enter my username and password and submit it. The way I currently have it is so that the script Sleep()s for a couple seconds before entering the user information, but it doesn't work depending on the user's connection.So far I have something like this:Run("C:\Program Files\Internet Explorer\iexplore.exe")Sleep(5000) ;<---wait until browser loads upSend("{ESC}") ;<---stop loading any startup pageSend("!d") ;<---goto the address barSend("http://mail.yahoo.com")Send("{ENTER}")Sleep(10000) ;<---THIS IS MY QUESTIONHow do I go about replacing Sleep(10000) to detecting when the browser actually finishes loading? Sorry, I'm new at this... Thanks in advance. Link to comment Share on other sites More sharing options...
scriptkitty Posted June 10, 2005 Share Posted June 10, 2005 (edited) if you want to try out the new beta, there is a ton of stuff you can do, including full form manipulation.$obj.ready tells if it is doneexpandcollapse popup$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $obj = _IE_connect("http://mail.yahoo.com") $obj.document.login_form.login.value = "name" $obj.document.login_form.passwd.value = "password" $obj.document.login_form.submit.click() Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Description is: " & $oMyError.description & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Source: " & $oMyError.source & @CRLF & _ "Scriptline: " & $oMyError.scriptline & @CRLF & _ "Windescription is: " & $oMyError.windescription ,5) Endfunc Func _IE_connect($url = "www.autoitscript.com") Dim $ObjShell = ObjCreate ("Shell.Application") Dim $ObjShellWindows = $ObjShell.Windows (); collection of all ShellWindows (IE and File Explorer) Global $ObjIE For $Window in $ObjShellWindows If StringInStr($window.LocationURL, $url) > 0 Then $ObjIE = $Window ExitLoop; We found it... Else $ObjIE = 0 EndIf Next If isObj ($ObjIE) Then ConsoleWrite("--> $ObjIE now points to an IE Instance connected" & @CR) Else $ObjIE = ObjCreate ("InternetExplorer.Application") With $ObjIE .Visible = True .Navigate ($url) Do Sleep(50) Until .ReadyState = 4 EndWith ConsoleWrite("--> No IE instance was found connected so made one" & @CR) EndIf Return $ObjIE EndFunc ;==>_IE_connectalso check outhttp://www.autoitscript.com/forum/index.php?showtopic=12030you can also wait for the statusbar text to say Done, or I like to change the title, and wait for the page to change to the new title.For full control you will want the features included only in the current beta atm. Edited June 10, 2005 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
logikal16 Posted June 10, 2005 Author Share Posted June 10, 2005 Wow, that was pretty fast... Let me look at it for a minute and see if it makes sense... thanks Link to comment Share on other sites More sharing options...
GaryFrost Posted June 10, 2005 Share Posted June 10, 2005 You'll need the beta version of AutoIt for that. SciTE for AutoItDirections for Submitting Standard UDFs  Don't argue with an idiot; people watching may not be able to tell the difference.  Link to comment Share on other sites More sharing options...
scriptkitty Posted June 10, 2005 Share Posted June 10, 2005 (edited) if you don't want to use the new beta (which I am pushing a bit too much,): Run('C:\Program Files\Internet Explorer\iexplore.exe "http://mail.yahoo.com"') ; enter your name and pass. winwait("Yahoo","Done") WinSetTitle("Yahoo", "", "Waiting for page") Send("{ENTER}") winwait("Yahoo","Done"); set to the title that should come up. ; rest of code Edited June 10, 2005 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
logikal16 Posted June 10, 2005 Author Share Posted June 10, 2005 Holy jeez, the posts keep coming... and right when i was about to reply to the 1st reply Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 10, 2005 Share Posted June 10, 2005 if you don't want to use the new beta (which I am pushing a bit too much,):Run('C:\Program Files\Internet Explorer\iexplore.exe "http://mail.yahoo.com"') ; enter your name and pass. winwait("Yahoo","Done") WinSetTitle("Yahoo", "", "Waiting for page") Send("{ENTER}") winwait("Yahoo","Done"); set to the title that should come up. ; rest of code<{POST_SNAPBACK}>LOL I dont think you are pushing it too much. Once I went to beta I have never gone back. The onlything I dont like about the beta installer is I cant tell it to just install as if it wasnt beta. I dont get the choice where it installs to. (Maybe a dev will see this )JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
logikal16 Posted June 10, 2005 Author Share Posted June 10, 2005 (edited) LOL I dont think you are pushing it too much. Once I went to beta I have never gone back. The onlything I dont like about the beta installer is I cant tell it to just install as if it wasnt beta. I dont get the choice where it installs to. (Maybe a dev will see this )JS<{POST_SNAPBACK}>OK, why do you have 2 instances of winwait("Yahoo","Done") ?And also, hypothetically... let's say that if you enter the Yahoo login correctly, It opens up a new window with the address of Google. How would the code be different? (assuming that the script continued after the Google page loaded entirely) Edited June 10, 2005 by logikal16 Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 10, 2005 Share Posted June 10, 2005 OK, why do you have 2 instances of winwait("Yahoo","Done") ?And also, hypothetically... let's say that if you enter the Yahoo login correctly, It opens up a new window with the address of Google. How would the code be different? (assuming that the script continued after the Google page loaded entirely)<{POST_SNAPBACK}>The second one is to simulate after you put in your username and password (before the Send('{ENTER}'))JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
scriptkitty Posted June 10, 2005 Share Posted June 10, 2005 (edited) I put in two waits because first you wait for the yahoo sign in page to load, then you fill out the form and then you change the page title, and submit. next you wait for the logged in page to load up fully. With the beta code the form is instantly filled and if you really want to show off, you can do it all hidden, minimised, etc. , or you don't actually have to wait for useless pictures, just for the html to load (form.) I just put in my generic IEobj function (a lot of borrowedcode, because DaleHohm did a nice job.) It can be done with a lot fewer lines, but this way you can see how to also connect to an exhisting window besides creating a new one. but actually it should be in this order: Run('C:\Program Files\Internet Explorer\iexplore.exe "http://mail.yahoo.com"') winwait("Yahoo","Done") WinSetTitle("Yahoo", "", "Waiting for page") ; enter your name and pass. Send("{ENTER}") winwait("Yahoo","Done"); set to the title that should come up. ; rest of code Edited June 10, 2005 by scriptkitty AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
logikal16 Posted June 10, 2005 Author Share Posted June 10, 2005 cool, thanks for your help guys Link to comment Share on other sites More sharing options...
scriptkitty Posted June 10, 2005 Share Posted June 10, 2005 on a side note: JSThePatriot $var = RegRead("HKEY_CLASSES_ROOT\Applications\AutoIt3.exe\shell\Open\Command", "") $path=stringleft($var,Stringinstr($var,"\",0,-1)) msgbox(1,"copy",$path & "beta\*.* " & $path) AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 10, 2005 Share Posted June 10, 2005 LOL Nice. It isnt an issue, but just would be nice. It would save me from doing that or just cutting and pasting over everytime JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008Â Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
scriptkitty Posted June 10, 2005 Share Posted June 10, 2005 Yea, I got a script to copy over all my icons and other includes that get written over with a similar script. AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
herewasplato Posted June 11, 2005 Share Posted June 11, 2005 (edited) ...you don't actually have to wait for useless pictures, just for the html to load (form.)...<{POST_SNAPBACK}>The methods available in the beta version are probably better/faster... but the code below is just part of what I use and it does not wait for the entire page to load:; ; code to start IE and go to the yahoo ; While 1 Send("{TAB}") If WinExists("Microsoft Internet Explorer", "ssl_lib") Then Send("+{TAB 4}") ExitLoop EndIf Sleep(50) WEnd WinWait("Microsoft Internet Explorer", "") WinActivate("Microsoft Internet Explorer", "") WinWaitActive("Microsoft Internet Explorer", "") Send($account) Sleep(20) Send("{TAB}") Sleep(20) Send($passwd) Sleep(20) Send("{ENTER}")However, if yahoo changes that form, you might have to adjust the code.logikal16,Did you get your "Google" question answered? I'm not sure that I understand what you wanted. You asked, "And also, hypothetically... let's say that if you enter the Yahoo login correctly, It opens up a new window with the address of Google. How would the code be different? (assuming that the script continued after the Google page loaded entirely)"edited: typo Edited June 13, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
logikal16 Posted June 12, 2005 Author Share Posted June 12, 2005 yeah i got it figured out... sorry it was kind of badly phrased :-\ 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