<< Click to Display Table of Contents >> Navigation: Reference (Scripting) > #include Directive |
Instructs the Docklight script preprocessor to insert the contents of the specified file at the point where the #include directive appears.
Syntax
#include filePathName
The #include syntax has these parts:
Part |
Description |
filePathName |
Required. String containing the file path (directory and file name) of the Docklight script file (.pts file) to include. The file extension .pts can be omitted. If no directory is specified, Docklight uses the current working directory. |
Remarks
If filePathName is not a valid Docklight script file or does not exist, Docklight reports an error and the script is not started.
The #include directive tells the preprocessor to treat the contents of a specified file as if those contents had appeared in the source program at the point where the directive appears.
You can organize constant declarations and function definitions into include files and then use #include directives to add these definitions to any script. Include files are also useful for incorporating declarations of external variables and complex data types.
Example
' Example #include directive
'
#include "myIncludeFile.pts"
DL.AddComment " Pi = " & conPi
With myIncludeFile.pts containing the following definition:
Const conPi = 3.14159265358979
The resulting communication window output would look like this:
Pi = 3.14159265358979