Generating Custom Properties with a Script
- Updated2024-09-12
- 1 minute(s) read
Creating Scripts > Working with Files > Generating Custom Properties with a Script
Generating Custom Properties with a Script
Use the method Add for Properties to create custom properties of data sets, of groups, and of channels and to assign values to these custom properties. For example, to generate a custom property in a group and to to assign a value to this custom property, complete the following steps:
-
Open the DIAdem NAVIGATOR.
-
Drag and drop any data set from the file browser into the Data Portal.
-
Select DIAdem SCRIPT.
-
Select File»New»VBS Script to create a new script.
-
Enter or copy the following text into the script editor:
VBScript Python Dim MyPropName, MyPropValue, oMyGroupProperties, oMyGroupProperty MyPropName = "My new group property" MyPropValue = "My new group property value" Set oMyGroupProperties = Data.Root.ChannelGroups(1).Properties Set oMyGroupProperty = oMyGroupProperties.Add(MyPropName,MyPropValue,DataTypeString) If oMyGroupProperty.Name <> MyPropName Then Call MsgboxDisp ("Name was not valid and was changed to: " & oMyGroupProperty.Name) End If -
Select Script»Run VBS Script to start the script.
-
Select the first channel group in the Data Portal. DIAdem displays the new custom property with the assigned value in the properties window of the Data Portal.