Printf


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

Syntax

bSuccess = Printf( sFmt, ... )

where

    sFmt is a format string.

    ... refers to an optional list of arguments.

    bSuccess is an optional success flag. On success, this method returns true. On failure, false is returned.

  

Printf 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 formatted text to the Script Messages pane:

s = "My string"

-- string to print

n = 12.553

-- value to print

Printf("'%s': v=%-12lg\n", s, n/2.1 ))

-- do a formatted print

Related Topics

ErrorMsg

Wprintf

CFile:Printf

CTextView:Printf

Sprintf