Here is my code for taking a screenshot. Its in C# but that will run in a Jscript project (or pretty easy to convert).
It will screenshot the entire desktop if you just call it without any parameters (ie takeScreenshoot();) or you can pass in any reference to a mapped object etc to have it screenshot just that. It will also log a message before it places the screenshot in the log. The syntax actually came from the help files somewhere (cant remember where - I dont think it was on the pages about logging or taking screenshots)
function takeScreenshot(objectToScreenshot)
{
if(objectToScreenshot==null)
{
Log["Checkpoint"]("Taking a screenshot of the entire desktop")
Sys["Clipboard"] = Sys["Desktop"]["Picture"]();
Log["Picture"](Sys["Clipboard"]);
}
else
{
Log["Message"]("Taking a picture of " + objectToScreenshot)
Log["Picture"](objectToScreenshot);
}
}