API-icon.png

Unknown macro: floating-toc

Execute scripts in jBEAM

Unknown macro: jbeam-sign provides some possibilities to use, create and run a script or use own developed source code in Unknown macro: jbeam-sign. Following possibilities are available that will be described below in detail:

  • Script Service
  • Scripting component
  • Inline Java-Function
  • Inline Java-Class

There are some possibilities to start the script. First, by means of a script file, second, with the assistance of the Scripting component Editor for editing and testing, third, by using a action command button, fourth, by click on a command button or fifth, during validating of Unknown macro: jbeam-sign.
For each of these possibilities jBEAM allows direct access to key components needed for the scripting. You can find more information about this here: Structure of jBEAM.

Script Service

The Unknown macro: jbeam-sign Script Service is service with provides the process of a complex sequence specified in script. The complex algorithms of the script file has a full access to the methods of the Unknown macro: jbeam-sign library. Preferable the script service can be used to run a script without any status information, e.g. when the script is started via a Unknown macro: jbeam-sign start parameter, a command item or imported directly using the menu File -> Scriptfile.

Import a script file

The user can import a complete script file selecting Scriptfile in the Unknown macro: jbeam-sign main menu File. After selecting the script file, it will be run automatically.

import_script_file.png

Start script using a command item

By clicking on the menu -> Graph Editor -> Controls -> Command Button a new Command Button Graphic is created. Select the command [ScriptService]ExecuteScript. Assign the file path to the command parameter “path”. Apply the changes (OK).
By clicking on the command button, the script will be executed.

start_script.png

start_script_modify.png

Start script using jBEAM start parameter

If Unknown macro: jbeam-sign is started using a batch file a script can be executed automatically. Therefore the Unknown macro: jbeam-sign start parameter ScriptURL has to be defined (ScriptURL=c:\test.bsh).

Scripting component

The Scripting component is opened by clicking Extra / Miscellaneous / Scripting in the Unknown macro: jbeam-sign menu and creates a component which functions are defined by a script. A simple script editor is integrated in the scripting component.

scripting_component.png

The subsequently appearing Editor Dialog displays some parameter, the Script and the Result of the Script in two different text field areas. On top the user can select the script language especially (BeanShell or Goovy). Optionally a script file can be selected which script content will be displayed in the upper text field area.
For testing the script click on the “Test Script” button. Result or error messages are presented in the status text field on the left side of the button. On the opposite side of the button a combo box for selecting predefined Unknown macro: jbeam-sign Script Samples is located.
The execution of the script can be done via a special action command or when Unknown macro: jbeam-sign is validated (please activate checkbox Start script when validating).

script_editor.png

The script component works like a regular Unknown macro: jbeam-sign component. The user/developer can set input objects (setScriptInputObjects(…)) as well as result objects (setScriptResultObjects(…)) of the component. The scripting component is registered as listener on the input objects and if these objects are changed, the script component will be executed automatically.
If the script component has more than one result value, it is suitable to use the function setScriptResultObjects(…) else use the standard result object of the script.

Auto completion in the Scripting Editor

A new feature of the scripting component editor is the ability to complete the names of classes and methods from Unknown macro: jbeam-sign classes and from Java classes. the completion works similar to the auto completion of Eclipse.
You can use it by typing the first letters of a class and then clicking ctrl + space.

scripteditor_autocompletion.png

See also

Tags:

Copyright by Kistler Chemnitz GmbH 2021
XWiki Enterprise 4.4 - Documentation