| LUA scripting documentation |
Script scheduling can be made with Active View Object. Each object of an Active View can run an action defined by an expression at a regular interval. Running a script can be one of these possible actions. Each object in an Active View can run a script at its own time interval.
In a script launched from an Active View, only the lp_buffer variable is returned by the the script. The lp_value is never used but should be initialized at 0 (lp_value=0 ;).
Warning: This method run script at regular time interval. If you want to run a script once it is better to define an action as an option of an object contextual menu or as a mouse double click action on an object.
The complete syntax is:
RunScript ip_adress
script_file lp_index lp_oid
| Syntax item | Description |
|---|---|
| RunSript | The reserved keyword action that run a LUA script |
| ip_adress | The IP address of the host in doted format (X.Y.Z.W) or the keyword defip that will be replace at execution time by the default IP adress speciief in this ACtive View global properties. This IP address become the lp_host variable of the script. |
| script_file | The LUA script file name. The file should be imperatively located in the bin/config/script directory and should not be specified with its extension ".lua". If you create a new directory in bin/config/script directory to store your own script, you need to add this directory to the scriptfile parameter. Examples: If the file is called script1.lua in bin/config/script. RunScript defip script1 If the script fiel is called script1.lua dans bin/config/script/socket. RunScript defip socket/script1 |
| lp_index | This parameter is optional. This is used to specified a snmp oid index number. The value is use to initialize the lp_index variable in the script. Warning: This parameter should not have space in it. Examples: If the script file is called script1.lua in bin/config/script. RunScript defip script1 .2 If the script file is called script1.lua in bin/config/script/socket. RunScript defip socket/script1 .2 |
| lp_oid | This parameter is optional. It is passed to the script and used to initialize the lp_oid variable in the script. Warning: This parameter should not have space in it. This parameter can be used only if a lp_index is specified even if it is not required. Spefiy a dummy lp_indexvalue if necessary Examples: If the script file is called script1.lua in bin/config/script. RunScript defip script1 .2 param If the script file is called script1.lua dans bin/config/script/socket. RunScript defip socket/script2 .2 param |
Exemple of a RunScript action in an Active View Object
The script launched by the RunScript action
The script simply returns a text that is displayed in the object (see the upper screenshot).
www.loriotpro.com |
|