When the description file and script code are ready and tested we can pack them into one extension file and deploy the file to users.
Script extension files are .zip files that have the .tcx extension. So, you should pack the files to the zip archive and change the archives extension from .zip to .tcx.
You can pack the files with any tool that supports the zip format. You can even use TestComplete since it supports the zip packer functionality included in the operating system. To pack the files, you can use the following script code:
JavaScript, JScript
function PackFiles()
{
var FileNames;
FileNames = "wmiCode.vbs" + "\r\n" +
"description.xml"
slPacker.Pack(FileNames, "C:\\My Extension Files\\Extension1", "C:\\My Extension Files\\MyExtension.tcx");
}
Python
def PackFiles():
FileNames = "wmiCode.vbs" + "\r\n" + \
"description.xml"
slPacker.Pack(FileNames, "C:\\My Extension Files\\Extension1", "C:\\My Extension Files\\MyExtension.tcx")
VBScript
Sub PackFiles
Dim FileNames
FileNames = "wmiCode.vbs" + vbNewLine + _
"description.xml"
Call slPacker.Pack(FileNames, "C:\My Extension Files\Extension1", "C:\My Extension Files\MyExtension.tcx")
End Sub
DelphiScript
procedure PackFiles;
var
FileNames;
begin
FileNames := 'wmiCode.vbs' + #13#10 +
'description.xml';
slPacker.Pack(FileNames, 'C:\My Extension Files\Extension1', 'C:\My Extension Files\MyExtension.tcx');
end;
C++Script, C#Script
function PackFiles()
{
var FileNames;
FileNames = "wmiCode.vbs" + "\r\n" +
"description.xml"
slPacker["Pack"](FileNames, "C:\\My Extension Files\\Extension1", "C:\\My Extension Files\\MyExtension.tcx");
}
After creating the .tcx file, you can install the extension into TestComplete and check how it functions. For more information about this, see Installing and Uninstalling Script Extensions.
Two notes:
-
The code created in this tutorial is part of the AQAScriptExtensions.tcx file that is included in TestComplete. You can find this file in the <TestComplete>\Bin\Extensions\ScriptExtensions folder.
-
The script extensions that are included into the AQAScriptExtensions.tcx file are installed in TestComplete by default. So, TestComplete already contains the
WMI
object.In order for the tutorial script extension to function properly, disable the WMI Object extension in the Script Extensions dialog before installing your extension in TestComplete.
See Also
Deploying Script Extensions
Installing and Uninstalling Script Extensions
WMI Object