What are Scriptlets and how do I work with them?

1. Introduction and possibilities

Scriptlets are small extensions of the Vision/Stages program. You can write your own extensions that will appear in the program as menu items under "Scriptlets".

Scriptlets offer these possibilities:

  • read EXIF data
  • change duration and position of an object
  • modify movement path and panning
  • load and apply design templates
  • Is anything missing? Just ask us!

2. How to implement Scriptlets?

For Scriptlets to become visible as a menu item, they can be stored in the following folders:

  • %appdata%\AquaSoft\Vision14\Scriptlets\ - Scriptlets for the current user
  • c:\ProgramData\AquaSoft\Vision14\Scriptlets\ - Scriptlets stored here, are visible to all users of the same computer

Create a file with the extension .sss (e.g. "MyScript.sss") in one of the mentioned folders and restart program. Only then the menu item appears. If the folder does not exist, create it yourself.

3. How to edit Scriptlets?

To edit, use the integrated development environment, that can be opened via Workspace / Panels / Scripting IDE, in case the Developer mode is activated. Here you can write scripts, check for syntax errors, but also debug the execution with breakpoints, stepping and monitoring values.

4. Sample: Arrange tracks one below the other

This Scriptlet arranges all objects within the selected chapter one below the other. Save this code here to try: %appdata%\AquaSoft\Vision14\Scriptlets\TracksOneBelowTheOther.sss

 //////////////////////////////////////////////////
 // GUI
 //////////////////////////////////////////////////
 
 // Name and description of the menu item
 function OnGetGUI: string;
 begin
   Result := '['
 	  +'{"Caption":"One below the other","Type":"title"}'
 	  +',{"Caption":"Positions all objects in a container one below the other.","Type":"description"}'
   +']'; 
 end;
 
 //////////////////////////////////////////////////
 // Execution
 //////////////////////////////////////////////////
 
 procedure SetTracks(const SlideShowObject: ISlideShowObject);
 begin
   if SlideShowObject.Count = 0 then
     Exit;
 
   for var i := 0 to SlideShowObject.Count - 1 do
   begin
     var Item := SlideShowObject[i];
     Item.Track := i; // set track number
     Item.Offset := 0; // Remove distance to the beginning of the track
   end;
 end;
 
 procedure OnExecute(Parameters: IParameters);
 begin
   var Item := DocumentController.GetFirstSelected;
   while Item <> nil do
   begin
     SetTracks(Item as ISlideShowObject);  // set new tracks for all child elements
     Item := DocumentController.GetNextSelected(Item); // go to next selected entry
   end;
 end;

5. Sample: Access at parameters

In this Scriptlet the GUI defines two values that users can enter. Here the GUI is assembled using the auxiliary function GuiControl, which is somewhat clearer than to construct a JSON script directly.

 

 //////////////////////////////////////////////////
 // GUI
 //////////////////////////////////////////////////

 // Name and description of the menu item
 function OnGetGUI: string;
 begin
   Result := '['
   + GUIControl(, 'Scriptlet title', cGUITitle)
   + ',' + GUIControl(, 'Scriptlet description', cGUIDescription) // use 'Description' instead of cGUIDescription, if the constant is not yet defined.
   + ',' + GUIControl('key1', 'A string value', cGUIEdit)
   + ',' + GUIControl('key2', 'Another value', cGUISlider, '"Min":0, "Max":100, "Increment":5, "Center":25, "Unit": "%", "Decimals": 1')
   + ']'; 
 end;
 
 //////////////////////////////////////////////////
 // Execution
 //////////////////////////////////////////////////
 
 procedure OnExecute(Parameters: IParameters);
 begin
   var wert1 := Parameters.GetValueAsString('key1');
   var wert2 := Parameters.GetValueAsFloat('key2');
   
   // ...
 end;