How to create a custom activity
This is a simple step-by-step guide on creating a custom activity in CatTools. It contains instructions on how to add a custom activity type to the CatTools GUI and how to create a the custom main script and custom client script activity files, and how to make your custom activity available to device types.
The custom activity templates files provided by CatTools and referenced in this guide, are based on creating a simple Version report for a Cisco Router device. Once you have created the script .txt
and .custom
files, you need to modify them for your particular activity or report.
Further information regarding the custom activity type file (.ini), custom activity main script file (.txt), custom activity client script file (.txt), custom activity device script file (.custom), ct. code examples and cl. code examples of how to use the CatTools internal functions and sub procedures in your activity scripts, can be found in the other sub pages of this chapter.
1. Create a custom activity type file (.ini)
- Create a copy of the
Custom.Activity.Template.ini
in the\Templates
sub folder of the CatTools root directory and save to the\Activities
sub folder. - Rename the new file using the syntax
Custom.
:Type.Name
For example,
Custom.Report.Version
2. Edit the .ini file
Using a text file editor, such as Notepad, open the .ini
file created in step 1. You must change the following items in the .ini
file from the template default values:
[Activity]
name=
Custom.Activity.Template
script_main=
Main.Custom.Activity.Template.txt
script_client=
Client.Custom.Activity.Template.txt
report_file=%AppPath%Reports\
Master Custom Activity Template.txt
id=
3999
- Change
name
to a unique activity name. For example:Custom.Report.PortStatus
Do not use spaces. Use a period (
.
) instead. - Change
script_main
to the name of the associated Main script file.Use the activity name and prefix with
Main.
to keep the name unique. - Change
script_client
to the name of the associated Client script file.Use activity name and prefix with
Client.
to keep the name unique. - Change
report_file
to a unique report name. - Change
id
to a unique number (i.e. one not used in any other activity .ini file). Number must be within the range of 4000 to 4999.
3. Save & restart
- Once you have made your changes to the
.ini
file, save it back to the\Activities
sub folder and close. - Restart CatTools to populate the Type drop-down field in the activity setup screen with your new custom activity type.
4. Create a custom activity main script file (.txt)
- Create a copy of
Main.Custom.Activity.Template.txt
in the\Templates
sub folder of the CatTools root directory. - Save the copy to the
\Scripts
sub folder. - Give it a new file name as specified in the 'script_main' item within the activity type .ini file [Activity] section in step 2 above. Ensure you retain the .txt file type suffix.
5. Edit the main script .txt file
- Using a text file editor, open the .txt file created in step 4.
- Follow the instructions in the SCRIPT NOTES section of the
.txt
file to begin customizing the script for your activity.
6. Save the main script .txt file
Once you have made your initial changes to the main script .txt file, save it back to the \Scripts
sub folder and close.
7. Create a custom activity client script file (.txt)
- Make a copy of the Client.Custom.Activity.Template.txt in the \Templates sub folder of the CatTools root directory.
- Save the copy to the \Scripts sub folder. Rename the new file name as specified in the
script_client
item within the activity type.ini
file[Activity]
section in step 2 above. Ensure you retain the .txt file type suffix.
8. Edit the client script .txt file
- Using a text file editor, open the .txt file created in step 7.
- Follow the instructions in the SCRIPT NOTES section of the .txt file to begin customizing the script for your activity.
9. Save the client script .txt file
Once you have made your initial changes to the client script .txt file, save it back to the \Scripts sub folder and close.
10. Create a custom activity device script file (.custom)
- Make a copy of the
Custom.Device.Template.txt.custom
in the\Templates
sub folder of the CatTools root directory. - Save to the
\Scripts
sub folder and rename the file.Ensure you save the file using the same file name, including the
.txt
file type suffix, as its associated encrypted device script file (or a custom device script file). Append an additional suffix.custom
The following example if you create a custom activity device script file for a Cisco Router using an encrypted script file provided by CatTools: Cisco.Router.General.txt
. The custom activity device script file name is therefore: Cisco.Router.General.txt.custom
11. Edit the device script .custom file
- Using a text file editor, open the .custom file created in step 10.
- Read the SCRIPT NOTES section of the .custom file and begin customizing the script for your device.
An example of the steps you need to follow to add a custom activity to the .custom device file can be found in The custom activity device script file (.custom) help file page.
12. Save the device script .custom file
Once you have made your changes to the device script .custom file, save it back to the \Scripts
sub folder and close.
13. Testing your custom activity scripts
- When all the custom activity scripts and the device .custom script files are set up, test the new activity within CatTools by setting up the activity to run with the device you created the .custom file for.
- Use Run Now to test the custom activity manually rather than by starting the timer.
- Check the Info Log pane for errors and edit your .txt files and .custom file as necessary.
See Testing your custom activity for more information and tips.
Creating custom activity checklist
- Create activity type file (.ini)
- Create activity Main script file (.txt)
- Create activity Client script file (.txt)
- Create activity device script file (.custom)
Although the .txt files can be opened and edited using a text editor, a syntax highlighting script editor may make reading and editing the .txt file much easier.