Back

Topic

[KB152]Accessing extended attributes using VBA/Enable scripts

Tags: Enable, Scripting, VBA

14 years ago
By RM
Options
Print
Applies to:

PcVue version 7.20c onwards.
While the basic content of this article remains valid, details may have changed since it was written.


Summary:

This article shows how to use VBA and Enable scripting to access extended attributes.


Details:

VBA script

MsgBox Variables(“@BIT”).ExProperties(“TATT3”).Value

where @BIT is a Database variable.

Enable script

MsgBox TheseVariables(“@BIT”).ExProperties(“TATT3”).Value

where @BIT is a Database variable.

The ExProperties collection

ExProperties is a collection of extended attributes attached to the Variable object (Objects collection ExProperty).

The collection exposes these items for a variable:

Extended_attributes

The ExProperty object’s properties

An Exproperty object has the following properties:

Extended_attributes2

In the HMI, these properties appear in the dialogs opened from the menu Configure.Variables.Selector.Variable,Attributes.Behaviour.

Extended_Attributes_Behaviour_dialog

Examples

To find out the value of the property ‘Access’ of the third text attribute (TATT3) of variable @BIT:

MsgBox Variables(“@BIT”).ExProperties.Item(“TATT3”).Access

By default, this will return 2 (dynamic).

To read the value of the property ‘Value’ of the first binary attribute (BATT1) of the variable @BIT:

MsgBox Variables(“@BIT”).ExProperties.Item(“BATT1”).Value

This will return True if Value is 1 or False if it is 0.


Created on: 05 Nov 2010 Last update: 13 May 2024