In this tutorial you will learn
Scripts can be included into other scripts with the include statement. The to be included scripts files must be located in one of the following directories so FlowModeler can find them.
In case you want to set up a new directory: create the directory in a convenient location on your machine and add the path under Script/Preprocessor/Search-Paths. Multiple paths can be specified when they are separated with asemicolon (:). In the following we assume that a directory named includes has been created in one of the search-paths above.
The file that will be included must be placed in the includes directory. We call it constants.flowScript and put the following content into it:
MY_CONSTANT_1 = 12345
MY_CONSTANT_2 = "abc"
Save and close the file.
Now create a new script file. The file can now be saved anywhere on the machine (for example the Desktop). We call it here user.flowScript. Add the following to this script:
include includes/constants.flowScript
print( "MY_CONSTANT_1: " + MY_CONSTANT_1 )
print( "MY_CONSTANT_2: " + MY_CONSTANT_2 )
In the above code the include statement is replaced with the content of the includes/constant.flowScript file. Therefore the constant defined in the other file are available in the user script.
The includes statement comes in handy when for example some configuration values must be shared between multiple scripts. The files to be included must be placed in one of the search paths of so FlowModeler can find them.
Downloads