Objects.Load Method

Applies to TestComplete 15.69, last modified on November 13, 2024

Description

Load assigns writable OLE-compatible properties stored in the Objects collection item Name to the tested object Object provided that the properties of that object are compatible with the collection item’s properties. If an error occurs when loading (for example, the specified object or its property is not found), Load returns False and generates an error string, which you can retrieve from the LastError property of the Objects object (and post it to the test log).

Declaration

Objects.Load(Object, Name, PropNames, ExceptedPropName, Recursive)

Object [in]    Required    a tested object    
Name [in]    Required    String    
PropNames [in]    Optional    String Default value: Empty string   
ExceptedPropName [in]    Optional    String Default value: Empty string   
Recursive [in]    Optional    Boolean Default value: False   
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Object

The tested object whose properties you want to re-assign from the object referred to by the Name item of the Objects collection.

Name

Unique name of the Objects collection’s item from which you want to load the needed properties.

PropNames

A string that contains the names of Object’s properties that should be re-assigned to Object. The property names specified in this string must be separated by spaces. If PropNames is not specified or is an empty string (this is the default value), all the stored writable properties will be restored to Object.

ExceptedPropName

A string that contains the names of Object’s properties that should not be re-assigned to Object. The property names specified in this string must be separated by spaces. This parameter is useful when you want to restore most of the object’s properties because in this instance you only need to set a short “exception list” of undesired properties, which saves you from listing all of the properties to be restored. If ExceptedPropNames is not specified or is an empty string (this is the default value), no specific writable properties will be missed when restoring properties of Object.

The ExceptedPropNames and PropNames parameters are mutually exclusive. So, the ExceptedPropNames and PropNames parameters cannot have a value at the same time. If these parameters have a non-empty value at the same time, the method returns False and generates an error description, which you can retrieve from the LastError property of the Objects object.

Recursive

If it is False (the default), only properties of the Object object will be restored. If this parameter is True, all the properties of the object’s child objects will be restored as well.

Result Value

True, if the properties’ values were assigned successfully, and False otherwise.

Remarks

To save collections of an object’s properties, use the Objects.Save method.

Example

The following code loads all the properties of the specified object from an item stored in the Objects collection.

JavaScript, JScript

Objects.Load(w.Form1, "FormProperties");

Python

Objects.Load(w.Form1, "FormProperties")

VBScript

Call Objects.Load(w.Form1, "FormProperties")

DelphiScript

Objects.Load(w.Form1, 'FormProperties');

C++Script, C#Script

Objects["Load"](w["Form1"], "FormProperties");

See Also

About Objects Collection
Compare Method
Save Method

Highlight search results