ThomasQ Posted August 13, 2009 Share Posted August 13, 2009 Hi! I have this script, based on a loop. Sometimes, the webpage I get info off with the script loads to long, or sometimes it does not even load at all.. Is there some way to let the script restart the step when it errors, or move to another part of the script entirely? Thanks in advance! Link to comment Share on other sites More sharing options...
JScript Posted August 13, 2009 Share Posted August 13, 2009 Hi!I have this script, based on a loop. Sometimes, the webpage I get info off with the script loads to long, or sometimes it does not even load at all.. Is there some way to let the script restart the step when it errors, or move to another part of the script entirely?Thanks in advance!If you can show your script file, maybe be easier to solve what you want. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Pandemic Posted August 13, 2009 Share Posted August 13, 2009 If you can show your script file, maybe be easier to solve what you want.Qft.There are two ways that I can think of off the top of my head:1. You could check a certain spot on the webpage, and see if it has the color pixel that it would have if it's loaded.2. (Using IE) You can mess around with the IE functions that AutoIT has built in, and see if one of those has what you need. <disclaimer> I don't use IE, so I have no clue if this'll be what you need, however </disclaimer>But again, seeing your code would be helpful.-Pandemic Link to comment Share on other sites More sharing options...
ThomasQ Posted August 13, 2009 Author Share Posted August 13, 2009 Thanks for the pixel check! I may just try it ou.. I've been searching myself as well. My guess was that there are a sort of error management functions built in Autoit. Link to comment Share on other sites More sharing options...
eagle4life69 Posted August 13, 2009 Share Posted August 13, 2009 Here is something I did to check to see if my program has logged in... Do Sleep(1000) If Not WinActive("Operator View - Mozilla Firefox","") Then Sleep(1000) Send("^l") Sleep(500) Send("^v{ENTER}") Sleep(1500) WinWaitActive("Mozilla Firefox","",5) If WinActive("Mozilla Firefox","") Then Send($username & "{tab}" & $password & "{tab 2}{space}") EndIf Sleep(1500) EndIf Until WinActive("Operator View - Mozilla Firefox","") Now this is very simple but it repeats all the steps until the correct page is loaded. It does require the page name to be different but normally different pages are different. Let me know if this has helped Link to comment Share on other sites More sharing options...
ThomasQ Posted August 13, 2009 Author Share Posted August 13, 2009 (edited) Great thanks! I've improved my script with: _IELoadWait ($oIE), after each load period, works like a charm! WinActive command is also quite usefull, since I use Excel & IE.. I was wondering, for example with _IEFormELementGetObjByName command, how do I return the @error code? If I could return the erro code, i'll just check it each time if it isn't 0 (succes=no error), and if it is something else, I'll exit the loop.. Anyone any idea? Edited August 13, 2009 by ThomasQ Link to comment Share on other sites More sharing options...
ThomasQ Posted August 13, 2009 Author Share Posted August 13, 2009 After each command, with a possibilty to fail you can use this: If @error <> 0 Then Whateveryouwanttodo Endif In My case If @error <> 0 Then ExitLoop Endif whereafter it exits the loop, and continues after the loop, wich is basicly a reset combo, and then it starts up again.. Thanks for the help/ideas, good luck with your scripts! 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