Calling Help for Script Extensions

Applies to TestComplete 15.47, last modified on January 20, 2023

To assist the users in using services provided by your script extension, you can include help in it. Script extensions can use the same type of help that TestComplete does -- .CHM help files compiled with the HTML Help compiler (for information about developing HTML Help files, see Microsoft HTML Help Workshop documentation). The help file must be included in the script extension package. When the extension is being installed in TestComplete, the installer extracts the help file from the package to the folder where the package is installed.

The script extensions’ CHM help file names must meet the following requirements:
  • The help file name must coincide with the name of the script extension package file. That is, if you are going to deliver your extension(s) in the MyExtension.tcx package, the help file name must be MyExtension.chm.

  • The help file name cannot contain spaces.

Besides local help files, script extensions can also use Web help -- a set of web pages that can be accessed via the Internet.

The help can be viewed separately, or it can be called directly from the script extension’s code. To display help topics, you can use various methods of the Help object:

  • ShowContext - displays the help file’s topic with the specified ID in the help viewer.

  • ShowTopic - displays the specified topic in the help viewer.

  • ShowURL - displays the specified web page in the user’s default Internet browser.

For example, if your extension provides a record-time or design-time action that displays a form, you can add the Help button to this form, which will call a help topic explaining the form purpose and the actions the user can perform with it. To implement such functionality:

  • Add a button labeled Help to the form.

  • Create an event handler for the button’s OnClick event.

  • In the event handler routine, write the code for displaying the desired help topic.

The following example demonstrates how you can call Web help for a form. It assumes that the script extension includes a form named Form1 with a button named cbHelp on it.

JScript

function Form1_cbHelp_OnClick(Sender)
{
  Help.ShowURL("http://www.mysite.com/tcscriptextensions/myscriptextension.htm");
}

VBScript

Sub Form1_cbHelp_OnClick(Sender)
  Help.ShowURL "http://www.mysite.com/tcscriptextensions/myscriptextension.htm"
End Sub

Another example: if your extension provides a custom keyword test operation with a number of parameters that can be edited via the standard Operation Parameters dialog, you can link a help topic to the Help button in that dialog. For this, you need to subscribe to the OnHelpCalled event and display the desired help topic from the event handler’s code:

XML

[description.xml]

...
<KDTOperation Name="My Operation">
    ...
    <Columns>
        ...
        <Column Name="Value" Editable="True" EditorType="Parameters">
          <Event Name="OnHelpCalled" Routine="MyOperation_OnHelpCalled" />
        </Column>
    </Columns>
</KDTOperation>
...

JScript

function MyOperation_OnHelpCalled(Data)
{
  Help.ShowURL("http://www.mysite.com/tcscriptextensions/myscriptextension.htm");
}

VBScript

Sub MyOperation_OnHelpCalled(Data)
  Help.ShowURL "http://www.mysite.com/tcscriptextensions/myscriptextension.htm"
End Sub

See Also

Script Extensions
Help Object
Creating Custom Actions
Creating Keyword Test Operations
Using Forms in Script Extensions
Script Extension Files - Overview

Highlight search results