Working in the script editor
Use the script editor to view, write, and modify scripts. The script editor includes standard editor features, such as cut, copy, and paste. You can also move from one script to another.
You write a script in a space associated with an object and an event; LotusScript® then attaches your script to the object and event. The LotusScript® language is the same for all products, but the properties, methods, and events are defined for your specific product's objects. After you select the object and event to which you want to attach a script, type the instructions you want to execute when the event occurs. For example, when the user clicks a command button, LotusScript® runs the script that you defined for that command button "click" event.
Some products can automate parts of the scripting process, restricting or eliminating the need to use parts of LotusScript®. For more information on your product extensions, see the product documentation.
Compiling scripts
An application must be compiled before it will load and execute.
When you compile a script, LotusScript® displays messages about any errors it finds, listed in the order in which they are found. There are two types of errors:
- Compile-time error
Occurs when a script contains an error that LotusScript® detects during compilation. You need to fix it before the script can compile and run.
- Run-time error
Occurs when a script contains an error that could not be predicted during compilation. When one occurs, script execution ends unless your script includes statements to handle the error.
As you fix errors, you recompile until there are no more errors in the script. You can compile your scripts explicitly, using your product's menu commands, or you can compile them automatically when you save the application or when you run it. For information about whether your product allows you to compile scripts explicitly or implicitly, see the product documentation.
For more information about errors, see "Error Processing."
Creating and using script libraries
Script libraries are shared compiled script modules. Some HCL software applications allow you to write and compile script modules as files with an .LSO extension and then use these files in your applications. You create one copy of a compiled script module to use in multiple applications.
You create the script using your script editor, or any text editor. The script can contain LotusScript® declarations, subs, and functions, and can define and declare product classes, properties, subs, and functions.
To load a compiled LotusScript® module, put a Use statement in a script at module level, before all implicit declarations. For more information, see the product documentation.
If you place the Use statement in a declarations section, any public declarations, subs, and procedures in the "used" module are available to the scripts in the corresponding module. If your HCL software provides a Public script, place the Use statement in this script to make Public declarations and procedures in the "used" module available to the scripts in the application.
If you then change the name or extension of the module, LotusScript® can't use the script module, because the original file name is embedded in the compiled module. To change the file name, you must rename the source file and compile the .LSO file.