JScript Document

Log-in or register.

JScript Document

Document is a global object accessible in the JScript document operation.

Methods and properties

  • string Location (get/set) - the full path to the file.
  • string Name (get/set) - modifies the name and extension of a document.
  • void Save() - saves the document if the Location field is valid (see storage plug-ins).
  • void SaveCopyAs(string location) - saves the document to given location. The location of the document remains unchanged.
  • object Duplicate() - returns duplicate of the document. Changes made to the duplicate will not affect the original and the same applies for the opposite direction. Location of the duplicate is invalid.
  • bool SupportsFeature(string interface name) - returns true if the documents supports the type-specific interface in question. (supported since version 2009.1)
  • object <interface name> (get) - obtain type-specific interface. The interfaces available depend on the actual document and on installed interface wrapper plug-ins.

Interface wrappers

  • RasterImage - modify raster images pixel by pixel and set canvas size.
  • EXIF - access EXIF tags.
  • Palette - read and modify palette of indexed images.
  • Icon - add, delete or modify images in icons. Change icon file type.
  • Text - modify text.
  • Resources - modify resources in Win32 PE files. Currently, only icon libraries are supported.
  • LayeredImage - access and modify layers in a layered image.
  • RenderedImage - work with snapshots in a rendered image.
  • Animation - access frames of an animation.
  • VectorImage - modify elements in a vector image.

Example

// 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

Recent comments

user icon Anonymous
Select background
I wish there were...