ParamName Property

Applies to TestComplete 14.91, last modified on July 20, 2021

Description

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

Declaration

aqObjEventObj.ParamName(Index)

Read-Only Property String
aqObjEventObj An expression, variable or parameter that specifies a reference to an aqObjEvent 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 event parameters. To get the total number of event parameters, use the aqObjEvent.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 total number of the specified event's parameters and then posts the parameter names to the test log.

JavaScript, JScript

function EventParameters()
{

  // Specifies the object
  var Obj = Sys.Process("MyApplication");
    
  // Obtains the total number of the event's parameters
  var Num = aqObject.GetEvents(Obj).Item(0).ParamCount;
  
  // Posts the parameters names to the test log
  for (var i = 0; i < Num; i++)
    Log.Message("The parameter is: " + aqObject.GetEvents(Obj).Item(0).ParamName(i));
  
}

Python

def EventParameters():
  # Specifies the object 
  Obj = Sys.Process("MyApplication")
  # Obtains the total number of the event's parameters
  Num = aqObject.GetEvents(Obj).Item[0].ParamCount
  # Posts the parameters names to the test log
  for i in range(0, Num):
    Log.Message("The parameter is: " + aqObject.GetEvents(Obj).Item[0].ParamName[i])

VBScript

Sub EventParameters

  ' Specifies the object
  Set Obj = Sys.Process("MyApplication")
    
  ' Obtains the total number of the event's parameters
  Num = aqObject.GetEvents(Obj).Item(0).ParamCount
  
  ' Posts the parameters names to the test log
  For i = 0 to Num-1
    Log.Message "The parameter is: " & aqObject.GetEvents(Obj).Item(0).ParamName(i)
  Next
  
End Sub

DelphiScript

function EventParameters;
var Obj, Num, i;
begin

  // Specifies the object
  Obj := Sys.Process('MyApplication');
    
  // Obtains the total number of the event's parameters
  Num := aqObject.GetEvents(Obj).Item(0).ParamCount;
  
  // Posts the parameters names to the test log
  for i := 0 to Num-1 do
    Log.Message('The parameter is: ' + aqObject.GetEvents(Obj).Item(0).ParamName(i));
  
end;

C++Script, C#Script

function EventParameters()
{

  // Specifies the object
  var Obj = Sys["Process"]("MyApplication");
    
  // Obtains the total number of the event's parameters
  var Num = aqObject["GetEvents"](Obj)["Item"](0)["ParamCount"];
  
  // Posts the parameters names to the test log
  for (var i = 0; i < Num; i++)
    Log["Message"]( "The parameter is: " + aqObject["GetEvents"](Obj)["Item"](0)["ParamName"](i) );
  
}

See Also

Name Property
ParamCount Property

Highlight search results