JScript Operation
From RealWorld Wiki
RealWorld scripting reference
The Operation global object allows execution of any operation from a script.
[edit] Methods and properties
- object Create(string name) - obtains an objects with configuration for the specified operation. Name can be either a GUID or the English name of the operation.
- void Execute(object configuration, object document) - executes an operation on a document.
[edit] 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 no contain invalid characters (from the JavaScript point of view).
[edit] 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);