ParamName Property

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

Description

The ParamName property returns the name of the property’s parameter specified by its index.

Declaration

aqObjPropertyObj.ParamName(Index)

Read-Only Property String
aqObjPropertyObj An expression, variable or parameter that specifies a reference to an aqObjProperty object
Index [in]    Required    Integer    

Applies To

The property is applied to the following object:

Parameters

The property has the following parameter:

Index

The zero-based index of the desired parameter in the list of property parameters. To get the total number of property parameters, use the aqObjProperty.ParamCount property.

Property Value

A string that holds the parameter name.

Remarks

If you use Python or DelphiScript, you should enclose the parameter of the ParamName property in square brackets: ParamName[Index].

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
ParamCount Property
Value Property

Highlight search results