Unicornasaurus Posted February 17, 2012 Share Posted February 17, 2012 (edited) Hey Guys! Just started using AutoIt recently, and am having a blast making small projects here and there. I've run in to an issue though with my latest project. Basically what it does is logs in to a form and submits some text. I'll outline when the project fails: Instance 1: Go To Login Page -> Type in Login Information -> hit submit -> Message pops up that user already has session -> Press enter -> Wait for "Menu" window to pop up -> Close "Menu" window -> Redirect main browser to new page and enter more text Now, Instance 2: (This is where it fails) Go To Login Page -> Type in Login Information -> hit submit -> Wait for "Menu" window to pop up..... For some reason, even though the "Main Menu" window is titled exactly the same, the script only proceeds when the message about an existing session pops up. I've used WinList() to output all of the window titles to a text file, and then compared the two "Main Menu" windows and the only thing that's different between them is the handle, otherwise the titles are identical. Here's the code that I have that it's stalling on: WinWaitActive("Logon - Windows Internet Explorer") WinActivate("Logon - Windows Internet Explorer") Send(GuiCtrlRead($txtUsername) & "{TAB}" & GuiCtrlRead($txtPassword) & "{TAB}{ENTER}") WinWaitActive("Windows Internet Explorer","There is active session for user",7000) If WinActive("Windows Internet Explorer","There is active session for user") then Send("{ENTER}") EndIf WinWait("Main Menu","") WinClose("Main Menu") _IENavigate($newpage) Edited February 17, 2012 by Unicornasaurus Link to comment Share on other sites More sharing options...
DW1 Posted February 18, 2012 Share Posted February 18, 2012 Hi Unicornasaurus, Welcome to the forums. When you are calling WinWaitActive() for the active session, you are giving that a timeout of 7000. This is in seconds, not milliseconds. So the script would probably continue if you were willing to wait the roughly 2 hours you told it to wait You probably meant for it to only wait 7 seconds. Making that minor change will probably fix the issue. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Unicornasaurus Posted February 18, 2012 Author Share Posted February 18, 2012 Hi Unicornasaurus,Welcome to the forums.When you are calling WinWaitActive() for the active session, you are giving that a timeout of 7000. This is in seconds, not milliseconds. So the script would probably continue if you were willing to wait the roughly 2 hours you told it to wait You probably meant for it to only wait 7 seconds. Making that minor change will probably fix the issue.Oh man. What a facepalm moment. I can't believe I overlooked that! Thank you! I'm so used to measuring in milliseconds.Case closed! Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 18, 2012 Share Posted February 18, 2012 Though this is resolved, isn't there some sort of Forum Rule about automating logins on websites? Or helping others break said rules? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
DW1 Posted February 18, 2012 Share Posted February 18, 2012 Though this is resolved, isn't there some sort of Forum Rule about automating logins on websites? Or helping others break said rules?Oh shoot... you are correct. In my Friday mind frame, I just saw a post with 0 replies and an easy fix.Sorry about that AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Valik Posted February 18, 2012 Share Posted February 18, 2012 Meh. Such a crude method that I don't even feel like deleting the code. Thread locked though. Link to comment Share on other sites More sharing options...
Recommended Posts