Using Script Components
Many objects use the same processing steps in their scripts. Automic recommends storing them in Include objects in order to avoid repeated creation and maintenance being required in every script. In doing so, you can acquire a collection of script components that can easily be maintained and reduce the time that is required for writing scripts considerably.
How to use Include objects:
- Store frequently used blocks of script lines in Include objects.
- Call the script statement :INCLUDE indicating the name of the Include object in the particular script section in which the script lines should be included at runtime.
- The above script element also contains a parameter which can be used to adjust the script lines to an object as it facilitates a particular string to be replaced. This assignment is only valid for the current generation and does not change the Include object itself.
The Include object's script lines are copied to the object's exact script position at which :INCLUDE is called. Therefore, script functions refer to the particular object and not to the Include object. For example, the script function SYS_ACT_ME_NAME supplies the object name and not the name of the Include object.
Viewing :INCLUDE Statements in the Script Editor
You can use the script editor to display and edit the contents of your Include objects.
You expand the Include object in a read-only dialog by clicking the plus symbol on the left edge.
To copy the contents from the Include object to the script editor, click Resolve Include.
A comment will denote that the code came from the contents of the Include object. Any future changes to the Include object will have no effect here. Any changes you make in the script editor will have no effect on the Include object.