JScript Configuration

Log-in or register.

JScript Configuration

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

This object allows building a simple user interface for scripted operations within the Configuration phase and read the values set by user in the Execution phase of the scripted operation.

Methods and properties

  • object GetValue(string id) - returns the value set by user. If the id parameter is a valid JavaScript identifier (only contains letters, numbers and _ and does not begin with number), it can be read directly as a property of the Configuration object (Configuration.id).
  • object GetValueOrDefault(string id, object defVal) - works similarly as GetValue, but instead of returning null when id is not defined, it returns defVal.
  • void SetValue(string id, object val) - changes the current value with id key. This method should be avoided.
  • int Columns (set) - set the preferred number of columns in configuration dialog. Deprecated in version 2013.1. In the new version, items are always in 1 column.
  • void AddStaticText(string text) - the text may contain <a> and <br> html markers. Adds text to the user interface.
  • void AddEditBox(string id, string name, string description, object initialValue, bool forceInitial=false) - adds a input box to the interface. The input box will accept numbers or strings depending on the type of the initialValue.
  • void AddSlider(string id, string name, string description, int minimum, int maximum, int initialValue, bool forceInitial=false) - adds a slider to the user interface.
  • void AddCheckBox(string id, string name, string description, bool initialValue, bool forceInitial=false) - adds a simple 2-state check box to the user interface.
  • void Add1ofNPicker(string id, string name, string description, Array options, int initialIndex, bool forceInitial=false) - adds a combo-box to the user interface. The options parameter must be an array of strings, which will be shown to the user. The actual value (and initialValue) is an 0-based index in the given array.
  • void AddColorButton(string id, string name, string description, int initialRGB, bool forceInitial=false) - adds a color-selection button to the user interface. The initialRGB is a 24-bit integer, where the red channel occupies the bits 0-7, green bits 8-15 and blue bits 16-23. The color values are in sRGB color space.
  • void AddFilePath(string id, string name, string description, string filter, string initialPath, bool forceInitial=false) - adds a disabled text box with a button to the user interface. The button is used by the user to select a file. The actual (and initial) value is a full path to the selected file. It can be accessed using the Application object.
  • void AddAlphaColorButton(string id, string name, string description, int initialARGB, bool forceInitial=false) - similar to AddColorButton, but the user can also select alpha values which then ocuppy bits 24-31.
  • variant SplitPreview - false to disable split preview function; true or a floating point number in range 0-1 to enable split preview and set initial value. The split preview allows user to view part of the image processed and the other part unprocessed. Added in version 2013.1.

The forceInitial parameter was added in version 2013.1 and it is an optional parameter and should not be used if not necessary. If it is set to true, it prevents the last used value to be remembered. That may be useful, if there is no sensible universal initial value and instead the initial value is computed at runtime (for example from the size of the actual image being processed).

Recent comments

user icon PAEz contributing user on October 29th 2013

If I have an Edit Box with an initial value of 1 and then when it pops up I change it to 0.5 when the script runs the value of Configuration.property will be 1.
I can set the initial value to 1.000001 then it will appear as 1 in the config popup but it will be 1.00000001...etc in the script.
Also if the initial value is 0.55 it will be in the script something like 0.5500000001...etc , thats not such a big prob, but not being able to have an initial int value and then change it to a float is a problem.

user icon Vlasta site administrator on October 30th 2013

Yes, it can cause problems. Even 1.0 is treated as int. I'll try to find a good solution for this. For now, one of the possible workaround is using "1" and then convert it to number in the Exe script. Or if the value has a meaningful range, using Slider with for example in 0 and 100 as minimum and maximum and divide the value by 100 in the Exe script.

The 0.55 to 0.5500000001 conversion is probably caused by float accuracy.

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