cypher175 Posted March 29, 2009 Share Posted March 29, 2009 is there anyway to restart a loop (While 1 - Wend) from the beginning if a function fails inside of that loop..?? Link to comment Share on other sites More sharing options...
GEOSoft Posted March 29, 2009 Share Posted March 29, 2009 is there anyway to restart a loop (While 1 - Wend) from the beginning if a function fails inside of that loop..??Depends on how your function is written. If it returns an error code then just use something like this While 1 _MyFunction() If @Error Then ContinueLoop Wend Func _MyFunction() If @UserName <> "XYZ" Then Return SetError(1) EndFunc George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
MHz Posted March 29, 2009 Share Posted March 29, 2009 is there anyway to restart a loop (While 1 - Wend) from the beginning if a function fails inside of that loop..??Continueloop Link to comment Share on other sites More sharing options...
Yashied Posted March 29, 2009 Share Posted March 29, 2009 (edited) Depends on how your function is written. If it returns an error code then just use something like this While 1 _MyFunction() If @Error Then ContinueLoop Wend Func _MyFunction() If @UserName <> "XYZ" Then Return SetError(1) EndFuncSmall addition. While 1 _MyFunction() If @Error Then ContinueLoop ExitLoop Wend Edited March 29, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
GEOSoft Posted March 29, 2009 Share Posted March 29, 2009 I didn't do that because he might have something else to do and he wants to keep checking until he gets a match. Besides the way I have it demonstrates the way continuous loops work. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
MHz Posted March 29, 2009 Share Posted March 29, 2009 Small addition. While 1 _MyFunction() If @Error Then ContinueLoop ExitLoop WendThat loop can not loop Link to comment Share on other sites More sharing options...
Yashied Posted March 29, 2009 Share Posted March 29, 2009 That loop can not loop ??? My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
MHz Posted March 29, 2009 Share Posted March 29, 2009 (edited) ??? You are right, I am testing your response or until the ExitLoop, Hmm Edited March 29, 2009 by MHz Link to comment Share on other sites More sharing options...
cypher175 Posted March 29, 2009 Author Share Posted March 29, 2009 it doesn't seem to work for my code, is it because its inside a (DO-UNTIL) Loop..?? While 1 Do Sleep(10000) _IEAction ($IE, "refresh") If @Error Then ContinueLoop ExitLoop _IELinkClickByText($IE, "LINK") Until Not @error Wend Link to comment Share on other sites More sharing options...
GEOSoft Posted March 29, 2009 Share Posted March 29, 2009 ??? I think he means it won't loop if there is no error and in that he's correct so there would be no reason to put the function call inside a loop George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted March 29, 2009 Share Posted March 29, 2009 (edited) it doesn't seem to work for my code, is it because its inside a (DO-UNTIL) Loop..?? While 1Do Sleep(10000) _IEAction ($IE, "refresh") If @Error Then ContinueLoop ExitLoop _IELinkClickByText($IE, "LINK")Until Not @errorWendSomebody confused you. Take that ExitLoop out of there.Edit: In your code youu only need the Do Until. Not the While 1 Wend Edited March 29, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
cypher175 Posted March 29, 2009 Author Share Posted March 29, 2009 i have other code in between the (While 1-Wend) loop before & after the (DO-UNTIL) loop, but if the _IEAction ($IE, "refresh") function fails inside the DO-UNTIL loop in need to restart the whole (While 1-Wend) loop again from the beginning.. Link to comment Share on other sites More sharing options...
GEOSoft Posted March 29, 2009 Share Posted March 29, 2009 Now we are getting to the meat and potatoes of the issue Use ContinueLoop 2 George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Yashied Posted March 29, 2009 Share Posted March 29, 2009 i have other code in between the (While 1-Wend) loop before & after the (DO-UNTIL) loop, but if the _IEAction ($IE, "refresh") function fails inside the DO-UNTIL loop in need to restart the whole (While 1-Wend) loop again from the beginning..Maybe you want to get following? While 1 ... While 1 Sleep(10000) _IEAction ($IE, "refresh") If Not @Error Then _IELinkClickByText($IE, "LINK") If Not @Error Then ExitLoop EndIf EndIf WEnd ... WEnd My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
cypher175 Posted March 29, 2009 Author Share Posted March 29, 2009 like this then or what..?? While 1 Do Sleep(10000) _IEAction ($IE, "refresh") If @Error Then ContinueLoop 2 _IELinkClickByText($IE, "LINK") Until Not @error Wend becuz i just tried that and got this error C:\Program Files\AutoIt3\Include\IE.au3 (2847) : ==> The requested action with this object has failed.: $o_object.document.execCommand("Refresh") $o_object.document^ ERROR >Exit code: 1 Time: 17.375 and it exited instead of continuing the script..?? Link to comment Share on other sites More sharing options...
GEOSoft Posted March 29, 2009 Share Posted March 29, 2009 Dale would have to verify this but I don't think you even have to handle an error check for the Refresh action. Just follow that line with an _IELoadWait call. Yashied also has a good method in his reply George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
cypher175 Posted March 29, 2009 Author Share Posted March 29, 2009 huh, what are you asking me..?? Link to comment Share on other sites More sharing options...
cypher175 Posted March 29, 2009 Author Share Posted March 29, 2009 well if the browser window is closed when it goes to refreshed then the script exits.. so how to detect if refresh failed becuase the browser window is absent and then to restart the While 1-Wend loop from the beginning again..?? Link to comment Share on other sites More sharing options...
cypher175 Posted March 29, 2009 Author Share Posted March 29, 2009 anybody know how to restart the whole while 1 loop if the _IEAction ($IE, "refresh") fails becuz the browser window has been closed..?? Link to comment Share on other sites More sharing options...
cypher175 Posted March 29, 2009 Author Share Posted March 29, 2009 nobody knows or what..?? 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