Script extensions allows you to create custom runtime objects that will be incorporated into the TestComplete object model. This topic explains how to write the source code of a custom object’s methods.
To create an object’s method code, simple write a routine that implements this method. The routine must have the same number of parameters as the method is supposed to have. If the method is supposed to return a value, the routine should return a value (that is, it should be a function).
In the general case, the routine’s name may not coincide with the object’s method name -- it is the script extension’s description.xml file that maps the runtime object’s methods to the corresponding script routines. However, it is recommended that you give the routine the same name as the method, the
ObjectName_MethodName or similar name. This way, you can simplify the understandability and maintenance of the object’s source code.
The example below demonstrates the source code of two sample methods, one having no parameters and another one having one parameter:
Log.Message "Hello, world!"
Sub LogMessageEx (Text)