Jump to content

Exit(0) does nothing besides closing the program


Recommended Posts

Greetings,

As determined here, by way of a remote execution deployment solution, I have determined the following:

1. Normal execution of compiled exe sends no notification that the program has completed

2. Failed execution of compiled exe sends Exit Code 1 and is read properly by Windows

3. use of Exit sends no notification

4. use of Exit(0) sends no notification

5. use of Exit(1) sends Exit Code 1 (see #2)

The Help File lists claims the following:

(optional) Integer that sets the script's return code. This code can be used by Windows or the DOS variable %ERRORLEVEL%. The default is 0. Scripts normally set an errorlevel of 0 if the script executed properly; error levels 1 and above typically indicate that the script did not execute properly.

Remarks

The parameter, if included, can be enclosed in parentheses. Thus, the following are equivalent: Exit, Exit 0, and Exit(0). However, Exit() is invalid.

The code can be retrieved in a Func OnAutoItExit() by @EXITCODE.

By using a debug MsgBox, I have determined the following:

1. if contains Exit(1), @EXITCODE = 1

2. if contains Exit(0), @EXITCODE = 0

--- There was an instance within the help file that also stated that if the app gets an Exit Code of 0, then it "does nothing". I am looking for that section now but I can't seem to find it.

Link to comment
Share on other sites

Greetings,

As determined here, by way of a remote execution deployment solution, I have determined the following:

1. Normal execution of compiled exe sends no notification that the program has completed

2. Failed execution of compiled exe sends Exit Code 1 and is read properly by Windows

3. use of Exit sends no notification

4. use of Exit(0) sends no notification

5. use of Exit(1) sends Exit Code 1 (see #2)

The Help File lists claims the following:

By using a debug MsgBox, I have determined the following:

1. if contains Exit(1), @EXITCODE = 1

2. if contains Exit(0), @EXITCODE = 0

--- There was an instance within the help file that also stated that if the app gets an Exit Code of 0, then it "does nothing". I am looking for that section now but I can't seem to find it.

If you use SciTe you may see in console: "AutoIT3.exe ended.rc:0". If you would use Exit(2) then it will say "AutoIT3.exe ended.rc:2" colored red. So, if a batch program would call your program and your program exits with Exit(2) then batch program may say "The Program.EXE ended with exit code 2!". Also, if you call another program from your script, you may read its exit code and then see if it is closed properly or whatever program autors made some exit code for. Generally, exit code 0 means that is all OK (that happens when you call Exit or Exit(0)), code 1 means warning and code 2 means error. Got it?

I can do signature me.

Link to comment
Share on other sites

Figured this out in another topic: The return code from Exit (1234567) will show up correctly in %ERRORLEVEL% inside a batch file, but not when running commands by typing at the console.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...