ErrorMsg


The ErrorMsg function writes formatted text to the Errors pane of the Script Editor window that launched the script. If the script was not launched from a Script Editor window, the text is written to a Text Editor window. This function provides functionality like the printf function in the C language.

Syntax

bSuccess = ErrorMsg( sFmt, ... )

where

    sFmt is a format string.

    ... refers to an optional list of arguments.

    On success, this method returns true.

    On failure, this method returns false.

  

ErrorMsg takes 1 or more arguments. The first argument is a string that may be either the value to print or a format to be used for interpreting any additional arguments. Additional arguments provide values for the % fields embedded in the format string. The syntax of this function is compatible with the printf function in C; for details about specifying the format string, refer to documentation for printf in the C or C++ language.

Example

The script below writes a formatted error message to the Script Errors pane:

ErrorMsg("Bad value in '%s': val=%lg\n", sName, n ))

 

Related Topics

Printf

Wprintf

CFile:Printf

Sprintf