Using Script Hooks in Applications

Script hooks have wide applicability and can be used in user-written applications just as they are used in the SmarTeam family of products.

Due to the modular nature of SmarTeam, applications can be written based on the SmarTeam API. Script hooks can be used in these applications. You attach a script to a hook using the Script Maintenance facility or one of the library designer utilities. Then, when the appropriate API function is executed, the script attached to the hook executes. For example, if you attach a script to the Before Add hook in Script Maintenance, then when the corresponding API function (ISmObject.Insert) is executed by the application, the script is executed just before Insert inserts the object into the database.

You can disable the execution of an attached script using the SmBehavior object.

The following figure shows the relationship between an application and the user-written script. It shows that the mechanism of script hooks is connected to the SmarTeam API and is separate from the application itself. Thus it applies equally to any application.

Link to scripts2.gif