Jump to content

How to restart a loop if there is an @error?


oemript
 Share

Recommended Posts

I would like to know on if error occur on "Local Do Loop", based on Continueloop function, would Local Do Loop continue without stop the Global Do Loop?

Does anyone have any suggestions?
Thanks in advance for any suggestions

Do
_Test()
If @error Then ContinueLoop
ConsoleWrite ( "Global Do Loop" )
until i = 1

Func _Test()
Do
  ... coding to return value of i ... 
; if error occur, would Local Do Loop continue without stop the Global Do Loop?
If @error Then ContinueLoop
ConsoleWrite ( "Local Do Loop" )
until i = 1
EndFunc

 

Edited by oemript
Link to comment
Share on other sites

  • Moderators

oemript,

That code makes no sense at all as all the 2 ContineLoop commands will do is to miss the relevant ConsoleWrite lines - and in fact the "outer" If @error  condition will never fire as you never set @error on the return from the "inner" function using SetError.

So how about explaining what you want to do in words - then we might be able to help.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

It also looks very much like your question about error handling in a loop in the other thread that you have been blowing up. Please stop multi-posting and give people a chance to actually respond and help you.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Is this being mederated ? 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

  • Moderators

@caramen neither Melba nor myself have indicated it is under moderation, so you are free to assist.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Once error occurs, I would like to know on whether Local loop (inner) would stop the Global loop (outer) or not.

Would any error occur within Local loop (inner) be independent from Global loop (outer)?

Does anyone have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

Link to comment
Share on other sites

  • Moderators

oemript,

There should be no interaction between the 2 loops unless you code it to happen - errors within the "inner" function will not be transmitted to the "outer" code unless you use Return SetError as I mentioned above. I am afraid I cannot be more specific without more details.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Referring to following coding, I would like to set a condition if Do loop last more than 3 minutes, then break Do Loop and ContinueLoop for next For loop, if not, Do Loop would run forever.

For example

1) Processing $x = 3

2) Running Do Loop more than 3 minutes

3) Exit Do Loop

4) Processing $x = 4

for $x = 1 to 5
   ...
   Do
       Sleep(250)
   Until $jsEval("RawSummary.totalVol") <> 0
   ...
Next

Does anyone have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

Edited by oemript
Link to comment
Share on other sites

  • Moderators
16 hours ago, oemript said:

Referring to following coding, I would like to set a condition if Do loop last more than 3 minutes, then break Do Loop and ContinueLoop for next For loop, if not, Do Loop would run forever.

In all of your threads, you keep saying this "I would like to..." by which you apparently mean "I want someone to do for me...", and have been warned by Jos multiple times now. Where is the effort? What have you tried on your own to accomplish this Loop?

***BTW in case you missed it, this is a Mod stepping into a thread***

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Developers

Seems you are getting a heck of a lot attention lately...  Just so you know: the same applies here as in the other thread: 

 

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

On 11/2/2018 at 6:28 AM, Danp2 said:

Use a timer. See TimerInit and TimerDiff in the help file.

Sleep(250)
       $jsEval = Execute('$oIE.Document.head.eval')
       if @error then
          MsgBox(64 + 262144, 'Title', 'Error')
       EndIf

Instead of using timer within do Loop, I would like to know on why Msgbox does not show up during error on Execute coding.

Do you have any suggestions on what wrong it is?
Thanks, to everyone very much for any suggestions (^v^)

 

Edited by oemript
Link to comment
Share on other sites

In order to figure out why that is, first of all, I need some tools to detect the error at the first place, such as following code not responding, how can I detect this situation to show Msgbox? On the other words, I need tools to figure out why that is.

$jsEval = Execute('$oIE.Document.head.eval')

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

Edited by oemript
Link to comment
Share on other sites

Why are you using Execute to try and evaluate an object reference?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

9 minutes ago, BrewManNH said:

Why are you using Execute to try and evaluate an object reference?

Using Execute is not key point, that is just an example, the key point is how to detect not responding situation, and I need tools to do that to show Msgbox at the first place.

Do you have any suggestions?
Thanks, to everyone very much for any suggestions (^v^)

 

Edited by oemript
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...