16.01.2013 Views

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Ipswitch</strong> <strong>WhatsUp</strong> <strong>Gold</strong> <strong>User</strong> <strong>Guide</strong><br />

Using the Context object with Actions<br />

The context object provides an interface for your script to interact with <strong>WhatsUp</strong> <strong>Gold</strong>.<br />

All methods and properties are retrieved using the Context namespace.<br />

Note: You may need to remove the copyright information from the cut and paste if it<br />

appears when you copy from this help file.<br />

Method Method description<br />

LogMessage(sText); This methods allows for a message to be written to the <strong>WhatsUp</strong><br />

<strong>Gold</strong> debug log. Messages are displayed in the Event Viewer.<br />

SetResult(LONG nCode,<br />

sText);<br />

Example<br />

JScript<br />

Context.LogMessage( "Checking action name using<br />

Context.GetProperty()");<br />

VBScript<br />

Context.LogMessage "Checking Address using Context.GetProperty()"<br />

This method allows for a result code and result message to be set.<br />

This is how you can tell the <strong>WhatsUp</strong> <strong>Gold</strong> system if the action<br />

succeeded or failed.<br />

Example<br />

JScript<br />

Context.SetResult(0, "Script completed successfully.");<br />

//Success<br />

Context.SetResult(1, "An error occurred."); //Failure<br />

VBScript<br />

Context.SetResult 1, "An error occurred."<br />

937

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!