Page 1 of 1 1
Topic Options
#129146 - 2004-11-09 05:12 AM exit command
taylor Offline
Fresh Scripter

Registered: 2004-10-21
Posts: 9
Dear,
I saw "exit" command in many function,such as "exit 87","exit 1","exit(0)","exit 0" and so on. What difference between them? Thanks! :confused:

Top
#129147 - 2004-11-09 05:30 AM Re: exit command
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
The EXIT then number sets the errorlevel code to the given value. This value can then be checked by another script or process and further action taken depending on the result.

ie..

2=The system cannot find the file specified
5=Access is denied
20=The system cannot find the device specified

There has also been discussion on the board that relates to code that needs to have an EXIT some number otherwise it might not end properly. Not all code requires this to end the script though.

Top
#129148 - 2004-11-15 10:28 AM Re: exit command
taylor Offline
Fresh Scripter

Registered: 2004-10-21
Posts: 9
Thanks!Does anybody give me some information such as link about the exit command?
Top
#129149 - 2004-11-15 10:44 AM Re: exit command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, I see the documentation the best place for information:
http://www.kixtart.org/manual.html

for a quickie check, I like the manual index usable...
http://www.kixtart.org/manual_index.html

rather slow loading though...
_________________________
!

download KiXnet

Top
#129150 - 2004-11-16 01:07 PM Re: exit command
taylor Offline
Fresh Scripter

Registered: 2004-10-21
Posts: 9
Thanks,but I couldn't find the detail explain for exit command,such as exit 0, exit 1,exit 87 and so on.
Top
#129151 - 2004-11-16 01:17 PM Re: exit command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, sorry.
then I can not say much more than start learning how to use web.
http://www.scriptlogic.com/Kixtart/htmlhelp/Commands/exit.htm

that is in the manual index link I pointed to you and iirc, that is exactly what you asked.

_________________________
!

download KiXnet

Top
#129152 - 2004-11-16 01:20 PM Re: exit command
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
The number used is not special in any way. It is returned to the calling script or program, which can decide what to do depending on the number that you returned.

You might choose "1" to mean "Some sort of problem happened", "2" to mean "I cannot find the file", "5" to mean "I don't have permission to open the file" and so-on.

The only rule you should stick to is that zero means that there was no problem.

It is a good idea to try an use a number whose Windows/DOS error message has a similar meaning.

To display some of the standard error messages:
Code:
Break On
For $i = 0 to 9999
$=Execute("Exit "+$i)
If Not InStr(@SERROR,"(317 / 13D)")
@ERROR " : " @SERROR @CRLF
EndIf
Next



If you only ever want to determine whether an error occurred or not, you may simply stick to "0" for no error and "1" for error.

Top
#129153 - 2004-11-16 01:59 PM Re: exit command
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
additionally, the kixtart manual holds a list of error codes ...
_________________________



Top
#129154 - 2004-11-16 02:21 PM Re: exit command
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
IIRC it is only the older manuals (pre-4.20) that have the error codes, and they are the English language versions.

Printing them yourself will give you the installed language version, and makes searching for something appropriate much easier.

Here is a more useful example. When prompted, supply an error number to display or a string to search for a matching error:
Code:
Break ON
$=SetOption("WrapAtEOL","ON")
$=SetOption("ASCII","ON")

"Enter an error code / string or null to exit: " GetS $s
While $s
If CStr(Val($s))=CStr($s)
$=Execute("Exit "+$s)
@ERROR " : " @SERROR @CRLF
Else
$iLine=0
For $iError = 0 to 9999
$=Execute("Exit "+$iError)
If Not InStr(@SERROR,"(317 / 13D)")
If InStr(@SERROR,$s)
@ERROR " : " @SERROR @CRLF
$iLine=$iLine+1
If Not ($iLine MOD 20)
"Hit a key for next page or 'x' to exit search: " Get $k
Chr(13) " " Chr(13)
If $k="x" $iERROR=9999 EndIf
EndIf
EndIf
EndIf
Next
If Not $iLine "No error strings matched." @CRLF EndIf
EndIf
"Enter an error code / string or null to exit: " GetS $s
Loop

Exit 0


Top
#129155 - 2004-11-16 02:35 PM Re: exit command
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Ok, the manual after 4.20 holds an url that points to the correspondant msn page

Nice little helper script there Richard

[Edit: gets even better, can be used as pattern matcher ... fe. 'exit' returns 3 errors]


Edited by Jochen (2004-11-16 02:44 PM)
_________________________



Top
#129156 - 2004-11-18 11:03 AM Re: exit command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what you mean 3 errors?
_________________________
!

download KiXnet

Top
#129157 - 2004-11-18 12:03 PM Re: exit command
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
try entering 'exit'
_________________________



Top
#129158 - 2004-11-18 03:09 PM Re: exit command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
who is helpfull now?
_________________________
!

download KiXnet

Top
#129159 - 2004-11-18 03:28 PM Re: exit command
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Canada ?
_________________________



Top
#129160 - 2004-11-22 10:59 AM Re: exit command
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

try entering 'exit'




Entering exit? LOL

Top
#129161 - 2004-11-22 11:44 AM Re: exit command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
problem is, there is no exit to canada in Finland.
we can only exit to Norway (huge prices), Sweden (I'm straight, don't wanna go there...) and Russia (I bet I don't need to explain this one)...

so, can't consider entering exit an option.
_________________________
!

download KiXnet

Top
#129162 - 2004-11-23 02:38 AM Re: exit command
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Do what the Lemmings do, exit into the water and start swimming
_________________________
There are two types of vessels, submarines and targets.

Top
#129163 - 2004-11-23 02:57 AM Re: exit command
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... being a descendent of the Lemkos http://www.lemko.org my ancestors managed to EXIT.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#129164 - 2004-11-23 12:52 PM Re: exit command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Quote:

The Lemkos (Łemkowie), also referred to as Rusyns, Rusnakys or sometimes even Ukrainians




hmm...
_________________________
!

download KiXnet

Top
#129165 - 2004-11-23 12:53 PM Re: exit command
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
BLOODY UBB [censored].
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 1126 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.083 seconds in which 0.033 seconds were spent on a total of 12 queries. Zlib compression enabled.

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