StoredObjectProperty Object

Applies to TestComplete 15.48, last modified on March 01, 2023

Description

The StoredObjectProperty object provides a scripting interface to property values stored in property collections that are added to the Stores project item. The object includes two properties that let you obtain the property name and retrieve or set the property value.

To obtain the StoredObjectProperty object in your scripts, use the Properties or PropertyByName properties of the StoredObject object.

Members

Example

The following code demonstrates how you can access the desired item of the Objects collection and the properties stored in this item.

JavaScript, JScript

function Test1()
{
  // Obtains the specified property collection
  StoredObject = Objects.Items("MyCollection");
  Log.Message("The total number of property values stored by the collection: " + StoredObject.PropertyCount);

  // Access the specified stored property
  StoredObjectProperty = StoredObject.Properties(0);
    // --or--
  // StoredObjectProperty = StoredObject.PropertyByName("Caption");
  PropertyName = StoredObjectProperty.Name;
  PropertyValue = StoredObjectProperty.Value;
  Log.Message(PropertyName + " = " + PropertyValue);
}

Python

def Test1():
  # Obtains the specified property collection 
  StoredObject = Objects.Items("MyCollection")
  Log.Message("The total number of property values stored by the collection: " + str(StoredObject.PropertyCount))
  # Access the specified stored property  
  StoredObjectProperty = StoredObject.Properties[0]
  # --or-- 
  # StoredObjectProperty = StoredObject.PropertyByName["Caption"]
  PropertyName = StoredObjectProperty.Name 
  PropertyValue = StoredObjectProperty.Value
  Log.Message(PropertyName + " = " + str(PropertyValue))

VBScript

Sub Test1
  ' Obtains the specified property collection
  Set StoredObject = Objects.Items("MyCollection")
  Log.Message("The total number of property values stored by the collection: " & StoredObject.PropertyCount)

  ' Access the specified stored property
  Set StoredObjectProperty = StoredObject.Properties(0)
    ' --or--
  ' Set StoredObjectProperty = StoredObject.PropertyByName("Caption")
  PropertyName = StoredObjectProperty.Name
  PropertyValue = StoredObjectProperty.Value
  Log.Message(PropertyName & " = " & PropertyValue)
End Sub

DelphiScript

procedure Test1;
begin
  // Obtains the specified property collection
  StoredObject := Objects.Items('MyCollection');
  Log.Message('The total number of property values stored by the collection: ' + StoredObject.PropertyCount);

  // Access the specified stored property
  StoredObjectProperty := StoredObject.Properties(0);
    // --or--
  // StoredObjectProperty := StoredObject.PropertyByName('Caption');
  PropertyName := StoredObjectProperty.Name;
  PropertyValue := StoredObjectProperty.Value;
  Log.Message(PropertyName + ' = ' + PropertyValue);
end;

C++Script, C#Script

function Test1()
{
  // Obtains the specified property collection
  StoredObject = Objects["Items"]("MyCollection");
  Log["Message"]("The total number of property values stored by the collection: " + StoredObject["PropertyCount"]);

  // Access the specified stored property
  StoredObjectProperty = StoredObject["Properties"](0);
    // --or--
  // StoredObjectProperty = StoredObject["PropertyByName"]("Caption");
  PropertyName = StoredObjectProperty["Name"];
  PropertyValue = StoredObjectProperty["Value"];
  Log["Message"](PropertyName + " = " + PropertyValue);
}

See Also

StoredObject Object
Properties Property
PropertyByName Property
Modifying Property Collections in Stores

Highlight search results