Digita World

Home Digita
Scripting
Digita
Desktop
Digita
Applications
Other
Files
Links

Digita Script Tutorials - Checking the Error Status

In DigitaScript, there is a big difference between a syntax error and a status error. A syntax error is an error in the structure of your script that causes it to run poorly or not at all, usually the later. A status error occurs when a DigitaScript command fails to execute properly. Status errors do not cause the camera to post an error message, and will not cause the script to crash.

For example, if your script tries to capture an image and is unsuccessful, the script will continue running as if the image had been captured. There is, however, an easy way to check if the commands in your script were processed successfully.

Every DigitaScript command statement returns an error status when it is processed. Successful commands return an error status of 0. Unsuccessful commands return a positive or negative integer indicating the reason for failure. You can find a listing of the error codes returned by DigitaScript commands in the Script Reference.

To access the returned status code, the command statement needs to be called as part of a variable assignment. For example, the following lines of script attempt to capture an image. If the StartCapture command is successful, the value of the 'status' variable is set to 0.

declare i: status
status = 0
status = StartCapture ()

Note that the variable 'status' has been declared as a signed integer. Error codes returned by DigitaScript commands can be positive or negative, so the variable receiving the error code should always be declared as a signed integer.

Script commands that fail to execute properly return an error value promptly. Some commands however, don't have the opportunity to return a successful value before the next line of script is processed. Therefore, it's a good practice to assign your status variable a value of 0 before using it. That way, it won't be necessary for a successful value to be returned.

To next tutorial
Back to tutorial page


Last modified January 24, 2003          Copyright 2001, Chuck Gadd

Digita, Digita Desktop, DigitaPhoto.com, and DigitaDev.com are trademarks of FlashPoint Technology, Inc.