ParamCount Property

Applies to TestComplete 14.40, last modified on April 22, 2021

Description

Use the ParamCount property to obtain the total number of parameters of the property that the given aqObjPropertyObj object provides information about.

Declaration

aqObjPropertyObj.ParamCount

Read-Only Property Integer
aqObjPropertyObj An expression, variable or parameter that specifies a reference to an aqObjProperty object

Applies To

The property is applied to the following object:

Property Value

An integer value that specifies the total number of property parameters.

Example

The code below obtains the collection of all parameters belonging to the ChildCount property of Notepad' s main window object. After that, the routine obtains the total number of the specified property's parameters and posts the parameter names to the test log.

JavaScript, JScript

function PropertyParameters()
{

  // Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1);
  
  // Obtains the collection of properties
  var PropCol = aqObject.GetProperties(Obj);
  
  // Obtains information about the ChildCount property
  var PropItem = PropCol.Item(1);
 
  // Obtains the total number of the property's parameters
  var Num = PropItem.ParamCount;
  
  // Posts the parameters names to the test log
  for (var i = 0; i < Num; i++)
  {
   // Obtains the current parameter's name
    var sName = PropItem.ParamName(i);
    Log.Message(sName);
  }
  
  // Closes notepad.exe
  Sys.Process("notepad").Terminate();
  
}

Python

def PropertyParameters():
  # Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL)
  # Specifies the object
  Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  # Obtains the collection of properties
  PropCol = aqObject.GetProperties(Obj)
  # Obtains information about the ChildCount property
  PropItem = PropCol.Item(1)
  # Obtains the total number of the property's parameters
  Num = PropItem.ParamCount
  # Posts the parameters names to the test log
  for i in range(0, Num):
    # Obtains the current parameter's name
    sName = PropItem.ParamName[i]
    Log.Message(sName)
  # Closes notepad.exe
  Sys.Process("notepad").Terminate()

VBScript

Sub PropertyParameters

  ' Launches notepad.exe
  Call WshShell.Run("notepad.exe", SW_NORMAL)
  
  ' Specifies the object
  Set Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  
  ' Obtains the collection of properties
  Set PropCol = aqObject.GetProperties(Obj)
  
  ' Obtains information about the ChildCount property
  Set PropItem = PropCol.Item(1)
 
  ' Obtains the total number of the property's parameters
  Num = PropItem.ParamCount
  
  ' Posts the parameters names to the test log
  For i = 0 To Num-1
   ' Obtains the current parameter's name
    sName = PropItem.ParamName(i)
    Log.Message(sName)
  Next
  
  ' Closes notepad.exe
  Sys.Process("notepad").Terminate
  
End Sub

DelphiScript

function PropertyParameters;
var Obj, PropCol, Num, i, sName, PropItem;
begin

  // Launches notepad.exe
  WshShell.Run('notepad.exe', SW_NORMAL);
  
  // Specifies the object
  Obj := Sys.Process('notepad').Window('Notepad', 'Untitled - Notepad', 1);
  
  // Obtains the collection of properties
  PropCol := aqObject.GetProperties(Obj);
  
  // Obtains information about the ChildCount property
  PropItem := PropCol.Item(1);
 
  // Obtains the total number of the property's parameters
  Num := PropItem.ParamCount;
  
  // Posts the parameters names to the test log
  for i := 0 to Num-1 do
  begin
   // Obtains the current parameter's name
    sName := PropItem.ParamName(i);
    Log.Message(sName);
  end;
  
  // Closes notepad.exe
  Sys.Process('notepad').Terminate();
  
end;

C++Script, C#Script

function PropertyParameters()
{

  // Launches notepad.exe
  WshShell["Run"]("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 1);
  
  // Obtains the collection of properties
  var PropCol = aqObject["GetProperties"](Obj);
  
  // Obtains information about the ChildCount property
  var PropItem = PropCol["Item"](1);
 
  // Obtains the total number of the property's parameters
  var Num = PropItem["ParamCount"];
  
  // Posts the parameters names to the test log
  for (var i = 0; i < Num; i++)
  {
   // Obtains the current parameter's name
    var sName = PropItem["ParamName"](i);
    Log["Message"](sName);
  }
  
  // Closes notepad.exe
  Sys["Process"]("notepad")["Terminate"]();
  
}

See Also

Access Property
Name Property
ParamName Property
Value Property

Highlight search results