$set Method

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

Description

In JavaScript code, you can use $set to assign a value to an object’s property given the property name as a string. $set works similar to aqObject.SetPropertyValue, but is easier to use in JavaScript.

$set is also the only way to set the value of a parameterized property. Instead of

obj.property(param1, param2) = value;

you must use

obj.$set("property", param1, param2, value);

Declaration

Obj.$set(PropertyName, Param1, Param2, ..., Value)

Obj Any object that supports the IDispatch interface
PropertyName [in]    Required    String    
Param1 [in]    Optional    Variant    
Param2 [in]    Optional    Variant    
...
Value [in]    Required    Variant    
Result None

Applies To

IDispatch objects, for example, TestComplete scripting objects (Sys, Log), test objects obtained from applications (Aliases.browser), COM objects, and others.

Parameters

PropertyName

A string containing the name of the property whose value you want to set.

Param1, Param2, ..., ParamN

If the property has parameters, such as property[param1, param2], specify the parameter values.

Value

The value to assign to the property.

Result Value

None.

Example

JavaScript

Sys.$set("Clipboard", "test");
Log.Message(Sys.Clipboard);

See Also

$call Method
$get Method
JavaScript - Specifics of Usage

Highlight search results