JScript Operation

Log-in or register.

JScript Operation

The Operation global object allows execution of any operation from a script.

Methods and properties

  • object Create(string name) - obtain an object with configuration for the specified operation. Name can be either a GUID or the English name of an operation.
  • void Execute(object configuration, object document, object context) - executes an operation on a document. The context parameter is optional.

Configuration methods

The object returned by the GetConfiguration method has the following methods and properties.

  • void SetParameter(string ID, variant value) - sets the parameter identified by ID to given value if possible.
  • variant GetParameter(string ID) - retrieves the current value of the parameter identified by ID.
  • variant <parameter ID> (get/set) - a simplified version of the SetParameter and GetParameter methods. This only works for IDs that do not contain any invalid characters (from the JavaScript point of view => no backslashes, etc.).

Example

// create configuration object for the colorize operation
var colorize = Operation.Create("Raster Image - Colorize");
// set parameters of the Colorize operation
colorize.SetParameter("Hue", 120);
colorize.Saturation = 0.3; // the simplified way of setting properties
// execute the operation on the main document
Operation.Execute(colorize, Document);
// resample current image to fit desktop (warning: aspect ratio may change)
var resample = Operation.Create("Raster Image - Resample");
resample.Mode = 1;
resample.SizeXAbs = Blender.DesktopSizeX;
resample.SizeYAbs = Blender.DesktopSizeY;
Operation.Execute(resample, Document);

Recent comments

user icon Anonymous
I wish there were...
What about ICL files?