Value Property

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

Description

Use the Value property to set or get the value of the property that the given aqObjPropertyObj object provides information about.

Declaration

aqObjPropertyObj.Value

Read-Write Property Variant
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

The property value.

Remarks

An attempt to assign a new value to a read-only property will cause an error. To determine the access type of the property, use the aqObjPropertyObj.Access property.

Example

The code below checks whether the specified property is read-only. If it is not, the routine assigns a new value to the property; otherwise, an error occurs.

JavaScript, JScript

function SetPropertyValue()
{

  // Specifies the object
  var Obj = Sys.Process("MyApplication");
  // Obtains the properties collection
  var PropCol = aqObject.GetProperties(Obj);
  // Specifies the property to set a value to
  var PropItem = PropCol.Item(0);
  
  var ReadOnly = 2;
  
  if ( PropItem.Access != ReadOnly)
    // Sets a new value to the specified property
    PropItem.Value = "New_Value";
  else
    Log.Error("The specified property is read-only.");

}

Python

def SetPropertyValue():
  # Specifies the object
  Obj = Sys.Process("MyApplication")
  # Obtains the properties collection
  PropCol = aqObject.GetProperties(Obj)
  # Specifies the property to set a value to
  PropItem = PropCol.Item(0)
  ReadOnly = 2
  if PropItem.Access != ReadOnly:
    # Sets a new value to the specified property
    PropItem.Value = "New_Value"
  else:
    Log.Error("The specified property is read-only.")

VBScript

Sub SetPropertyValue

  ' Specifies the object
  Set Obj = Sys.Process("MyApplication")
  ' Obtains the properties collection
  Set PropCol = aqObject.GetProperties(Obj)
  ' Specifies the property to set a value to
  Set PropItem = PropCol.Item(0)
  
  ReadOnly = 2
  
  If Not PropItem.Access = ReadOnly Then
    ' Sets a new value to the specified property
    PropItem.Value = "New_Value"
  Else
    Log.Error "The specified property is read-only."
  End If

End Sub

DelphiScript

function SetPropertyValue;
var Obj, PropCol, PropItem, ReadOnly;
begin

  // Specifies the object
  Obj := Sys.Process('MyApplication');
  // Obtains the properties collection
  PropCol := aqObject.GetProperties(Obj);
  // Specifies the property to set a value to
  PropItem := PropCol.Item(0);
  
  ReadOnly := 2;
  
  if ( PropItem.Access <> ReadOnly) then
    // Sets a new value to the specified property
    PropItem.Value := 'New_Value'
  else
    Log.Error('The specified property is read-only.');

end;

C++Script, C#Script

function SetPropertyValue()
{

  // Specifies the object
  var Obj = Sys["Process"]("MyApplication");
  // Obtains the properties collection
  var PropCol = aqObject["GetProperties"](Obj);
  // Specifies the property to set a value to
  var PropItem = PropCol["Item"](0);
  
  var ReadOnly = 2;
  
  if ( PropItem["Access"] != ReadOnly)
    // Sets a new value to the specified property
    PropItem["Value"] = "New_Value";
  else
    Log["Error"]("The specified property is read-only.");

}

See Also

Access Property
Name Property
ParamCount Property
ParamName Property

Highlight search results