Page 1 of 1 1
Topic Options
#185388 - 2008-02-15 01:08 AM Error Handling and Resume
Eugene_SSD Offline
Just in Town

Registered: 2008-02-15
Posts: 1
I have searched to no avail for a way to continue a KIX script after an error is encountered. I'm looking to do in KIX what you can do in VBS: "ON ERROR RESUME NEXT".

I'm hoping someone here knows of a way to do this.

Top
#185389 - 2008-02-15 02:06 AM Re: Error Handling and Resume [Re: Eugene_SSD]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No such thing in KiX. If you can't write code that doesn't error, use VBS.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#185392 - 2008-02-15 03:50 AM Re: Error Handling and Resume [Re: Eugene_SSD]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Hello Eugene and Welcome to the board.

As Les pointed out KiXtart does not have that feature. Though thousands of users are coding with it just fine. Though it is possible to encounter an error that you just were not aware of, in most cases your coding itself can be the cause.

If you want please let us know what your trying to code or post your current code and we can assist you in possibly making it work without errors.

Top
#185395 - 2008-02-15 08:56 AM Re: Error Handling and Resume [Re: NTDOC]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Yep Eugene,
No "On Error Resume next".
As this is the advanced scripting forum, I presume you wanted to show us your script?

Top
#185398 - 2008-02-15 09:23 AM Re: Error Handling and Resume [Re: Witto]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
What code are you trying to execute that you think requires a "on error resume next"?

KiXtart basically runs in this kind of mode by default, i.e. if an object returns an error the script will not stop but will continue to process so that you can handle the error in code.

Other than a few very rare situations KiXtart will only stop if you have made a coding error.

If you think you really need the feature, post some example code that demonstrates the problem and we will offer some advice.

Top
#191820 - 2009-01-16 11:41 AM Re: Error Handling and Resume [Re: Richard H.]
Duvander Offline
Fresh Scripter

Registered: 2005-11-07
Posts: 27
Hi.
I have i simular question as the threadstarter had almost a year ago.

If I'm using a master script to call several scripts something like:
 Code:
IF INGROUP("AA")
   CALL "SlaveScript1.kix"
ENDIF
IF INGROUP("BB")
   CALL "SlaveScript2.kix"
ENDIF
  

So if SlaveScript1.kix crashes the masterscripts also stops. Is it possible start SlaveScripts so if one script crashes it continues with the next one.

/Duvander

Top
#191821 - 2009-01-16 11:53 AM Re: Error Handling and Resume [Re: Duvander]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Sure.
You could define an empty variable at the top of the master script that gets set if the slave script ends normal and off course not set if it crashes. Do a check on the content of the variable and decide to run the next script or not.

This is just one example. I’m sure that there are more options to get this going.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#191822 - 2009-01-16 11:56 AM Re: Error Handling and Resume [Re: Mart]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
No I don't think it is possible. Once the script engine dies ALL the scripts die.

You might be able to spawn other kixtart engines and run other scripts.

Top
#191824 - 2009-01-16 12:06 PM Re: Error Handling and Resume [Re: NTDOC]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Woops my bad. Doc is right.
If you shell out to an extra kix32/wkix32 session it might work.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#191825 - 2009-01-16 12:11 PM Re: Error Handling and Resume [Re: NTDOC]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Doc's correct.

If you get an abend in a script then the interpreter will exit - even if you have specified multiple scripts on the command lines the interpreter will not run those after the failed script.

If you need to manage a script that might exit abnormally you will need to use SHELL to run it under a new instance of the kix32 interpreter. You can communicate the status back by writing to a registry key or checking @ERROR when the script completes.

You can pass non-object variables to the spawned script on the command line if they are small enough, otherwise via an INI file or the registry.

Top
#191847 - 2009-01-20 06:02 AM Re: Error Handling and Resume [Re: Richard H.]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
For what it's worth, I run up to 50 child "threads" - a master Kix script calls (via RUN) other kix scripts. The child threads run until completion or failure without affecting the master script. In fact, there are times I process hundreds of child tasks, launching 50 and then monitoring the number of Kix processes. When the number drops below 35, I start 15 more until there's no more processing to be done.

I believe Shawn's taken that concept and implemented it as well. By design, 40 or more Kix scripts can achieve 100% processor load, but I can process 4-500 event logs in 90 minutes that way instead of taking hours.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.051 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org