
Document is a global object accessible in the JScript document operation.
// create a duplicate
var dup = Document.Duplicate();
// modify the duplicate, for example:
// if the document is a raster image, make the first pixel gray
dup.RasterImage.SetPixel(0, 0, 0, 0, 0xff808080);
// save the modified document into C:\temp using original name
dup.SaveCopyAs("C:\\temp\\"+Document.Name);
// the original document remains unchanged