System.Debug.outputString Method

Writes a string to the console.

Syntax

System.Debug.outputString(
  strOutputString
)

Parameters

strOutputString [in]
BSTR

Sets String to write to the console.

Return Value

This method does not return a value.

Remarks

Useful for sending variable values, gadget state, or function names to the console for debugging.

The value of strOutputString can only be viewed with a script debugger while the gadget is running.

Examples

The following example demonstrates how to throw an error and use outputString to display it in a debugger console.

// --------------------------------------------------------------------
// Attempt to save the file and throw an error if the filename does 
// not include a file extension.
// --------------------------------------------------------------------
function SaveFile()
{
    var fso = new ActiveXObject( "Scripting.FileSystemObject" );
    // Throw an arbitrary error to demonstrate the outputString method.
    try
    {
        if (sFilename.indexOf(".") == -1)
        {            
            throw "'Filename' does not specify a file extension.";
        }
        var file = 
            fso.OpenTextFile(sFilePath + sFilename, 
            FOR_WRITING, CREATE_NEW);
        file.Write(sContent);
        file.Close();
        fso = file = null;
    }
    catch(e)
    {
        System.Debug.outputString(e);
    }
}

Requirements

Minimum supported clientWindows Vista
Minimum supported serverWindows Server 2008
IDLSidebar.idl
DLLSidebar.Exe version 1.00 or later

See Also

System.Debug

 

 

Send comments about this topic to Microsoft

Build date: 2/24/2010

Build type: SDK

Community Additions

Show: