ParamType Property

Applies to TestComplete 15.70, last modified on December 17, 2024

Description

Use the ParamType property to get the data type of the method parameter specified by its index.

Declaration

aqObjMethodObj.ParamType(Index)

Read-Only Property Integer
aqObjMethodObj An expression, variable or parameter that specifies a reference to an aqObjMethod 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 method parameters. To get the total number of method parameters, use the aqObjMethodObj.ParamCount property.

Property Value

An integer that indicates the parameter's data type. The following types are possible:

Note: For the complete list of values, see the Microsoft documentation.

Constant Name Hex Value Integer Value Description
varEmpty 0000h 0 Empty (uninitialized).
varNull 0001h 1 Null (no valid data).
varSmallInt 0002h 2 Signed 16-bit integer.
varInteger 0003h 3 Signed 32-bit integer.
varSingle 0004h 4 Single-precision floating-point number. Number of significant digits: 7-8.
varDouble 0005h 5 Double-precision floating-point number. Number of significant digits: 15-16.
varCurrency 0006h 6 High-precision floating-point number. Number of significant digits: 19-20. Intended to minimize rounding errors in monetary calculations.
varDate 0007h 7 OLE-compatible TDateTime type.
varOleStr 0008h 8 String of 16-bit Unicode characters.
varDispatch 0009h 9 Automation object that implements IDispatch interface.
varError 000Ah 10 Code of an OS error.
varBoolean 000Bh 11 Boolean.
varVariant 000Ch 12 Variant.
varUnknown 000Dh 13 Reference to an unknown OLE object.
varShortInt 0010h 16 Signed 8-bit integer.
varByte 0011h 17 Unsigned 8-bit integer.
varWord 0012h 18 Unsigned 16-bit integer.
varLongWord 0013h 19 Unsigned 32-bit integer.
varInt64 0014h 20 Signed 64-bit integer.
varStrArg 48h 72 A COM-compatible string.
varString 100h 256 A reference to a dynamically allocated string (not COM-compatible).
varAny 101h 257 A Variant that can contain any value.
varArray 2000h 8192 Array. Type of array elements is specified by the lower bits. For example, 2003h is an array of integers.
varByRef 4000h 16384 Reference to a value of the type given by the lower bits. For example, 4007h is a reference to a date.

Remarks

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

Example

The code below obtains the type of the second parameter that belongs to the Click method of Notepad's main window object.

JavaScript, JScript

function ParameterType()
{

  // Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var Method = aqObject.GetMethods(Obj).Item(1);
  
  // Obtains the second parameter's type
  var sParamType = Method.ParamType(1);
  
  Log.Message("The specified method's second parameter is ");
  
  switch (sParamType)
  {
    case varEmpty :
    {
      Log.Message("an empty value.");
      break;
    }
    case varNull :
    {
      Log.Message("a null value.");
      break;
    }
    case varSmallInt :
    {
      Log.Message("a signed 16-bit integer value.");
      break;
    }
    case varInteger :
    {
      Log.Message("a signed 32-bit integer value.");
      break;
    }
    case varSingle :
    {
      Log.Message("a single-precision floating-point number.");
      break;
    }
    case varDouble :
    {
      Log.Message("a double-precision floating-point number.");
      break;
    }
    case varCurrency :
    {
      Log.Message("a high-precision floating-point number.");
      break;
    }
    case varDate :
    {
      Log.Message("a value of the OLE-compatible TDateTime type.");
      break;
    }
    case varOleStr :
    {
      Log.Message("a string of 16-bit Unicode characters.");
      break;
    }
    case varDispatch :
    {
      Log.Message("an automation object that implements the IDispatch interface.");
      break;
    }
    case varError :
    {
      Log.Message("a code of an OS error.");
      break;
    }
    case varBoolean :
    {
      Log.Message("a boolean value.");
      break;
    }
    case varVariant :
    {
      Log.Message("a variant value.");
      break;
    }
    case varUnknown :
    {
      Log.Message("a reference to an unknown OLE object.");
      break;
    }
    case varShortInt :
    {
      Log.Message("a signed 8-bit integer number.");
      break;
    }
    case varByte :
    {
      Log.Message("an unsigned 8-bit integer number.");
      break;
    }
    case varWord :
    {
      Log.Message("an unsigned 16-bit integer number.");
      break;
    }
    case varLongWord :
    {
      Log.Message("an unsigned 32-bit integer number.");
      break;
    }
    case varInt64 :
    {
      Log.Message("a signed 64-bit integer number.");
      break;
    }
    case varArray :
    {
      Log.Message("an array.");
      break;
    }
    case varByRef :
    {
      Log.Message("a reference to a value.");
      break
    }
  }
  
 // Closes notepad.exe
  Sys.Process("notepad").Close();
   
}

Python

def ParameterType():
  # Launches notepad.exe
  WshShell.Run("notepad.exe", SW_NORMAL)
  # Specifies the object
  Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  # Obtains information about the Click method
  Method = aqObject.GetMethods(Obj).Item(1)
  # Obtains the second parameter's type
  sParamType = Method.ParamType[1]
  Log.Message("The specified method's second parameter is ")
  if sParamType == varEmpty:
    Log.Message("an empty value.")
  elif sParamType == varNull:
    Log.Message("a null value.")
  elif sParamType == varSmallInt:
    Log.Message("a signed 16-bit integer value.")
  elif sParamType == varInteger:
    Log.Message("a signed 32-bit integer value.")
  elif sParamType == varSingle:
    Log.Message("a single-precision floating-point number.");
  elif sParamType == varDouble: 
    Log.Message("a double-precision floating-point number.")
  elif sParamType == varCurrency:
    Log.Message("a high-precision floating-point number.");
  elif sParamType == varDate:
    Log.Message("a value of the OLE-compatible TDateTime type.")
  elif sParamType == varOleStr:
    Log.Message("a string of 16-bit Unicode characters.")
  elif sParamType == varDispatch:
    Log.Message("an automation object that implements the IDispatch interface.")
  elif sParamType == varError:
    Log.Message("a code of an OS error.")
  elif sParamType == varBoolean: 
    Log.Message("a boolean value.")
  elif sParamType == varVariant: 
    Log.Message("a variant value.")
  elif sParamType == varUnknown: 
    Log.Message("a reference to an unknown OLE object.")
  elif sParamType == varShortInt:
    Log.Message("a signed 8-bit integer number.")
  elif sParamType == varByte: 
    Log.Message("an unsigned 8-bit integer number.")
  elif sParamType == varWord: 
    Log.Message("an unsigned 16-bit integer number.")
  elif sParamType == varLongWord: 
    Log.Message("an unsigned 32-bit integer number.")
  elif sParamType == varInt64: 
    Log.Message("a signed 64-bit integer number.")
  elif sParamType == varArray: 
    Log.Message("an array.")
  elif sParamType == varByRef: 
    Log.Message("a reference to a value.")
  # Closes notepad.exe
  Sys.Process("notepad").Close()

VBScript

Sub ParameterType

  ' Launches notepad.exe
  Call WshShell.Run("notepad.exe", SW_NORMAL)
  
  ' Specifies the object
  Set Obj = Sys.Process("notepad").Window("Notepad", "Untitled - Notepad", 1)
  
  ' Obtains information about the Click method
  Set Method = aqObject.GetMethods(Obj).Item(1)
  
  ' Obtains the second parameter's type
  sParamType = Method.ParamType(1)
  
  Log.Message "The specified method's second parameter is "
  
  Select case sParamType
    case varEmpty : Log.Message "an empty value."
    case varNull : Log.Message "a null value."
    case varSmallInt : Log.Message "a signed 16-bit integer value."
    case varInteger : Log.Message "a signed 32-bit integer value."
    case varSingle : Log.Message "a single-precision floating-point number."
    case varDouble : Log.Message "a double-precision floating-point number."
    case varCurrency : Log.Message "a high-precision floating-point number."
    case varDate : Log.Message "a value of the OLE-compatible TDateTime type."
    case varOleStr : Log.Message "a string of 16-bit Unicode characters."
    case varDispatch : Log.Message "an automation object that implements the IDispatch interface."
    case varError : Log.Message "a code of an OS error."
    case varBoolean : Log.Message "a boolean value."
    case varVariant : Log.Message "a variant value."
    case varUnknown : Log.Message "a reference to an unknown OLE object."
    case varShortInt : Log.Message "a signed 8-bit integer number."
    case varByte : Log.Message "an unsigned 8-bit integer number."
    case varWord : Log.Message "an unsigned 16-bit integer number."
    case varLongWord : Log.Message "an unsigned 32-bit integer number."
    case varInt64 : Log.Message "a signed 64-bit integer number."
    case varArray : Log.Message "an array."
    case varByRef : Log.Message "a reference to a value."
  End Select
 
  ' Closes notepad.exe
  Sys.Process("notepad").Close
   
End Sub

DelphiScript

function ParameterType;
var Obj, Method,sParamType;
begin

  // Launches notepad.exe
  WshShell.Run('notepad.exe', SW_NORMAL);
  
  // Specifies the object
  Obj := Sys.Process('notepad').Window('Notepad', 'Untitled - Notepad', 1);
  
  // Obtains information about the Click method
  Method := aqObject.GetMethods(Obj).Item[1];
  
  // Obtains the second parameter's type
  sParamType := Method.ParamType[1];
  
  Log.Message('The specified method''s second parameter is ');
  
  case sParamType of
    varEmpty : Result := Log.Message('an empty value.');
    varNull : Result := Log.Message('a null value.');
    varSmallInt : Result := Log.Message('a signed 16-bit integer value.');
    varInteger : Result := Log.Message('a signed 32-bit integer value.');
    varSingle : Result := Log.Message('a single-precision floating-point number.');
    varDouble : Result := Log.Message('a double-precision floating-point number.');
    varCurrency : Result := Log.Message('a high-precision floating-point number.');
    varDate : Result := Log.Message('a value of the OLE-compatible TDateTime type.');
    varOleStr : Result := Log.Message('a string of 16-bit Unicode characters.')
    varDispatch : Result := Log.Message('an automation object that implements the IDispatch interface.');
    varError : Result := Log.Message('a code of an OS error.');
    varBoolean : Result := Log.Message('a boolean value.');
    varVariant : Result := Log.Message('a variant value.');
    varUnknown : Result := Log.Message('a reference to an unknown OLE object.');
    varShortInt : Result := Log.Message('a signed 8-bit integer number.');
    varByte : Result := Log.Message('an unsigned 8-bit integer number.');
    varWord : Result := Log.Message('an unsigned 16-bit integer number.');
    varLongWord : Result := Log.Message('an unsigned 32-bit integer number.');
    varInt64 : Result := Log.Message('a signed 64-bit integer number.');
    varArray : Result := Log.Message('an array.');
    varByRef : Result := Log.Message('a reference to a value.');
  end;
  
  // Closes notepad.exe
  Sys.Process('notepad').Close();
   
end;

C++Script, C#Script

function ParameterType()
{

  // Launches notepad.exe
  WshShell["Run"]("notepad.exe", SW_NORMAL);
  
  // Specifies the object
  var Obj = Sys["Process"]("notepad")["Window"]("Notepad", "Untitled - Notepad", 1);
  
  // Obtains information about the Click method
  var Method = aqObject["GetMethods"](Obj)["Item"](1);
  
  // Obtains the second parameter's type
  var sParamType = Method.ParamType(1);
   
  Log["Message"]("The specified method's second parameter is ");
  
  switch ( sParamType )
  {
    case varEmpty :
    {
      Log["Message"]("an empty value.");
      break;
    }
    case varNull :
    {
      Log["Message"]("a null value.");
      break;
    }
    case varSmallInt :
    {
      Log["Message"]("a signed 16-bit integer value.");
      break;
    }
    case varInteger :
    {
      Log["Message"]("a signed 32-bit integer value.");
      break;
    }
    case varSingle :
    {
      Log["Message"]("a single-precision floating-point number.");
      break;
    }
    case varDouble :
    {
      Log["Message"]("a double-precision floating-point number.");
      break;
    }
    case varCurrency :
    {
      Log["Message"]("a high-precision floating-point number.");
      break;
    }
    case varDate :
    {
      Log["Message"]("a value of the OLE-compatible TDateTime type.");
      break;
    }
    case varOleStr :
    {
      Log["Message"]("a string of 16-bit Unicode characters.");
      break;
    }
    case varDispatch :
    {
      Log["Message"]("an automation object that implements the IDispatch interface.");
      break;
    }
    case varError :
    {
      Log["Message"]("a code of an OS error.");
      break;
    }
    case varBoolean :
    {
      Log["Message"]("a boolean value.");
      break;
    }
    case varVariant :
    {
      Log["Message"]("a variant value.");
      break;
    }
    case varUnknown :
    {
      Log["Message"]("a reference to an unknown OLE object.");
      break;
    }
    case varShortInt :
    {
      Log["Message"]("a signed 8-bit integer number.");
      break;
    }
    case varByte :
    {
      Log["Message"]("an unsigned 8-bit integer number.");
      break;
    }
    case varWord :
    {
      Log["Message"]("an unsigned 16-bit integer number.");
      break;
    }
    case varLongWord :
    {
      Log["Message"]("an unsigned 32-bit integer number.");
      break;
    }
    case varInt64 :
    {
      Log["Message"]("a signed 64-bit integer number.");
      break;
    }
    case varArray :
    {
      Log["Message"]("an array.");
      break;
    }
    case varByRef :
    {
      Log["Message"]("a reference to a value.");
      break
    }
  }
    
 // Closes notepad.exe
  Sys["Process"]("notepad")["Close"]();
   
}

See Also

HasRetValue Method
Name Property
ParamCount Property
ParamName Property
ValueType Property

Highlight search results