A Class holds a collection of other script objects, such as aliases, macros, triggers, variables, etc. A Class is similar to a "folder" that holds a collections of files on your hard disk.

In addition to helping to organize your scripts into groups, classes also perform some important functions within scripts. Classes can be formed into a "tree hierarchy", similar to file folders. For example, a top-level Class can contain a sub-class.

When you reference an Alias or Variable, TeSSH first looks within the current class. If the alias or variable is not found within the current class, then TeSSH looks in the Parent class. This continues until TeSSH reaches the top level of your package. If the alias or variable still hasn't been found, then TeSSH starts looking within other global modules within your package, or other published modules within other packages.

If you think about Classes as if they were nested file folders, then you will find them easy to use. TeSSH uses the same syntax for specifying a specific folder as Unix. Simply place a "/" character between the sub folder names. For example:

#SHOW @TopClass/SubClass/Varname

will access the @Varname variable within the SubClass folder that is nested within the TopClass folder.

To refer to the current class, use ./ and to refer to the Parent class, use ../ just like with Unix filenames.

Classes can also be enabled and disabled using the #CLASS command or the #T+ and #T- commands. When a class is disabled, then the aliases, variables, triggers, macros, etc within the class cannot be accessed normally.

This feature allows you to create multiple scripts with the same names, but stored in different classes. For example, you might have a class called "SuperUser" and a class called "NormalUser". In each class you place a macro for the F5 key. Now you disable one class, and enable the other. When you press the F5 key, the macro in the enabled class will be executed.

Add comment

Login or register to post comments