Script Commands


In this tutorial you will learn:

  • what a command is
  • how to find information about available commands and information about a command itself
  • how to use commands

What is a Command

Commands are the build-in-functions of FlowModeler and are used to control FlowModeler or perform some specific task. Commands are automatically loaded, which means that they do not need to be imported (more on that in a later tutorial). Commands are grouped in modules and must be called with their full name and path in a flowScript.

Information about Commands

Information about commands can be gathered in the Script-IDE Browser where all commands are listed and a help displayed when a command is selected in the Browser.

If you haven't already please start FlowModeler. Open the Script-IDE with Tools/Script-IDE in the Menubar.

In the Script-IDE the Browser is located on the right side of the window and the Commands can be found at the very top of the Browser.

Expand the Commands item in the Browser.

Commands are organized into modules. For example there exist a module for array, geometry, and so on. Within the modules the commands are listed. A module also may contain submodules with further commands.

If you expand the array module you can find commands like add(), clear(), and so on. When you select a command in the Browser a short help text is displayed below the Browser. This help text contains a description of the command and how to use the command.

Command by Example

Now we will use commands of the array module in a simple example. In the example we

  • define an array of integers
  • add furter items to the array
  • remove some items from the array
  • query the array for information about the contents

First in the Text-Editor define an array by

numbers = [ 1, 2, 3, 4, 5 ]

If you like you can use print( numbers ) to view the contents of the array. Then save and execute the script.

Now add some further numbers to the array. Select the add() command in the Browser. The help states that the command requires the following arguments:

  • array: the array
  • item: The item to be added to the array.
  • index: The position in the array where the item will be added. If index is negative or zero, the item is prepended. If index is greater or equal the arrays size, the item is appended.

So the position of an item added to an array with the add() command depends on the index argument that is passed to the command. Let's add new items for each case specified.

array.add( numbers, "prepended", 0 )
array.add( numbers, "inserted", 3 )
array.add( numbers, "appended", array.size(numbers) )
print( numbers )

Please note that in the last add statement the array.size() command was used to get the actual size of the array.

Now remove some items:

array.remove( numbers, 1 )
array.remove( numbers, array.index(numbers, 2) )
print( numbers )

Again the array.index() command has been used to find the index of an item in the array.


In this tutorial you have learned that commands in flowScript are organized in modules. Available commands can be found in the Browser of the Script-IDE and information about a command itself is available when the command is selected in the Browser.