Share via


System.Debug.outputString method

[The Windows Gadget Platform/Sidebar is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. ]

Writes a string to the console.

Syntax

System.Debug.outputString(
  strOutputString
)

Parameters

strOutputString [in]

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 file name does 
// not include a file name extension.
// --------------------------------------------------------------------
function SaveFile()
{
    var fso = new ActiveXObject( "Scripting.FileSystemObject" );
    // Throw an arbitrary error to demonstrate the outputString method.
    try
    {
        if (sFilename.indexOf(".") == -1)
        {            
            throw "'File name' does not specify a file name 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 client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
End of client support
Windows 7
End of server support
Windows Server 2008
IDL
Sidebar.idl
DLL
Sidebar.Exe (version 1.00 or later)

See also

System.Debug