ADVERTISEMENT

VBScripts.pdf

WinCC: Problemy ze skryptami w C i pytanie o VBA oraz polecane publikacje

Visual Basic for Application używa się od wersji 6.0. Co do kursu to polecam książki do nauki języka VB oraz excela ponieważ w excelu jest wykorzystywany VBA. W załączniku dorzucam to co dostałem od siemensa.


Download file - link to post

11.05

Contents

Contents
1

Using Visual Basic Script in WinCC................................................... 1

2

Modules and Procedures .................................................................... 5

3

Actions

4

Multiple Use of Procedures and Actions ......................................... 11

5

Use of CrossReference ..................................................................... 13

6

Using Global Tags in VBS................................................................. 15

7

VBScript Editors ................................................................................ 17
7.1
7.2
7.3
7.4

8

11

Creating a New Procedure ...................................................................... 32
How to Write Procedure Codes............................................................... 34
Using Standard and Project Procedures ................................................. 37
Adding Module-Related Information........................................................ 38
Protecting a Module with a Password ..................................................... 40
Saving a Procedure ................................................................................. 41
Renaming a Procedure or Module .......................................................... 43

Creating and Editing Actions............................................................ 45
9.1
9.2
9.3
9.4
9.5
9.6
9.6.1
9.6.2
9.6.3
9.6.4
9.7

10

Global Script Editor.................................................................................. 19
Working in an Editor Window .................................................................. 22
Working with Toolbars ............................................................................. 25
Deleting Actions or Procedures............................................................... 28

Creating and Editing Procedures ..................................................... 29
8.1
8.2
8.3
8.4
8.5
8.6
8.7

9

.............................................................................................. 9

Creating a New Action............................................................................. 49
How to Edit Actions ................................................................................. 50
Adding Action-related Information ........................................................... 53
Protecting an Action with a Password ..................................................... 55
Saving Actions......................................................................................... 56
Triggers ................................................................................................... 57
Adding a " Timer " Type Trigger ................................................................ 61
Adding Tag Type Trigger......................................................................... 63
Modifying a Trigger.................................................................................. 66
Deleting a Trigger .................................................................................... 67
Renaming an Action ................................................................................ 69

Activating Global Actions in Runtime.............................................. 71
Diagnostics ........................................................................................ 73
11.1
11.1.1
11.1.2
11.1.3
11.2

GSC Diagnostics ..................................................................................... 74
Inserting the GSC Diagnostics Window in a Picture ............................... 74
GSC Diagnostics Attributes..................................................................... 75
GSC Diagnostics Toolbar........................................................................ 75
GSC Runtime .......................................................................................... 76

Printout of the Online Help
Creating Procedures and Actions with VBS

i

Contents

11.05

11.2.1
11.2.2
11.3
11.3.1
11.3.2
11.3.3
11.3.4
11.3.5
11.3.6
11.3.7
11.3.8
11.3.9
11.3.10
11.3.11
11.3.12

12
13

Printing VBScripts ............................................................................. 97
VBS Reference ................................................................................... 99
13.1
13.1.1
13.1.2
13.1.3
13.1.4
13.1.5
13.1.6
13.1.7
13.1.8
13.1.9
13.1.10
13.1.11
13.1.12
13.1.13
13.1.14
13.1.15
13.1.16
13.1.17
13.2
13.2.1
13.2.1.1
13.2.1.2
13.2.1.3
13.2.1.4
13.2.1.5
13.2.1.6
13.2.1.7
13.2.1.8
13.2.1.9
13.2.1.10
13.2.1.11
13.2.1.12
13.2.1.13
13.2.2
13.2.2.1
13.2.2.2

ii

Inserting the GSC Runtime Window in a Picture .................................... 78
GSC Runtime Attributes .......................................................................... 79
Testing with the Debugger ...................................................................... 80
How to Activate the Debugger................................................................. 81
Principles of Debugging .......................................................................... 83
Components of Microsoft Script Debugger ............................................. 85
Structure of VBScript Files ...................................................................... 86
Action and Procedure Names in Debugger............................................. 88
Selecting a Script for Editing ................................................................... 90
Processing Scripts Step-by-Step............................................................. 91
Setting Breakpoints ................................................................................. 92
Deleting Breakpoints ............................................................................... 93
How to Set Bookmarks in Scripts ............................................................ 93
How to Determine and Modify Tag and Property Values ........................ 94
Executing Script Commands ................................................................... 95

Objects and Lists ................................................................................... 100
AlarmLogs Object .................................................................................. 102
DataItem Object..................................................................................... 103
DataLogs Object.................................................................................... 104
DataSet Object (List) ............................................................................. 105
HMIRuntime Object ............................................................................... 106
Item Object ............................................................................................ 107
Layer Object .......................................................................................... 108
Layers Object (List) ............................................................................... 109
Logging Object ...................................................................................... 110
ScreenItem Object................................................................................. 111
ScreenItems Object (List)...................................................................... 114
Screen Object........................................................................................ 115
Screens Object (List) ............................................................................. 117
Project Object ........................................................................................ 119
Tag Object ............................................................................................. 120
Tags Object (List) .................................................................................. 122
TagSet Object (List)............................................................................... 124
Object Type of the ScreenItem Object .................................................. 125
Standard objects.................................................................................... 125
Ellipse ................................................................................................. 125
Ellipse Arc.............................................................................................. 126
Ellipse Segment..................................................................................... 126
Circle ................................................................................................. 127
Circular Arc............................................................................................ 127
Pie Segment .......................................................................................... 128
Line
................................................................................................. 129
Polygon ................................................................................................. 129
Polygon Line.......................................................................................... 130
Rectangle .............................................................................................. 131
Rounded Rectangle............................................................................... 133
Static Text.............................................................................................. 134
Connector .............................................................................................. 135
Smart Objects........................................................................................ 137
3D Bar ................................................................................................. 137
Application Window ............................................................................... 139

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Contents

13.2.2.3
13.2.2.4
13.2.2.5
13.2.2.6
13.2.2.7
13.2.2.8
13.2.2.9
13.2.2.10
13.2.2.11
13.2.3
13.2.3.1
13.2.3.2
13.2.3.3
13.2.3.4
13.2.3.5
13.2.4
13.2.4.1
13.2.4.2
13.2.4.3
13.2.4.4
13.2.4.5
13.2.4.6
13.2.4.7
13.2.4.8
13.2.4.9
13.2.4.10
13.2.5
13.2.6
13.3
13.3.1
13.3.1.1
13.3.1.2
13.3.1.3
13.3.1.4
13.3.1.5
13.3.1.6
13.3.1.7
13.3.1.8
13.3.1.9
13.3.1.10
13.3.1.11
13.3.1.12
13.3.1.13
13.3.1.14
13.3.1.15
13.3.1.16
13.3.1.17
13.3.1.18
13.3.1.19
13.3.1.20
13.3.1.21
13.3.1.22
13.3.1.23
13.3.1.24
13.3.1.25

Bar
................................................................................................. 139
Picture Window...................................................................................... 141
Control ................................................................................................. 141
I/O Field ................................................................................................. 144
Graphic Object....................................................................................... 144
OLE Object ............................................................................................ 145
Group Display........................................................................................ 147
Text List ................................................................................................. 147
Status Display........................................................................................ 148
Windows Objects................................................................................... 149
Button ................................................................................................. 149
Check Box ............................................................................................. 150
Option Group ......................................................................................... 151
Round Button......................................................................................... 152
Slider ................................................................................................. 152
Controls ................................................................................................. 155
WinCC Alarm Control ............................................................................ 157
WinCC Digital Analog Clock.................................................................. 157
WinCC DXF Control .............................................................................. 158
WinCC Function Trend Control ............................................................. 158
WinCC Gauge Control........................................................................... 159
WinCC Online Table Control ................................................................. 160
WinCC Online Trend Control................................................................. 160
WinCC Push Button Control.................................................................. 161
WinCC Slider Control ............................................................................ 163
HMI Symbol Library 1.3 ......................................................................... 165
Customized Object ................................................................................ 165
Group Object ......................................................................................... 166
Characteristics....................................................................................... 167
A ........................................................................................................ 167
AccessPath Property ............................................................................. 167
Activate Property ................................................................................... 167
ActiveScreen Property........................................................................... 168
ActiveProject Property ........................................................................... 169
ActiveScreenItem Property.................................................................... 169
Actualize Property ................................................................................. 169
ActualPointLeft Property........................................................................ 169
ActualPointTop Property ....................................................................... 170
AdaptBorder Property............................................................................ 170
AdaptPicture Property ........................................................................... 170
AdaptSize Property................................................................................ 170
AdjustRuler Property ............................................................................. 171
AlarmHigh Property ............................................................................... 171
AlarmLogs Property............................................................................... 171
AlarmLow Property ................................................................................ 171
Alignment Property ................................................................................ 172
AlignmentLeft Property .......................................................................... 172
AlignmentTop Property.......................................................................... 172
AllowPersistence Property .................................................................... 173
AllServer Property ................................................................................. 173
Analog Property..................................................................................... 173
AngleAlpha Property.............................................................................. 173
AngleBeta Property ............................................................................... 173
AngleMax Property ................................................................................ 174
AngleMin Property ................................................................................. 174

Printout of the Online Help
Creating Procedures and Actions with VBS

iii

Contents

11.05

13.3.1.26
13.3.1.27
13.3.1.28
13.3.1.29
13.3.1.30
13.3.1.31
13.3.1.32
13.3.1.33
13.3.1.34
13.3.1.35
13.3.1.36
13.3.1.37
13.3.1.38
13.3.2
13.3.2.1
13.3.2.2
13.3.2.3
13.3.2.4
13.3.2.5
13.3.2.6
13.3.2.7
13.3.2.8
13.3.2.9
13.3.2.10
13.3.2.11
13.3.2.12
13.3.2.13
13.3.2.14
13.3.2.15
13.3.2.16
13.3.2.17
13.3.2.18
13.3.2.19
13.3.2.20
13.3.2.21
13.3.2.22
13.3.2.23
13.3.2.24
13.3.2.25
13.3.2.26
13.3.2.27
13.3.2.28
13.3.2.29
13.3.2.30
13.3.2.31
13.3.2.32
13.3.2.33
13.3.2.34
13.3.2.35
13.3.2.36
13.3.2.37
13.3.2.38
13.3.2.39
13.3.2.40
13.3.2.41

iv

Application Property .............................................................................. 174
Archive Property .................................................................................... 174
Assignments Property ........................................................................... 175
AssumeOnExit Property ........................................................................ 175
AssumeOnFull Property ........................................................................ 175
Autorange Property ............................................................................... 175
AutorangeX Property ............................................................................. 175
AutorangeY Property ............................................................................. 176
AutoScroll Property................................................................................ 176
AutoSize Property.................................................................................. 176
Average Property................................................................................... 177
Axe Property.......................................................................................... 177
AxisSection Property ............................................................................. 177
B ........................................................................................................ 178
BackBorderWidth Property.................................................................... 178
BackColor Property ............................................................................... 178
BackColor2 Property ............................................................................. 179
BackColor3 Property ............................................................................. 179
BackColorBottom Property.................................................................... 179
BackColorTop Property ......................................................................... 179
BackFlashColorOff Property.................................................................. 179
BackFlashColorOn Property.................................................................. 180
Background Property............................................................................. 180
BackgroundPicture Property ................................................................. 180
BackStyle Property ................................................................................ 180
BarBackColor Property.......................................................................... 181
BarDepth Property................................................................................. 181
BarFillColor Property ............................................................................. 181
BarHeight Property ................................................................................ 182
BarWidth Property ................................................................................. 182
BasePicReferenced Property ................................................................ 182
BasePicTransColor Property................................................................. 182
BasePicture Property............................................................................. 182
BasePicUseTransColor Property .......................................................... 183
BaseScreenName Property................................................................... 183
BaseY Property ..................................................................................... 183
BaseX Property ..................................................................................... 184
BeginTime Property............................................................................... 184
BeginValue Property.............................................................................. 184
BeginX Property .................................................................................... 185
BeginY Property .................................................................................... 185
BevelColorDown Property ..................................................................... 185
BevelColorUp Property.......................................................................... 185
BevelInner Property............................................................................... 186
BevelOuter Property .............................................................................. 186
BevelWidth Property.............................................................................. 186
BitNumber Property ............................................................................... 186
BlinkColor Property................................................................................ 187
BlinkMode Property ............................................................................... 187
BlinkSpeed Property.............................................................................. 187
BorderBackColor Property .................................................................... 187
BorderColor Property............................................................................. 188
BorderColorBottom Property ................................................................. 188
BorderColorTop Property ...................................................................... 188
BorderEndStyle Property....................................................................... 188

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Contents

13.3.2.42
13.3.2.43
13.3.2.44
13.3.2.45
13.3.2.46
13.3.2.47
13.3.2.48
13.3.2.49
13.3.2.50
13.3.2.51
13.3.2.52
13.3.2.53
13.3.2.54
13.3.2.55
13.3.2.56
13.3.3
13.3.3.1
13.3.3.2
13.3.3.3
13.3.3.4
13.3.3.5
13.3.3.6
13.3.3.7
13.3.3.8
13.3.3.9
13.3.3.10
13.3.3.11
13.3.3.12
13.3.3.13
13.3.3.14
13.3.3.15
13.3.3.16
13.3.3.17
13.3.3.18
13.3.3.19
13.3.3.20
13.3.3.21
13.3.3.22
13.3.3.23
13.3.3.24
13.3.3.25
13.3.3.26
13.3.3.27
13.3.3.28
13.3.3.29
13.3.3.30
13.3.3.31
13.3.3.32
13.3.3.33
13.3.3.34
13.3.3.35
13.3.3.36
13.3.3.37
13.3.3.38
13.3.3.39

BorderFlashColorOff Property............................................................... 188
BorderFlashColorOn Property............................................................... 189
BorderStyle Property ............................................................................. 189
BorderWidth Property ............................................................................ 189
BottomConnectedConnectionPointIndex Property................................ 189
BottomConnectedObjectName Property ............................................... 190
BoxAlignment Property.......................................................................... 190
BoxCount Property ................................................................................ 190
BoxType Property.................................................................................. 191
ButtonColor Property ............................................................................. 191
ButtonCommand Property..................................................................... 191
Button1Width Property .......................................................................... 192
Button2Width Property .......................................................................... 192
Button3Width Property .......................................................................... 192
Button4Width Property .......................................................................... 193
C ........................................................................................................ 193
Caption Property.................................................................................... 193
CaptionColor Property ........................................................................... 193
CaptionFont Property ............................................................................ 193
CaptionOffset Property .......................................................................... 194
CaptionText Property............................................................................. 194
CellCut Property .................................................................................... 194
CenterColor Property............................................................................. 194
CenterScale Property ............................................................................ 195
CheckAlarmHigh Property..................................................................... 195
CheckAlarmLow Property...................................................................... 195
CheckLimitHigh4 Property..................................................................... 195
CheckLimitHigh5 Property..................................................................... 196
CheckLimitLow4 Property ..................................................................... 196
CheckLimitLow5 Property ..................................................................... 196
CheckToleranceHigh Property .............................................................. 196
CheckToleranceLow Property ............................................................... 197
CheckWarningHigh Property................................................................. 197
CheckWarningLow Property.................................................................. 197
ClearOnError Property........................................................................... 197
ClearOnNew Property ........................................................................... 198
Closeable Property ................................................................................ 198
CloseButton Property ............................................................................ 198
CoarseGrid Property.............................................................................. 198
CoarseGridX Property ........................................................................... 198
CoarseGridY Property ........................................................................... 199
CoarseGridValue Property .................................................................... 199
CoarseGridValueX Property.................................................................. 199
CoarseGridValueY Property.................................................................. 199
CollectValue Property............................................................................ 199
ColMove Property.................................................................................. 200
Color Property ....................................................................................... 200
ColorAlarmHigh Property ...................................................................... 200
ColorAlarmLow Property ....................................................................... 200
ColorBottom Property ............................................................................ 201
ColorChangeType Property................................................................... 201
ColorLimitHigh4 Property ...................................................................... 201
ColorLimitHigh5 Property ...................................................................... 201
ColorLimitLow4 Property ....................................................................... 202
ColorLimitLow5 Property ....................................................................... 202

Printout of the Online Help
Creating Procedures and Actions with VBS

v

Contents

11.05

13.3.3.40
13.3.3.41
13.3.3.42
13.3.3.43
13.3.3.44
13.3.3.45
13.3.3.46
13.3.3.47
13.3.3.48
13.3.3.49
13.3.3.50
13.3.3.51
13.3.3.52
13.3.3.53
13.3.3.54
13.3.3.55
13.3.3.56
13.3.4
13.3.4.1
13.3.4.2
13.3.4.3
13.3.4.4
13.3.4.5
13.3.4.6
13.3.4.7
13.3.4.8
13.3.4.9
13.3.4.10
13.3.4.11
13.3.4.12
13.3.4.13
13.3.4.14
13.3.4.15
13.3.4.16
13.3.4.17
13.3.4.18
13.3.4.19
13.3.4.20
13.3.4.21
13.3.5
13.3.5.1
13.3.5.2
13.3.5.3
13.3.5.4
13.3.5.5
13.3.5.6
13.3.5.7
13.3.5.8
13.3.5.9
13.3.5.10
13.3.5.11
13.3.5.12
13.3.5.13
13.3.6
13.3.6.1

vi

ColorToleranceHigh Property................................................................ 202
ColorToleranceLow Property................................................................. 202
ColorTop Property ................................................................................. 203
ColorWarningHigh Property .................................................................. 203
ColorWarningLow Property ................................................................... 203
ColTitle Property.................................................................................... 203
Command Property ............................................................................... 204
ColWidth Property ................................................................................. 204
CommonTime Property ......................................................................... 204
CommonX Property ............................................................................... 204
CommonY Property ............................................................................... 205
ContinousChange Property ................................................................... 205
Count Property ...................................................................................... 205
CurrentContext Property ....................................................................... 206
Cursor Property ..................................................................................... 206
CursorControl Property.......................................................................... 206
CurveForm Property .............................................................................. 206
D ........................................................................................................ 207
DangerColor Property............................................................................ 207
Danger Property .................................................................................... 207
DataFormat Property ............................................................................. 207
DataIndex Property................................................................................ 208
DataLogs Property................................................................................. 208
DataSet Property ................................................................................... 208
DataX Property ...................................................................................... 208
DataXY Property.................................................................................... 209
DataY Property ...................................................................................... 209
DeleteData Property .............................................................................. 209
Delta Property........................................................................................ 210
DesiredCurveColor Property ................................................................. 210
DesiredCurveCurveForm Property........................................................ 210
DesiredCurveSourceNumberOfUAValues Property.............................. 210
DesiredCurveSourceUAArchive Property ............................................. 211
DesiredCurveSourceUAArchiveStartID Property .................................. 211
DesiredCurveSourceUAColumnX Property .......................................... 211
DesiredCurveSourceUAColumnY Property .......................................... 211
DesiredCurveVisible Property ............................................................... 212
Direction Property.................................................................................. 212
DXFFilename Property .......................................................................... 212
E ........................................................................................................ 213
Edit Property.......................................................................................... 213
Editable Property ................................................................................... 213
EditAtOnce Property.............................................................................. 213
Enabled Property................................................................................... 213
EndAngle Property ................................................................................ 214
EndTime Property.................................................................................. 214
EndValue Property ................................................................................ 214
EndX Property ....................................................................................... 215
EndY Property ....................................................................................... 215
ErrorDescription Property ...................................................................... 215
Exponent Property................................................................................. 216
ExtendedOperation Property................................................................. 216
ExtendedZoomingEnable Property ....................................................... 217
F ........................................................................................................ 217
FillColor Property................................................................................... 217

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Contents

13.3.6.2
13.3.6.3
13.3.6.4
13.3.6.5
13.3.6.6
13.3.6.7
13.3.6.8
13.3.6.9
13.3.6.10
13.3.6.11
13.3.6.12
13.3.6.13
13.3.6.14
13.3.6.15
13.3.6.16
13.3.6.17
13.3.6.18
13.3.6.19
13.3.6.20
13.3.6.21
13.3.6.22
13.3.6.23
13.3.6.24
13.3.6.25
13.3.6.26
13.3.6.27
13.3.6.28
13.3.6.29
13.3.6.30
13.3.6.31
13.3.6.32
13.3.6.33
13.3.6.34
13.3.6.35
13.3.6.36
13.3.6.37
13.3.6.38
13.3.6.39
13.3.6.40
13.3.6.41
13.3.6.42
13.3.6.43
13.3.6.44
13.3.6.45
13.3.6.46
13.3.7
13.3.7.1
13.3.7.2
13.3.7.3
13.3.7.4
13.3.7.5
13.3.7.6
13.3.7.7
13.3.7.8
13.3.7.9

Filling Property....................................................................................... 218
FillingIndex Property.............................................................................. 218
FillStyle Property ................................................................................... 218
FillStyle2 Property ................................................................................. 219
FineGrid Property .................................................................................. 219
FineGridValue Property ......................................................................... 219
FineGridValueX Property ...................................................................... 220
FineGridValueY Property ...................................................................... 220
FineGridX Property................................................................................ 220
FineGridY Property................................................................................ 220
FlashBackColor Property ...................................................................... 220
FlashBorderColor Property.................................................................... 221
FlashFlashPicture Property ................................................................... 221
FlashForeColor Property ....................................................................... 221
FlashPicReferenced Property ............................................................... 221
FlashPicTransColor Property ................................................................ 221
FlashPicture Property ............................................................................ 222
FlashPicUseTransColor Property.......................................................... 222
FlashRate Property................................................................................ 222
FlashRateBackColor Property............................................................... 222
FlashRateBorderColor Property ............................................................ 223
FlashRateFlashPic Property.................................................................. 223
FlashRateForeColor Property ............................................................... 223
Flip Property .......................................................................................... 224
FocusColor Property.............................................................................. 224
FocusRect Property............................................................................... 224
FocusWidth Property ............................................................................. 224
Font Property......................................................................................... 225
FontBold Property.................................................................................. 225
FontItalic Property ................................................................................. 225
FontName Property ............................................................................... 226
FontPosition Property ............................................................................ 226
FontSize Property.................................................................................. 226
FontStrikeThru Property ........................................................................ 226
FontUnderline Property ......................................................................... 226
ForeColor Property ................................................................................ 227
ForeFlashColorOff Property .................................................................. 227
ForeFlashColorOn Property .................................................................. 227
FrameColor Property ............................................................................. 227
FrameColorDown Property.................................................................... 227
FrameColorUp Property ........................................................................ 228
FramePicture Property .......................................................................... 228
FrameScale Property............................................................................. 228
FrameWidth Property ............................................................................ 228
FreezeProviderConnections Property ................................................... 229
G ........................................................................................................ 229
GraphDirection Property........................................................................ 229
GridLineHorz Property........................................................................... 229
GridLines Property................................................................................. 229
GridLineValue Property ......................................................................... 230
GridlinesValueX Property ...................................................................... 230
GridlinesValueY Property ...................................................................... 230
GridLineVert Property............................................................................ 230
GridlinesX Property ............................................................................... 230
GridlinesY Property ............................................................................... 231

Printout of the Online Help
Creating Procedures and Actions with VBS

vii

Contents

11.05

13.3.8
13.3.8.1
13.3.8.2
13.3.8.3
13.3.8.4
13.3.8.5
13.3.8.6
13.3.8.7
13.3.8.8
13.3.8.9
13.3.8.10
13.3.9
13.3.9.1
13.3.9.2
13.3.9.3
13.3.9.4
13.3.9.5
13.3.9.6
13.3.9.7
13.3.9.8
13.3.9.9
13.3.9.10
13.3.10
13.3.10.1
13.3.10.2
13.3.10.3
13.3.10.4
13.3.10.5
13.3.10.6
13.3.10.7
13.3.10.8
13.3.10.9
13.3.10.10
13.3.10.11
13.3.10.12
13.3.10.13
13.3.10.14
13.3.10.15
13.3.10.16
13.3.10.17
13.3.10.18
13.3.10.19
13.3.10.20
13.3.10.21
13.3.10.22
13.3.10.23
13.3.10.24
13.3.10.25
13.3.10.26
13.3.10.27
13.3.10.28
13.3.10.29
13.3.10.30
13.3.10.31
13.3.10.32

viii

H ........................................................................................................ 231
HandFillColor Property .......................................................................... 231
Handtype Property................................................................................. 231
HeaderSort Property.............................................................................. 231
Height Property...................................................................................... 232
HiddenInput Property............................................................................. 232
Hotkey Property..................................................................................... 232
HourNeedleHeight Property .................................................................. 233
HourNeedleWidth Property ................................................................... 233
Hysteresis Property ............................................................................... 233
HysteresisRange Property .................................................................... 233
I
........................................................................................................ 234
Index Property ....................................................................................... 234
InnerBevelOffset Property ..................................................................... 234
InnerBevelStyle Property....................................................................... 234
InnerBevelWidth Property ..................................................................... 235
InsertData Property ............................................................................... 235
ItemBorderBackColor Property ............................................................. 235
ItemBorderColor Property ..................................................................... 235
ItemBorderStyle Property ...................................................................... 236
ItemBorderWidth Property..................................................................... 236
ItemVisible Property .............................................................................. 236
L
..................................................................................................... 237
Label Property ....................................................................................... 237
LabelColor Property............................................................................... 237
LabelX Property..................................................................................... 237
LabelY Property..................................................................................... 237
LanguageSwitch Property ..................................................................... 237
Language Property ................................................................................ 238
LastError Property ................................................................................. 238
Layer Property ....................................................................................... 240
Layer00Checked Property..................................................................... 241
Layer01Checked Property..................................................................... 241
Layer02Checked Property..................................................................... 241
Layer03Checked Property..................................................................... 241
Layer04Checked Property..................................................................... 241
Layer05Checked Property..................................................................... 242
Layer06Checked Property..................................................................... 242
Layer07Checked Property..................................................................... 242
Layer08Checked Property..................................................................... 242
Layer09Checked Property..................................................................... 243
Layer10Checked Property..................................................................... 243
Layer00Color Property .......................................................................... 243
Layer01Color Property .......................................................................... 243
Layer02Color Property .......................................................................... 244
Layer03Color Property .......................................................................... 244
Layer04Color Property .......................................................................... 244
Layer05Color Property .......................................................................... 244
Layer06Color Property .......................................................................... 245
Layer07Color Property .......................................................................... 245
Layer08Color Property .......................................................................... 245
Layer09Color Property .......................................................................... 246
Layer10Color Property .......................................................................... 246
Layer00Value Property.......................................................................... 246
Layer01Value Property.......................................................................... 246

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Contents

13.3.10.33
13.3.10.34
13.3.10.35
13.3.10.36
13.3.10.37
13.3.10.38
13.3.10.39
13.3.10.40
13.3.10.41
13.3.10.42
13.3.10.43
13.3.10.44
13.3.10.45
13.3.10.46
13.3.10.47
13.3.10.48
13.3.10.49
13.3.10.50
13.3.10.51
13.3.10.52
13.3.10.53
13.3.10.54
13.3.10.55
13.3.10.56
13.3.10.57
13.3.10.58
13.3.10.59
13.3.10.60
13.3.10.61
13.3.10.62
13.3.10.63
13.3.10.64
13.3.10.65
13.3.10.66
13.3.10.67
13.3.10.68
13.3.10.69
13.3.10.70
13.3.10.71
13.3.11
13.3.11.1
13.3.11.2
13.3.11.3
13.3.11.4
13.3.11.5
13.3.11.6
13.3.11.7
13.3.11.8
13.3.11.9
13.3.11.10
13.3.11.11
13.3.11.12
13.3.11.13
13.3.11.14
13.3.11.15

Layer02Value Property.......................................................................... 247
Layer03Value Property.......................................................................... 247
Layer04Value Property.......................................................................... 247
Layer05Value Property.......................................................................... 247
Layer06Value Property.......................................................................... 248
Layer07Value Property.......................................................................... 248
Layer08Value Property.......................................................................... 248
Layer09Value Property.......................................................................... 248
Layer10Value Property.......................................................................... 249
LayerDeclutteringEnable Property ........................................................ 249
Layers Property ..................................................................................... 249
Left Property .......................................................................................... 250
LeftComma Property ............................................................................. 250
LightEffect Property ............................................................................... 250
LimitHigh4 Property ............................................................................... 251
LimitHigh5 Property ............................................................................... 251
LimitLow4 Property................................................................................ 251
LimitLow5 Property................................................................................ 251
LimitMax Property.................................................................................. 252
LimitMin Property................................................................................... 252
LineFont Property .................................................................................. 252
LineHeight Property............................................................................... 252
LineTitle Property .................................................................................. 253
LineWidth Property ................................................................................ 253
ListType Property .................................................................................. 253
LoadDataImmediately Property............................................................. 253
LocaleID Property.................................................................................. 254
LockBackColor Property........................................................................ 254
LockStatus Property .............................................................................. 254
LockText Property ................................................................................. 254
LockTextColor Property......................................................................... 255
Logging Property ................................................................................... 255
LongStrokesBold Property .................................................................... 255
LongStrokesOnly Property .................................................................... 255
LongStrokesSize Property..................................................................... 255
LongStrokesTextEach Property ............................................................ 256
LowerLimit Property............................................................................... 256
LowerLimitColor Property...................................................................... 256
LowerLimitValue Property ..................................................................... 257
M
..................................................................................................... 257
Marker Property..................................................................................... 257
Max Property ......................................................................................... 257
MaximizeButton Property ...................................................................... 257
MCGUBackColorOff Property ............................................................... 258
MCGUBackColorOn Property ............................................................... 258
MCGUBackFlash Property .................................................................... 258
MCGUTextColorOff Property ................................................................ 258
MCGUTextColorOn Property ................................................................ 258
MCGUTextFlash Property ..................................................................... 259
MCKOBackColorOff Property................................................................ 259
MCKOBackColorOn Property................................................................ 259
MCKOBackFlash Property .................................................................... 259
MCKOTextColorOff Property................................................................. 259
MCKOTextColorOn Property................................................................. 260
MCKOTextFlash Property ..................................................................... 260

Printout of the Online Help
Creating Procedures and Actions with VBS

ix

Contents

11.05

13.3.11.16
13.3.11.17
13.3.11.18
13.3.11.19
13.3.11.20
13.3.11.21
13.3.11.22
13.3.11.23
13.3.11.24
13.3.11.25
13.3.11.26
13.3.11.27
13.3.11.28
13.3.11.29
13.3.11.30
13.3.12
13.3.12.1
13.3.12.2
13.3.12.3
13.3.12.4
13.3.12.5
13.3.13
13.3.13.1
13.3.13.2
13.3.13.3
13.3.13.4
13.3.13.5
13.3.13.6
13.3.13.7
13.3.13.8
13.3.13.9
13.3.13.10
13.3.13.11
13.3.13.12
13.3.13.13
13.3.13.14
13.3.13.15
13.3.13.16
13.3.13.17
13.3.14
13.3.14.1
13.3.14.2
13.3.14.3
13.3.14.4
13.3.14.5
13.3.14.6
13.3.14.7
13.3.14.8
13.3.14.9
13.3.14.10
13.3.14.11
13.3.14.12
13.3.14.13
13.3.14.14
13.3.14.15

x

MCKQBackColorOff Property................................................................ 260
MCKQBackColorOn Property................................................................ 260
MCKQBackFlash Property .................................................................... 260
MCKQTextColorOff Property................................................................. 261
MCKQTextColorOn Property................................................................. 261
MCKQTextFlash Property ..................................................................... 261
MCText Property ................................................................................... 261
MeasurePoints Property........................................................................ 261
MessageClass Property ........................................................................ 262
Min Property .......................................................................................... 262
MinuteNeedleHeight Property ............................................................... 262
MinuteNeedleWidth Property ................................................................ 262
Moveable Property ................................................................................ 263
MsgCtrlFlags Property........................................................................... 263
MsgFilterSQL Property .......................................................................... 263
N
..................................................................................................... 263
Name Property ...................................................................................... 263
NeedleColor Property ............................................................................ 264
NormalColor Property............................................................................ 264
NumberLines Property........................................................................... 265
NumItems Property................................................................................ 265
O
..................................................................................................... 265
Object Property...................................................................................... 265
ObjectName Property ............................................................................ 266
ObjectSizeDeclutteringEnable Property ................................................ 266
ObjectSizeDeclutteringMax Property .................................................... 267
ObjectSizeDeclutteringMin Property ..................................................... 267
OffsetLeft Property ................................................................................ 268
OffsetTop Property ................................................................................ 268
Online Property...................................................................................... 269
OnTop Property ..................................................................................... 269
OperationMessage Property ................................................................. 269
OperationReport Property ..................................................................... 270
Orientation Property .............................................................................. 270
OuterBevelStyle Property...................................................................... 270
OuterBevelWidth Property..................................................................... 271
Outline Property..................................................................................... 271
OutputFormat Property.......................................................................... 271
OutputValue Property ............................................................................ 271
P-Q ..................................................................................................... 272
Parent Property ..................................................................................... 272
PasswordLevel Property ....................................................................... 273
Path Property......................................................................................... 273
PersistentRT Property ........................................................................... 274
PersistentRTCS Property ...................................................................... 274
PersistentRTCSPermission Property .................................................... 274
PersistentRTPermission Property ......................................................... 275
PicDeactReferenced Property............................................................... 275
PicDeactTransparent Property .............................................................. 275
PicDeactUseTransColor Property ......................................................... 275
PicDownReferenced Property ............................................................... 276
PicDownTransparent Property .............................................................. 276
PicDownUseTransColor Property ......................................................... 276
PicReferenced Property ........................................................................ 276
PicTransColor Property ......................................................................... 277

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Contents

13.3.14.16
13.3.14.17
13.3.14.18
13.3.14.19
13.3.14.20
13.3.14.21
13.3.14.22
13.3.14.23
13.3.14.24
13.3.14.25
13.3.14.26
13.3.14.27
13.3.14.28
13.3.14.29
13.3.14.30
13.3.14.31
13.3.14.32
13.3.14.33
13.3.14.34
13.3.14.35
13.3.14.36
13.3.14.37
13.3.14.38
13.3.14.39
13.3.14.40
13.3.14.41
13.3.15
13.3.15.1
13.3.15.2
13.3.15.3
13.3.15.4
13.3.15.5
13.3.15.6
13.3.15.7
13.3.15.8
13.3.15.9
13.3.15.10
13.3.15.11
13.3.15.12
13.3.15.13
13.3.15.14
13.3.15.15
13.3.15.16
13.3.15.17
13.3.15.18
13.3.15.19
13.3.15.20
13.3.16
13.3.16.1
13.3.16.2
13.3.16.3
13.3.16.4
13.3.16.5
13.3.16.6
13.3.16.7

Picture Property..................................................................................... 277
PictureBack Property............................................................................. 277
PictureDeactivated Property.................................................................. 277
PictureDown Property............................................................................ 278
PictureUp Property ................................................................................ 278
PictureName Property ........................................................................... 278
PictureSelected Property....................................................................... 278
PictureThumb Property ......................................................................... 279
PictureUnselected Property................................................................... 279
PicUpReferenced Property.................................................................... 279
PicUpTransparent Property................................................................... 279
PicUpUseTransColor Property .............................................................. 279
PicUseTransColor Property................................................................... 280
Position Property ................................................................................... 280
Precisions Property ............................................................................... 280
PrecisionX Property............................................................................... 280
PrecisionY Property............................................................................... 281
PredefinedAngles Property ................................................................... 281
Pressed Property................................................................................... 281
PrintJob Property................................................................................... 281
Process Property ................................................................................... 282
ProjectPath Property ............................................................................. 282
ProviderClsid Property........................................................................... 282
ProviderType Property........................................................................... 282
PointCount Property .............................................................................. 283
QualityCode Property ............................................................................ 283
R
..................................................................................................... 284
Radius Property..................................................................................... 284
RadiusHeight Property .......................................................................... 284
RadiusWidth Property............................................................................ 284
RangeMax Property............................................................................... 284
RangeMin Property................................................................................ 284
Rectangular Property............................................................................. 285
ReferenceRotationLeft Property............................................................ 285
ReferenceRotationTop Property............................................................ 285
RelayCurves Property ........................................................................... 285
Relevant Property.................................................................................. 286
Replacement Property........................................................................... 286
ReplacementColor Property .................................................................. 286
RightComma Property ........................................................................... 286
Rotation Property................................................................................... 287
RotationAngle Property ......................................................................... 287
RoundCornerHeight Property................................................................ 287
RoundCornerWidth Property ................................................................. 287
RulerPrecisions Property....................................................................... 288
RulerPrecisionX Property ...................................................................... 288
RulerPrecisionY Property ...................................................................... 288
S
..................................................................................................... 288
SameSize Property................................................................................ 288
ScaleColor Property .............................................................................. 289
ScaleTicks Property............................................................................... 289
Scaling Property .................................................................................... 289
ScalingType Property ............................................................................ 289
ScalingTypeX Property.......................................................................... 290
ScalingTypeY Property.......................................................................... 290

Printout of the Online Help
Creating Procedures and Actions with VBS

xi

Contents

11.05

13.3.16.8
13.3.16.9
13.3.16.10
13.3.16.11
13.3.16.12
13.3.16.13
13.3.16.14
13.3.16.15
13.3.16.16
13.3.16.17
13.3.16.18
13.3.16.19
13.3.16.20
13.3.16.21
13.3.16.22
13.3.16.23
13.3.16.24
13.3.16.25
13.3.16.26
13.3.16.27
13.3.16.28
13.3.16.29
13.3.16.30
13.3.16.31
13.3.16.32
13.3.16.33
13.3.16.34
13.3.16.35
13.3.16.36
13.3.16.37
13.3.16.38
13.3.16.39
13.3.16.40
13.3.16.41
13.3.16.42
13.3.16.43
13.3.16.44
13.3.16.45
13.3.16.46
13.3.16.47
13.3.16.48
13.3.16.49
13.3.16.50
13.3.16.51
13.3.16.52
13.3.16.53
13.3.16.54
13.3.16.55
13.3.16.56
13.3.16.57
13.3.16.58
13.3.17
13.3.17.1
13.3.17.2
13.3.17.3

xii

Screen Property..................................................................................... 290
ScreenName Property ........................................................................... 291
Screens Property................................................................................... 291
ScreenItems Property............................................................................ 291
Scrollable Property ................................................................................ 292
ScrollBars Property................................................................................ 292
ScrollPositionX Property........................................................................ 292
ScrollPositionY Property........................................................................ 293
SecondNeedleHeight Property.............................................................. 293
SecondNeedleWidth Property ............................................................... 293
SelBGColor Property ............................................................................. 294
SelectionMode Property ........................................................................ 294
SelectionRectColor Property ................................................................. 294
SelectionRectWidth Property ................................................................ 294
SelectionType Property ......................................................................... 295
SelTextColor Property ........................................................................... 295
ServerData Property.............................................................................. 295
ServerPrefix Property ............................................................................ 295
ServerNames Property .......................................................................... 296
ShowBar Property ................................................................................. 296
ShowDanger Property ........................................................................... 296
ShowDecimalPoint Property.................................................................. 296
ShowNormal Property ........................................................................... 297
ShowPeak Property............................................................................... 297
ShowPosition Property .......................................................................... 297
ShowRulerImmediately Property........................................................... 297
ShowThumb Property............................................................................ 298
ShowValuesExponentialX Property....................................................... 298
ShowValuesExponentialY Property....................................................... 298
ShowWarning Property ......................................................................... 298
SignificantMask Property....................................................................... 299
Sizeable Property .................................................................................. 299
SmallChange Property .......................................................................... 299
SourceBeginTime Property ................................................................... 299
SourceEndTime Property ...................................................................... 300
SourceNumberOfUAValues Property.................................................... 300
SourceNumberOfValues Property......................................................... 300
SourceTagNameX Property .................................................................. 301
SourceTagNameY Property .................................................................. 301
SourceTagProviderDataX Property....................................................... 301
SourceTagProviderDataY Property....................................................... 301
SourceTimeRange Property.................................................................. 302
SourceUAArchive Property ................................................................... 302
SourceUAArchiveStartID Property ........................................................ 302
SourceUAColumnX Property................................................................. 303
SourceUAColumnY Property................................................................. 303
SquareExtent Property .......................................................................... 303
StartAngle Property ............................................................................... 303
Statusbar Property................................................................................. 304
StatusbarPanes Property ...................................................................... 304
Stretch Property..................................................................................... 304
T
..................................................................................................... 304
TagName Property ................................................................................ 304
TagPrefix Property................................................................................. 305
Tags Property ........................................................................................ 305

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Contents

13.3.17.4
13.3.17.5
13.3.17.6
13.3.17.7
13.3.17.8
13.3.17.9
13.3.17.10
13.3.17.11
13.3.17.12
13.3.17.13
13.3.17.14
13.3.17.15
13.3.17.16
13.3.17.17
13.3.17.18
13.3.17.19
13.3.17.20
13.3.17.21
13.3.17.22
13.3.17.23
13.3.17.24
13.3.17.25
13.3.17.26
13.3.17.27
13.3.17.28
13.3.17.29
13.3.17.30
13.3.17.31
13.3.17.32
13.3.17.33
13.3.17.34
13.3.17.35
13.3.17.36
13.3.17.37
13.3.17.38
13.3.17.39
13.3.17.40
13.3.17.41
13.3.17.42
13.3.17.43
13.3.17.44
13.3.17.45
13.3.17.46
13.3.17.47
13.3.17.48
13.3.17.49
13.3.17.50
13.3.17.51
13.3.17.52
13.3.17.53
13.3.17.54
13.3.17.55
13.3.17.56
13.3.17.57
13.3.18

TagProviderClsid Property .................................................................... 305
Template Property ................................................................................. 306
Text Property ......................................................................................... 306
ThumbBackColor Property .................................................................... 307
TicColor Property................................................................................... 307
TicFont Property .................................................................................... 307
TicOffset Property.................................................................................. 307
TicTextColor Property............................................................................ 308
TicTextOffset Property........................................................................... 308
TicWidth Property .................................................................................. 308
Ticks Property........................................................................................ 309
TicksColor Property ............................................................................... 309
TickStyle Property ................................................................................. 309
TimeAxis Property ................................................................................. 309
TimeAxisFormat Property...................................................................... 310
TimeAxisX Property............................................................................... 310
TimeColumnAlignment Property ........................................................... 310
TimeFormat Property............................................................................. 311
TimeJump Property ............................................................................... 311
TimeJumpColor Property ...................................................................... 311
TimeOverlap Property ........................................................................... 312
TimeOverlapColor Property................................................................... 312
TimeRange Property ............................................................................. 312
TimeRangeBase Property ..................................................................... 313
TimeRangeFactor Property ................................................................... 313
TimeStamp Property.............................................................................. 313
TimeZone Property................................................................................ 314
TitleCut Property.................................................................................... 315
Titleline Property.................................................................................... 315
Toggle Property ..................................................................................... 315
ToleranceHigh Property ........................................................................ 315
ToleranceLow Property ......................................................................... 316
ToolbarAlignment Property.................................................................... 316
ToolbarButtons Property ....................................................................... 316
Toolbar Property.................................................................................... 317
ToolbarHotKeys Property ...................................................................... 317
ToolTipText Property ............................................................................. 317
Top Property.......................................................................................... 318
TopConnectedConnectionPointIndex Property..................................... 319
TopConnectedObjectName Property .................................................... 319
Transparent Property............................................................................. 319
Trend Property....................................................................................... 319
TrendColor Property .............................................................................. 320
Type Property ........................................................................................ 320
TypeAlarmHigh Property ....................................................................... 321
TypeAlarmLow Property ........................................................................ 322
TypeLimitHigh4 Property ....................................................................... 322
TypeLimitHigh5 Property ....................................................................... 322
TypeLimitLow4 Property........................................................................ 322
TypeLimitLow5 Property........................................................................ 323
TypeToleranceHigh Property ................................................................ 323
TypeToleranceLow Property ................................................................. 323
TypeWarningHigh Property ................................................................... 323
TypeWarningLow Property.................................................................... 324
U
..................................................................................................... 324

Printout of the Online Help
Creating Procedures and Actions with VBS

xiii

Contents

11.05

13.3.18.1
13.3.18.2
13.3.18.3
13.3.18.4
13.3.18.5
13.3.18.6
13.3.18.7
13.3.18.8
13.3.18.9
13.3.18.10
13.3.18.11
13.3.18.12
13.3.18.13
13.3.18.14
13.3.19
13.3.19.1
13.3.19.2
13.3.19.3
13.3.19.4
13.3.19.5
13.3.19.6
13.3.19.7
13.3.19.8
13.3.19.9
13.3.19.10
13.3.19.11
13.3.19.12
13.3.19.13
13.3.19.14
13.3.19.15
13.3.19.16
13.3.19.17
13.3.19.18
13.3.19.19
13.3.19.20
13.4
13.4.1
13.4.2
13.4.3
13.4.4
13.4.5
13.4.6
13.4.7
13.4.8
13.4.9
13.4.10
13.4.11
13.4.12
13.5
13.5.1

14

Examples of VBScript ..................................................................... 359
14.1
14.1.1
14.1.2

xiv

UnitColor Property ................................................................................. 324
UnitFont Property .................................................................................. 324
UnitOffset Property ................................................................................ 325
UnitText Property................................................................................... 325
UnselBGColor Property ......................................................................... 325
UnselTextColor Property ....................................................................... 325
UserValue1 Property ............................................................................. 326
UserValue2 Property ............................................................................. 326
UserValue3 Property ............................................................................. 326
UserValue4 Property ............................................................................. 326
UpdateCycle Property ........................................................................... 327
UpperLimit Property............................................................................... 327
UpperLimitColor Property...................................................................... 327
UpperLimitValue Property ..................................................................... 327
V-Z ..................................................................................................... 328
ValueColumnAlignment Property .......................................................... 328
Value Property....................................................................................... 328
ValueMax Property ................................................................................ 329
ValueMin Property ................................................................................. 329
Variable Property................................................................................... 329
Visible Property ..................................................................................... 329
Warning Property................................................................................... 330
WarningColor Property .......................................................................... 330
WarningHigh Property ........................................................................... 330
WarningLow Property ............................................................................ 331
Width Property....................................................................................... 331
WindowBorder Property ........................................................................ 332
WindowsStyle Property ......................................................................... 332
WindowType Property ........................................................................... 332
WithAxes Property................................................................................. 333
WithLabels Property .............................................................................. 333
ZeroPoint Property ................................................................................ 333
ZeroPointValue Property ....................................................................... 333
Zoom Property....................................................................................... 334
Zoomable Property ................................................................................ 334
Methods................................................................................................. 335
Activate Method..................................................................................... 335
Add Method ........................................................................................... 336
CreateTagSet Method ........................................................................... 338
Item Method........................................................................................... 338
Read Method ......................................................................................... 339
Refresh Method ..................................................................................... 343
Remove Method .................................................................................... 344
RemoveAll Method ................................................................................ 347
Restore Method ..................................................................................... 349
Stop Method .......................................................................................... 352
Trace Method ........................................................................................ 352
Write Method ......................................................................................... 353
Appendix................................................................................................ 356
Error Messages from Database Area.................................................... 356

Examples in WinCC............................................................................... 359
Example: Accessing objects in Graphics Designer............................... 359
Example: Defining the color of objects .................................................. 360

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Contents

14.1.3
14.1.4
14.1.5
14.1.6
14.1.7
14.1.8
14.1.9
14.1.10
14.2
14.2.1
14.2.2
14.2.3
14.2.4
14.2.5

15

Example: Configuring language changes.............................................. 360
Example: Deactivating runtime.............................................................. 361
Example: Configuring change picture globally ...................................... 361
Example: Configuring Change Picture Via Property ............................. 361
Example: Configuring diagnostic output via Trace................................ 362
Example: Writing tag values.................................................................. 363
Example: How to Read Tag Values ...................................................... 365
Example: Writing Object Properties ...................................................... 367
General examples for VBScript ............................................................. 370
Example: Configuring a Database Connection with VBS...................... 371
Example: CCalling Methods of an ActiveX Control ............................... 373
Example: Using the MS Automation interface....................................... 375
Example: Starting an external application ............................................. 376
Example: How to Start an Action on the Server (Logging Object) ........ 377

Basic Principles of VBScript........................................................... 379

Printout of the Online Help
Creating Procedures and Actions with VBS

xv

Contents

xvi

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

1

Using Visual Basic Script in WinCC

Using Visual Basic Script in WinCC

Introduction
In addition to the C script, WinCC also provides the VBScript program language as
a programming interface in order to make the WinCC runtime environment
dynamic.

Target Group of the Documentation
This documentation is aimed at project engineers having experience with Visual
Basic or WinCC Scriptings (C).

Application Possibilities
VBScript (VBS) provides access to tags and objects of the graphical runtime
system at runtime and can execute picture-independent functions:


Tags: Tag values can be read and written in order, for example, to specify tag
values for the PLC by clicking the mouse when positioned on a button.



Objects: Object properties can be made dynamic using actions. Actions can be
triggered by events influencing objects.



Picture-independent Actions: Picture-independent actions can be triggered
cyclically or according to tag values, e.g. for the daily transfer of values into an
Excel table.

VBS can be used at the following points in WinCC:


In the Global Script Editor: This is used to configure picture-independent
actions and procedures. The procedures can be used in picture-dependent and
picture-independent actions. Several procedures are compiled in a topicrelated module.



In Graphics Designer: Picture-dependent actions can be configured with which
the properties of graphic objects can be made dynamic or caused to respond
to events in runtime.

Application Scenarios
VBS can be used in runtime, for example:


to configure setpoint value specification for tags for the operation of a graphic
object in order to define a value for the PLC by clicking a mouse.



to configure switching the runtime language for the operation of a graphic
object.



to configure the change of color, e.g. cyclically (flashing) or to display statuses
(motor on).

Printout of the Online Help
Creating Procedures and Actions with VBS

1

Using Visual Basic Script in WinCC

11.05

Apart from the specific WinCC applications, the general functionality of VBS can
also be used to customize the Windows environment, e.g.:


to transfer data to another application (e.g. Excel).



to start external applications from WinCC.



to create files and folders.

The automation objects in your environment are available with which to customize
the Windows environment.
Note:
All the objects supplied with the Windows Script Host (WSH) from Microsoft can
be integrated in the environment using the standard VBS method CreateObject.
However, direct access to the WSH object is not possible using VBS from WinCC.
Note:
There is no guarantee for VBS functionally to customize the Windows environment
and no WinCC support.
Limits to Other Programming Languages in WinCC
VBS and C
VBScript can be used in WinCC, parallel to C-Script, but do not mix the script
types:


VBScripts and C-scripts can be configured within a picture and project.



C-scripts cannot be invoked in VBScripts and vice versa.



VBS provides internal interfaces to tags and picture objects while the C
environment enables access to other WinCC subsystems (e.g. the report
system).

VBS and VBA
VBA is used in WinCC Configuration during the configuration in order to adapt
Graphics Designer to your individual requirements and to simplify and automate
configuration. VBA programs only run in the WinCC configuration environment.
As opposed to VBA, VB scripts only run in WinCC Runtime and, from there, enable
access to graphic objects and tags. Objects and pictures can be neither created
nor modified on a permanent basis in VBS, as opposed to VBA.
The main language-related differences between VBA and VBS are e.g.:



The data type of VBS tags is always VARIANT. VBA, on the other hand,
differentiates the individual data types such as INT, DOUBLE, STRING, etc.



Certain language constructed from VBA have been removed from or added to
VBS.



2

VBS was developed for use in Internet, VBA for the automation of software
applications.

Faults are handled differently in VBS as compared to VBA.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Using Visual Basic Script in WinCC

A complete list of the differences between VBA and VBS is provided in the
Appendix in " Basic Principles of VBScript " .

Procedures, Modules and Actions
VBS in WinCC enables the use of procedures, modules and actions to make the
Runtime environment dynamic:


Procedures: A procedure corresponds to a function in C. Codes are stored in
procedures which are then used at several points in the configuration. Call in
the code or another procedure in an action by invoking the procedure name.
Procedures can be created in WinCC with or without return values. Procedures
do not have their own trigger, They are always called in by an action.



Modules: It is advantageous to compile related procedures to units in modules.
Create modules for procedures, for example, which must be used in a specific
picture or belong to a specific topic, such as auxiliary mathematical functions or
database access functions.



Actions: Actions are always activated by a trigger, namely a triggering event.
Actions are configured in graphic object properties, in events which occur on a
graphic object, or globally in a project. Codes used several times can be called,
in the form of procedures, in actions.

Printout of the Online Help
Creating Procedures and Actions with VBS

3

Using Visual Basic Script in WinCC

4

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

2

Modules and Procedures

Modules and Procedures

Introduction
Procedures are used to make codes, created only once, available at several points
in a project. Instead of entering the code several times, simply call in the
corresponding procedure. The code is clearer and easier to maintain.

Related procedures should be stored in modules. When a certain procedure is
called in via an action during runtime, the module is loaded which contains that
procedure. Observe the following when structuring the modules and procedures:


The more modules which must be loaded when a picture is called in, the worse
the performance in runtime.



The larger a module, the more procedures are contained and, thus, the longer
the loading time for the module.

Organize the modules sensibly, e.g. a module with procedures for a specific
system part/picture.

Printout of the Online Help
Creating Procedures and Actions with VBS

5

Modules and Procedures

11.05

Another type of structuring of procedures in modules is the functional structuring,
e.g. a module containing mathematical functions. Use this structure, for example,
for modules which should be used globally for projects. The following example
illustrates a module containing mathematical functions derived from the standard
functions:

Procedure Features
The procedures in WinCC have the following properties:


They are created and modified by the user.



They can be protected against modification and viewing by means of a
password.



They do not have a trigger.



They are stored in a module.

WinCC does not provide predefined procedures, but does provide code templates
and Intellisense, for example, to simplify programming. Procedures differ according
to module assignment:



6

Standard procedures apply globally to projects located on the computer on
which they were created.
Project procedures can only be used in the project in which they were created.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Modules and Procedures

Module Features
A module is a file in which one or more procedures are stored. The modules in
WinCC have the following properties:


They can be protected against modification and viewing by means of a
password.



The have the file extension *.bmo.

Modules differ according to the validity of their procedures in:


Standard Modules: Contain procedures which are globally available to the
project. Standard modules are stored in the WinCC file system under: & lt; WinCC
installation directory & gt; \ApLib\ScriptLibStd\ & lt; Module name & gt; .bmo



Project Modules: Contain project-specific procedures. Project modules are
stored in the WinCC file system under: & lt; Project directory & gt; \ScriptLib\ & lt; Module
name & gt; .bmo. Since the project modules are stored in the project directory, they
are copied when the WinCC project is copied.

Note:
If WinCC must be reinstalled and the standard procedures and modules need to
be used again, save the module files prior to the reinstallation in a different
directory and copy them in the relevant WinCC directory after the reinstallation has
been completed. Otherwise, the standard modules in the WinCC installation
directory are deleted during the installation routine.
Using Procedures and Modules
Procedures are used in:


Actions (in Graphics Designer and Global Script)



Other procedures (in Global Script)

Procedures are structured in modules.

Printout of the Online Help
Creating Procedures and Actions with VBS

7

Modules and Procedures

8

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

3

Actions

Actions

Introduction
An action is always started by a trigger. An action, for example, is triggered in
Runtime when an object is operated by a mouse click, a certain time has occurred
or a tag has been modified.

Action Features
Actions are defined once in Global Script and then available independent of the
picture. Global Script actions are only valid in the project in which they were
defined. Actions linked to a graphic object are only valid in the picture in which they
were defined.
Note:
VBS does not currently allow the creation of computer-specific actions.
The following applies for clients in a multi-user system: All global actions
configured on a server are also executed on a client when a project is opened.
The following applies for clients in a distributed system: If actions should be used
on a client computer, copy all the action files in the corresponding project directory
on the client.
Actions have the following properties:


Actions are created and modified by the user.



Actions in Global Script can be protected against modification and viewing by
means of a password.



Actions have at least one trigger.



Actions in Global Script have the file extension *.bac.



Global Script actions are stored in the WinCC file system under: & lt; Project
directory & gt; \ScriptAct\Actionname.bac

Action Trigger
Triggers are required to execute actions in Runtime. A trigger is linked to an action
thus forming the triggering event which calls the action. Actions without a trigger
are not executed.
The following trigger types are available in WinCC:


Timer: Acyclic or cyclic trigger, e.g. for calling a picture or every hour.



Tag: Change of value



Event: Modification of object properties (e.g. change of color) or event on an
object (e.g. mouse click).

Printout of the Online Help
Creating Procedures and Actions with VBS

9

Actions

11.05

Processing of Actions in Runtime
In Graphics Designer:
Two actions of the same type can be executed simultaneously in Runtime. In
order, for example, that cyclic actions are not hindered by an action executed by a
mouse click, event triggered actions and cyclic/tag triggered actions in Graphics
Designer are executed independently of each other.
Note:
Please note that synchronization between both action types in WinCC may only be
executed by the DataSet object or by internal WinCC tags. As a result of the
separate processing, no common data area exists between event triggered and
cyclic/tag triggered actions.
If processing cyclic actions in pictures, for example, is prevented by a high system
load or another action, the action is started once at the next opportunity. Cycles
which are not executed are not retained in a queue but rejected.
After a change of picture, scripts still running are automatically stopped 1 minute
after the change of picture.
Scripts which are still running when runtime is terminated are stopped after 5
seconds.
In Global Script
Picture-independent actions from Global Script are executed in runtime in
succession after being triggered. If an action is triggered while another action is in
progress, the second action is retained in a queue until it can be executed.
Note:
Please note that synchronization between actions in Global Script and in Graphics
Designer may only be executed by the DataSet object or by internal WinCC tags.
There is no common data area between the actions in Graphics Designer and in
Global Script.
Using the Actions
Actions can be used as follows:



10

In Global Script: The global actions defined here run picture-independent in
Runtime.
In Graphics Designer: The actions defined here only run in the configured
picture. An action is configured in Graphics Designer on an object property or
an event on a graphic object.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

4

Multiple Use of Procedures and Actions

Multiple Use of Procedures and Actions

Introduction
An action configured with VBS in WinCC is always valid for the project in which it
was defined.
Procedures have the following areas of application:


Standard procedures apply globally to projects located on the computer on
which they were created.



Project procedures can only be used in the project in which they were created.
If a project is copied, the project procedures (modules) are copied together
with the project.

If actions or procedures/modules are to be used in other projects or on other
computers, it is possible either to:


use the " Save As " function to store the action or module in a different project
directory or, for example, on a disk.



to copy the action or module file in Windows Explorer and paste it in the
corresponding project or standard directory on the target computer.

The properties and triggers configured are retained during copying. Copied
modules are directly available in runtime. Copied actions are executed in runtime
after they have been opened and stored once.
Note:
Tags used in an action or procedure must also be available on the target
computer. If the tag is not available, the action or procedure is not executed.
Procedures which are called in an action must be available on the target
computer. If the procedure is not available, a runtime error occurs during runtime.
Storing Procedures
If procedures need to be copied in other project directories in order to be able to
use then in other projects or on different computers, observe the storage path of
the procedures in the WinCC file system:


Standard procedures: & lt; WinCC installation
directory & gt; \ApLib\ScriptLibStd\Module name.bmo



Project procedures: & lt; Project directory & gt; \ScriptLib\Module name.bmo

Note:
Since procedures are always stored in modules, always copy the module (*.bmo)
in which the procedure is contained.
The copied procedures/modules are visible after updating the Global Script
navigation window (context menu command " Update " ) or restarting the editor.

Printout of the Online Help
Creating Procedures and Actions with VBS

11

Multiple Use of Procedures and Actions

11.05

Storing Actions
If actions need to be copied in other project directories in order to be able to use
then in other projects or on different computers, observe the storage path of the
actions in the WinCC file system:
& lt; Project directory & gt; \ScriptAct\Actionname.bac
Each action is stored in a separate file. When an action is copied, all the triggers
related to it are also copied.
Note:
Only actions created in Global Script are stored in the WinCC file system. Actions
which are programmed in Graphics Designer are always stored with the current
picture and cannot be transferred individually. If a Graphics Designer picture is
copied into another project directory, the actions stored with the picture are also
copied.
The copied actions are visible after updating the Global Script navigation window
(context menu command " Update " ) or restarting the editor.

12

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

5

Use of CrossReference

Use of CrossReference

CrossReference and Tag Trigger
The CrossReference from WinCC can be used to quickly find all the application
points of tags, even in VBS actions. Tag triggers in actions in Graphics Designer
can be " linked " using CrossReference, i.e. replaced by other tags at all or selected
points.
Note:
Tags can also be directly linked in Graphics Designer by marking the graphic
object and selecting the " LInking ... " command from the context menu.
Further information on CrossReference is available in the WinCC documentation.

Actions and CrossReference
All the actions used in a picture can be displayed by means of the picture
properties. To do this mark the picture in WinCC Explorer and select the
" Properties " context menu command. After double clicking on an entry, detailed
information on the type of dynamics appears.
It is also possible to display all the tags and pictures used in actions by means of
the WinCC CrossReference. CrossReference can also be used for the to link tag
connections of Graphics Designer actions easily.
Note:
For pictures and tags addresses in your code, always use the standard
formulations
HMIRuntime.BaseScreenName = " Screenname " and HMIRuntime.Tags
( " Tagname " ) to ensure that pictures and tags are detected by CrossReference.
Tags and CrossReference
All tags addressed with the standard formulation
' VBS1
HMIRuntime.Tags( " Tagname " )
are automatically acquired by WinCC CrossReference and listed in the picture
properties.
If the tags should be addressed with other formulations in the code, this can be
notified using the following section of CrossReference:
' WINCC:TAGNAME_SECTION_START
Const TagNameInAction = " TagName "
' WINCC:TAGNAME_SECTION_END
This section can be inserted in VBS actions as often as required.

Printout of the Online Help
Creating Procedures and Actions with VBS

13

Use of CrossReference

11.05

Note:
The acquisition of combined tag names fro the CrossReference cannot be
guaranteed.
Pictures and CrossReference
All pictures addressed with the standard formulation
'VBS2
HMIRuntime.BaseScreenName = " Screenname "
are automatically acquired by WinCC CrossReference and listed in the picture
properties.
If the pictures should be addressed with other formulations in the code, this can be
notified using the following section of CrossReference:
' WINCC:SCREENNAME_SECTION_START
Const ScreenNameInAction = " ScreenName "
' WINCC:SCREENNAME_SECTION_END
This section can be inserted in VBS actions as often as required.
Note:
For reasons of compatibility to future versions, always write picture names without
the file name extension " .PDL " .

14

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

6

Using Global Tags in VBS

Using Global Tags in VBS

Introduction
Global tags can be defined in the Global Script Editor which can then be used in all
actions and procedures.

Using Global Tags in Graphics Designer and Global Script
Observe the following conditions when using global tags in Graphics Designer and
Global Script:


In order to use a global tag in an action in Graphics Designer, call in the
procedure in which the tag is defined so that the associated module is loaded
in runtime.



In order to use a global tag in an action in Global Script, at least one procedure
must be activated from the module in at least one global action in which the tag
is defined so that the module is loaded in Global Script Runtime. This need not
be the procedure in which the tag was defined.

This process is necessary because actions from Global Script and Graphics
Designer are processed independently of each other in runtime. There is no
common data area between the two runtime systems.
If you need to synchronize actions from Global Script and Graphics Designer, use
the DataSet object or internal WinCC tags.

Using Global Tags in Graphics Designer
When using global tags in Graphics Designer, observe the following conditions:


In order to use a global tag in cyclic or tag triggered action in Graphics
Designer, call in the procedure in which the tag is defined. This also applies
when the tag has already been called in an event triggered action.



In order to use a global tag in an event triggered action in Graphics Designer,
call in the procedure in which the tag is defined. This also applies when the tag
has already been called in a cyclic or tag triggered action.

This process is necessary because the cyclic/tag triggered actions and the event
triggered actions in Graphics Designer in Runtime are processed independently of
each other in Runtime. There is no common data area between the two types of
action.
If you need to synchronize cyclic or tag-triggered actions and event-triggered
actions, use the DataSet object or internal WinCC tags.
In the case of Graphics Designer, it is also possible to define global tags in a
separate declaration section. Since event triggered and cyclic/tag triggered actions
are separately processed in runtime, the global tags can only be jointly addressed
within the event triggered or cyclic/tag triggered actions.

Printout of the Online Help
Creating Procedures and Actions with VBS

15

Using Global Tags in VBS

16

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

7

VBScript Editors

VBScript Editors

Introduction
VBScripts can be programmed at two points in WinCC:


In Global Script: Global Script is the central editor for VBS programming. Call it
in via WinCC Explorer.

Global Script can be used to program global actions, which are independent of the
picture and are not linked to a graphic object, and procedures, which can be
activated in other actions or procedures.


In Graphics Designer: Graphics Designer can be used to program actions
related to object properties or events related to graphic objects. The action
editor in Graphics Designer is called in via the context menu in the Properties
dialog of a graphic object.

Graphics Designer can be used to make object properties dynamic and trigger
actions through events on objects.

Printout of the Online Help
Creating Procedures and Actions with VBS

17

VBScript Editors

11.05

Restrictions, Global Script - Graphics Designer
Graphics Designer can be used to program actions and picture-specific procedures
but not global procedures valid for the entire project. However, global procedures
which were programmed in Global Script can be called in.
Note:
This documentation is used primarily to describe Global Script and makes
reference to deviations in the functionality compared to Graphics Designer. A
detailed description of the Graphics Designer action editor is provided in the
WinCC help topic " Dynamization " .

18

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

7.1

VBScript Editors

Global Script Editor

Introduction
Global procedures and actions are created and edited in the Global Script Editor.
Global Script provides a similar range of functions to that of the C script editor in
WinCC.
Note:
A detailed description of the action editor for the creation of picture-dependent
actions and procedures in Graphics Designer is provided under the WinCC help
topic " Dynamics " .
Calling Global Script
Global Script is started using the context menu " Open " command in the WinCC
Explorer project window.

Global Script is also automatically called in when a module or action is opened by
means of a double click in WinCC Explorer.

Printout of the Online Help
Creating Procedures and Actions with VBS

19

VBScript Editors

11.05

Design of Global Script
Global Script editor is designed in accordance with the Windows standards.
The action editor in the Graphics Designer provides a similar range of functions to
that of Global Script. A description of the Graphics Designer action editor is
provided in the WinCC help topic " Dynamization " .

Menu bar (1) and toolbars (2)
All the commands required to create procedures and actions are provided in the
menu bar and toolbars.
The toolbars can be displayed and hidden using the " View " & gt; " Toolbars " command
and can be moved to any position within the editor.
Navigation window (3)
The navigation window is used to manage the procedures, modules and actions. It
also contains code templates which can be inserted into an action or procedure per
drag & drop.
A procedure can be called in another procedure or action by dragging them from
the navigation window and dropping them at the relevant point in the code.
The display in the navigation window is updated when the edited document is
stored. When a file is actually being modified, it is indicated by a * behind the file
name.
The procedures contained in a module are displayed in the navigation window
underneath the module file. The Actions tab control also displays the trigger and
procedures configured for an action, if necessary those directly defined in an action
module.

20

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBScript Editors

The navigation window can still be used to:


Create subdirectories for structuring the scripts.



Move, copy, paste, delete and rename modules and directories directly.

The display in the navigation window can be individually configured with the " View "
& gt; " Workplace " menu commands. It is possible to select whether all file types, only
script files or only syntactically correct files should be displayed. The navigation
window can be shown or hidden with the " View " & gt; " Workplace " & gt; " Display " menu
commands.
Editor window (4)
Procedures and actions are written and edited in the Editor window. Each
procedure or action is opened in its own editing window. Several editing windows
can be open at the same time.
The user is supported by in the Editor window by Highlight Syntax and Intellisense.
All general editor functions (e.g. Undo/Redo, Find/Replace, Copy, Paste, Cut, Font
Settings, Printer Settings) remain available.
Output window (5)
Error messages are displayed in the output window following the syntax check.
Double click on the corresponding error line to access the related point in the code.
Status bar (6)
The status bar contains information on the currently selected functionality or hints
on programming.
Note:
If information on individual editor commands or icons is required, select the " ? "
menu icon. & gt; What's This? Then click the mouse button on the corresponding
icon/command. This provides fast, direct help on all the operating elements in the
editors. Press " ESC " to exit " What's This? " help mode.

Printout of the Online Help
Creating Procedures and Actions with VBS

21

VBScript Editors

7.2

11.05

Working in an Editor Window

Introduction
Procedures and actions are edited in the editor window.

Declaration Areas in Actions (Graphics Designer only)
If actions are created in the Graphics Designer action editor, use the
call up the declaration area of the action in the editor window.

button to

The declaration area can also be used to make general settings to be used globally
for the current picture, e.g.:


tag definitions



procedures which you only want to use in this picture

Note:
Do not create any directly executable codes in the declaration area!
Note:
Please note that when creating a tag, it must not contain a value (Value =
VT_EMPTY). Initialize the tags after declaration with the corresponding value.
For definitions in the declaration area, pay attention to the structure of the Script
files, as described under " Structure of VBScript files " .

" Option explicit " in Actions
When creating a new action, the " Option explicit " instruction is automatically set
and cannot be deleted in the declaration area (Graphics Designer) or entered in
the first line of an action (Global Script). The instruction is necessary as it prevents
errors caused by the incorrect notation of tags without declaration. he instruction
requires that the tags are always specified with the instruction " Dim " in the code.
Note:
Do not use the " Option explicit " instruction in the code as this can cause runtime
errors.

22

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBScript Editors

User Support in Editor Window
The following functions are available to support working in the editor window.
Color coding and indentation in the editor window
Certain parts of the code have the following default colors:
Color

Significance

Example

Blue

Key Words
Functions

Sub, End Sub,
Next

Green

Comments

' is a comment

Red

Strings (character strings and
digits)

" Object1 "

Dark blue

Preprocessor statements

--

Bold black

Constants

vbTrue, vbFalse

Black

Other codes

--

The color coding in the editor window can be customized by means of the editor
settings. Select the " Tools " & gt; " Options " menu commands and the " Script Editor
Options " dialog to define the settings.
In order to organize the codes clearly, they can be structured by indentations. The
" Script Editor Options " dialog can also be used to define the tabulator distance and
Automatic Indent while writing.
Intellisense and Highlight Syntax
During text entry, context-sensitive lists appear containing the properties, methods,
and objects possible at the current code position. If you insert an element from the
list, the required syntax is also indicated automatically.
Note:
Full intellisense for all objects can only be utilized in the Graphics Designer if the
list is accessed using the object name and the result is assigned to a tag.
Otherwise, only a list of standard properties is offered.
Example of full intellisense:
Dim Tag
Set Tag = ScreenItems ( " Circle1 " )
Tag.
If picture window limits are exceeded during addressing, it is once again only the
standard properties which are offered since the picture of the picture window is not
loaded.
Highlight Syntax can be activated and deactivated in the " Script Editor Options "
dialog. The dialog can be called in using the " Tools " & gt; " Options " menu commands.
General VBS Functions
Use the " Function List " context menu command in the editor window to display a
list of general VBS functions.

Printout of the Online Help
Creating Procedures and Actions with VBS

23

VBScript Editors

11.05

Listing Objects, Properties and Methods
Using the context menu in the Editor window you can view a list of the possible
objects by calling the " Object List " command in the Graphics Designer. Global
Script only provides the HMIRuntime object in this list because there is no direct
access to the objects of Graphics Designer.
Use the " Properties/Methods " context menu command to acquire a list of the
possible properties and methods.
The same lists can be called in with the key combination & lt; CTRL + Spacebar & gt; but
according to the context of the script.
Code Templates
In the " Code Templates " tab in the Navigation window of the Editor, you will find a
selection of frequently used instructions, e.g. for loops and conditional instructions.
The templates can be inserted in the procedure codes by means of drag & drop.
If you insert a code template into your code, it is important to note that, for
example, conditions in the templates are identified by " _XYZ_ " . You must replace
these placeholders with the appropriate information.
Selection Dialogs
If WinCC tags or objects are used in the code, the following selection dialogs are
available for use:


Opens a tag selection dialog specifies the selected tag name as the return
value.



Opens a tag selection dialog and returns the tag name with an associated
reference.



Opens a picture/object browser in which a picture/object can be selected
whose name is then used for the return value.



Opens a picture selection dialog for pictures and returns the picture name,
with sever prefix if necessary.

Bookmarks
Bookmarks can be set in the code via the icons in the toolbar in order to find
certain parts in the codes more easily.



Deletes all bookmarks in the active editor window.



Skips one bookmark further in the code.



24

Sets a bookmark in the line in which the cursor is currently located.

Skips one bookmark back in the code.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

7.3

VBScript Editors

Working with Toolbars

Purpose
In their default position, the toolbars are located below the menu bar, at the top of
the VBS editor. The buttons arranged on the toolbars enable quick, easy access to
the functions provided in Global Script and the action editor in Graphics Designer.
Global Script/Graphics Designer provide the following toolbars:

" Standard " Toolbar
Button

Function

Key
Combination

Creates a new project module (Global Script only)

& lt; ALT+F1 & gt;

Creates a new standard module (Global Script only)

& lt; ALT+F2 & gt;

Creates a new global action (Global Script only)

& lt; ALT+F3 & gt;

Opens an existing action or existing module (Global
Script only)

& lt; CTRL+O & gt;

Saves the content of the active editing window. This
function is only available, when an editing window is
open. After saving, the display in the navigation window
is updated. (Global Script only)

& lt; CTRL+S & gt;

Cuts the selected text and copies it to the clipboard. This
function is only available, when text is selected.

& lt; CTRL+X & gt;

Copies the selected text to the clipboard. This function is
only available, when text is selected.

& lt; CTRL+C & gt;

Inserts the contents of the clipboard at the cursor
position. This function is only available, when the
clipboard is not empty.

CTRL & lt; +V & gt;

Prints the contents of the active editing window as project CTRL & lt; +P & gt;
documentation. This function is only available, when an
editing window is open.

" Editor " Toolbar
Button

Function

Key
Combination

Indents the line, in which the cursor is located, one
position to the right.

--

Indents the line, in which the cursor is located, one
position to the left.

--

Printout of the Online Help
Creating Procedures and Actions with VBS

25

VBScript Editors

Button

11.05

Function

Key
Combination

Marks the lines selected by the mouse as comments. If
no lines have been selected by the mouse, the line in
which the cursor is located is marked as a comment.

--

Removes the comment marking from the lines selected
by the mouse. If no lines have been selected by the
mouse, the comment marking in the line in which the
cursor is located is removed.

--

Sets a bookmarks in the current line. Actuating again
removed the bookmark from the current line.

& lt; CTRL+F9 & gt;

Removes all bookmarks from the current code in the
editor window.

& lt; CTRL+SHIF
T+F9 & gt;

Moves the cursor one bookmark further.

& lt; F9 & gt;

Moves the cursor one bookmark back.

& lt; SHIFT+F9 & gt;

Opens the " Find " dialog for text search in the code.

& lt; CTRL+F & gt;

Opens the " Replace " dialog for search and replace in the
code.

& lt; CTRL+H & gt;

Repeats the search process.

& lt; F3 & gt;

Opens the " Script editor options " dialog.

--

Undoes the last of a maximum of 30 editor actions. This
& lt; CTRL+Z & gt;
function is only available, when an editor action has been
executed.
& lt; CTRL+Y & gt;
Redoes the last editor action that was undone. This
function is only available, when an editor action has been
undone.

Content of the " Edit " Toolbar
Button

Function

Key
Combination

Selects the file in the navigation window to which
the current editor window belongs (Global Script
only).

--

Displays all the files in the navigation window
(Global Script only).

--

Only displays the Script files in the navigation
window (Global Script only).

--

Only displays the syntactically correct files in the
navigation window (Global Script only).

--

Workplace

26

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBScript Editors

Button

Function

Key
Combination

Executes a Syntax Check in the code of the
current editor window.

& lt; F7 & gt;

Opens the " Info/Trigger " dialog.

& lt; CTRL+T & gt;

Script

WinCC
Objects

Displays the trigger name.
Opens a tag selection dialog returns the selected
tag name as the return value.

& lt; CTRL+U & gt;

Opens a tag selection dialog and returns the tag
name with an associated reference.

& lt; CTRL+W & gt;

Opens a picture/object browser in which a
& lt; CTRL+Q & gt;
picture/object can be selected whose name is then
used for the return value.
Opens a picture selection dialog for pictures and
returns the picture name, with the server prefix if
necessary.
Additional Buttons in Graphics Designer

& lt; CTRL+B & gt;

In addition to the buttons provided by Global Script, the action editor in Graphics
Designer also has the following buttons:


Shows the declarations area ( & lt; CTRL+E & gt; )



Hides the declarations area ( & lt; CTRL+A & gt; )

Printout of the Online Help
Creating Procedures and Actions with VBS

27

VBScript Editors

7.4

11.05

Deleting Actions or Procedures

Introduction
If an action, procedure or a module is deleted in a script editor, the code and
corresponding file are deleted in the project directory.
Be careful only to delete procedures which are no longer used in other procedures
or actions. If an action attempts to call in a procedure which no longer exists, the
action is stopped in runtime at the fault point. A non-existing reference in the code
is not detected by the syntax check.
Note:
Procedures can only be deleted within a module by deleting the code, not in the
editor's navigation window.
Procedure
Procedure
1
2

Select the action or module to be deleted in the navigation window.

3

Select the " Delete " command from the context menu.

4

28

Open Global Script.

To delete a procedure, open the relevant module and delete the
corresponding code in the editor window.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

8

Creating and Editing Procedures

Creating and Editing Procedures

Introduction
Projects and standard procedures can be programmed in WinCC using VBS:


Project procedures can only be called in the current project. Since procedures
are stored in the project directory, they are automatically copied when a project
is copied.



Standard procedures can be called in by all computers linked to a project.
When a project is copied onto another computer, the standard procedures
must be copied into the corresponding directory on the target computer
manually.

The copied procedures are directly available for use in runtime. The become visible
in the editor when the view is updated.
Apart from the procedures programmed by yourself, general VBS functions can
also be used (e.g. Abs, Array,... Year). These general VBS functions can be
invoked in the code using the " Function List " command from the context menu.
In addition, WinCC provides the most popular instructions as code templates (e.g.
If...Then, When...While). The code templates can be moved from the navigation
window's Code Templates tab control directly into your code via drag & drop.
If you insert a code template into your code, it is important to note that, for
example, conditions in the templates are identified by " _XYZ_ " . You must replace
these placeholders with the appropriate information.

Using Procedures
Procedures are used for the central creation and maintenance of codes which are
to be implemented at several point in the configuration. Codes are written and
saved in a procedure and the procedure is called in with the current parameters in
actions or other procedures instead of repeatedly entering the same code.
Procedures are created for repeated functionalities, e.g.


Calculations with different starting values (procedure with return value)



Checking tag values (procedure with return value)



Executing tasks (procedure with return value)

This is linked to the following advantages:


The code is only programmed once.



Modifications are only made at one point, namely in the procedure, not in each
action.



The action code is shorter and, thus, remains clearer.

Related procedures should be stored in modules in WinCC.

Printout of the Online Help
Creating Procedures and Actions with VBS

29

Creating and Editing Procedures

11.05

Procedures are loaded in runtime when the calling action is executed.
If a procedure (module) used in a picture is modified, the modification is applied the
next time the picture is loaded. This means that a picture currently displayed only
works with the modified procedure after the picture has been reloaded.
If you change a standard procedure into a project procedure, and vice versa, you
must save the pictures again which use this procedure.
Note:
Procedures can be used in actions in Global Script and Graphics Designer.
In order to use a global tag defined in Global Script in an action in Graphics
Designer, observe the following:
In order that access can be made to the tag, it is necessary to call in the
procedure in which the tag is defined.
In order to use a global tag in picture-independent actions in Global Script,
observe the following:
In order that access can be made to the tag, at least one procedure in the module
containing the tag must be called in at least one global action.
Procedure - Action Restrictions
Global procedures valid for the entire project can only be created in Global Script.
Graphics Designer can only be used to create picture-specific procedures and call
in global procedures in actions. Picture-specific procedures in Graphics Designer
are defined in the declaration area of an action.
A procedure is not executed without an action.

30

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Procedures

File Name and Procedure Name
The procedure name is entered in the first line of the procedure code. The
procedure is displayed in the navigation window and called in actions under this
name. Procedures do not have a file name of their own but are stored in a module.
Module names are assigned in the editor's navigation window. Use the " Save As "
command to save a module under another name in the project directory.
Since procedures in Global Script are valid for the entire project, procedure names
must always be unique. Module names can be used more than once within a
project, e.g. in different subdirectories or stored separately in the standard and
project directories.

Displaying Procedures and Modules
If a module is saved which contains at least one syntactically incorrect
procedure, it is displayed in the navigation window with the adjacent symbol.
Caution
If a module contains a syntactically incorrect procedure, the module can no longer
be loaded. Procedures can no longer be called from the module.
If a module is saved which only contains syntactically correct procedures, it is
displayed in the navigation window with the adjacent symbol.

Procedures and Modules
Procedures are classified as standard or project procedures according to their
assignment to standard or project modules. Standard and project modules are
located o the corresponding tab controls in the Global Script navigation window.
Use the modules in order to compile procedures to practical function groups.
Observe the following when structuring the modules and procedures:


The more modules which must be loaded when a picture is called in, the worse
the performance in Runtime.



The larger a module, the more procedures are contained and, thus, the longer
the loading time for the module.

Organize the modules sensibly, e.g. a module with procedures for a specific
system part/picture.

Printout of the Online Help
Creating Procedures and Actions with VBS

31

Creating and Editing Procedures

8.1

11.05

Creating a New Procedure

Introduction
Standard projects and procedures can be programmed with Global Script in
WinCC.
The type of procedure is defined by the assignment to a project or standard
module. The procedure to create standard or project procedures is identical.
On creating a new procedure, WinCC automatically assigns a standard name
" procedure# " , in which case # represents a continuous number. If the procedure is
edited in the editor window, assign the procedure a corresponding name that the
procedure can be called in an action later. The name appears in the navigation
window when the procedure is saved.
Note:
Procedure names must be unique within a project. If a procedure with the same
name already exists, the module is identified as syntactically incorrect. Module
names can be used twice when the modules are stored in different directories.
Global procedures (valid for the for entire project) can only be programmed Global
Scripts. Procedures can be called via actions in Graphics Designer and picturerelated procedures created in the declaration area of an action. Using a global
action in Global Script, it is possible to create procedures directly in the code which
are then only applicable for this action.
An action must be programmed in order to call in a procedure.

Procedure
The following procedure describes the creation of a new procedure in Global
Script:
Procedure
1
2

In the navigation window, select the standard modules or project
modules tab control according to whether a standard procedure or
project procedure is to be created.

3

32

Open Global Script.

Open an existing module or create a new module using the menu
commands " File " & gt; " New " & gt; " Project Module " or " File " & gt; " New " & gt;
" Standard Module " .

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Procedures

Procedure
4

After having created a new module, the structure of a procedure without
return value is already entered in the editor window:

Enter the procedure name directly in the code: Sub " Procedure name " .
5

To insert one procedure in an existing module: Select the module in the
navigation window and then select the " Insert New Procedure " context
menu item.
The " New Procedure " dialog appears:

6

Enter a procedure name and select whether the procedure should have a
return value parameter. The definition of a tag for the return value is then
entered in the code (Dim RetVal).

7

Click on OK to confirm your input.

Note:
A new procedure can also be entered directly in a module. In the case of
procedures without return value, always begin with the instruction " Sub
& lt; Procedure name & gt; " and conclude with " End Sub " . In the case of procedures that
return values, always begin with the instruction " Function & lt; Procedure name & gt; " and
conclude with " End Function " . The new procedure is displayed in the navigation
window when the module is saved.

Printout of the Online Help
Creating Procedures and Actions with VBS

33

Creating and Editing Procedures

8.2

11.05

How to Write Procedure Codes

Introduction
Procedure codes are written in the Global Script editor window.
The code of each procedure can call in other procedures via their procedure
names.
Procedures can be created with or without return values. Use the return value, e.g.
to obtain information that the procedure has been executed successfully (e.g. 0 =
fault, 1 = successfully executed).
If a procedure (module) used in a picture is modified, the modification is applied the
next time the picture is loaded. This means that a picture currently displayed only
works with the modified procedure after the picture has been reloaded.

Functions in Global Script
Global Script provides the following functions to support the creation of procedure
codes:
Intellisense and Highlight Syntax
During text entry, context-sensitive lists appear containing the properties, methods,
and objects possible at the current code position. If you insert an element from the
list, the required syntax is also indicated automatically.
Note:
Full intellisense for all objects can only be utilized in the Graphics Designer if the
list is accessed using the object name and the result is assigned to a tag.
Otherwise, you are only offered a list of standard properties.
Example of full intellisense:
Dim Tag
Set Tag = ScreenItems ( " Circle1 " )
Tag. & lt; Intellisense selection & gt;
If picture window limits are exceeded during addressing, it is once again only the
standard properties which are offered since the picture of the picture window is not
loaded.
General VBS Functions
Use the " Function List " context menu command in the editor window to display a
list of general VBS functions.
Listing Objects, Properties and Methods
Using the context menu in the Editor window you can view a list of the possible
objects by calling the " Object List " command in the Graphics Designer. Global
Script only provides the HMIRuntime object in this list because there is no direct
access to the objects of Graphics Designer.
Use the " Properties/Methods " context menu command to acquire a list of the
possible properties and methods.

34

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Procedures

The same lists can be called in with the key combination & lt; CTRL + Spacebar & gt; but
according to the context of the script.
Code Templates
In the " Code Templates " tab in the Navigation window of the Editor, you will find a
selection of frequently used instructions, e.g. for loops and conditional instructions.
The templates can be inserted in the procedure codes by means of drag & drop.
If you insert a code template into your code, it is important to note that, for
example, conditions in the templates are identified by " _XYZ_ " . You must replace
these placeholders with the appropriate information.
Selection Dialogs
If WinCC tags or objects are used in the code, the following selection dialogs are
available for use:


Opens a tag selection dialog specifies the selected tag name as the return
value.



Opens a tag selection dialog and returns the tag name with an associated
reference.



Opens a picture/object browser in which a picture/object can be selected
whose name is then used for the return value.



Opens a picture selection dialog for pictures and returns the picture name,
with sever prefix if necessary.

Syntax Check
Global Script supports you by providing a syntax check which you can perform
after the code has been created. Syntax errors in the code are displayed in the
output window of the editor. You can move to the erroneous point in the code
directly by double-clicking the error in the output window.
Note:
The syntax check can only detect syntax errors in the code. Programming errors,
such as missing references, only become visible in Runtime. You should therefore
also always check your scripts in the Runtime environment.
Changing Procedure
If a procedure is modified while runtime is active, the modification becomes
effective at the following times:


Procedures called from actions or other procedures in pictures become active
following a picture change.



Procedures in Global Script become active directly after being called again.

Printout of the Online Help
Creating Procedures and Actions with VBS

35

Creating and Editing Procedures

11.05

Procedure
Procedure
1
2

Open the module containing the procedure to be edited.

3

After double clicking on the procedure in the navigation window, the
cursor skips to the beginning of the required procedure.

4

36

Open Global Script.

Edit the procedure.
If a procedure with return value parameters is created, e.g. to program
repeated calculations or checks, specify a return value at the end on the
procedure " procedurename = RetVal " .

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

8.3

Creating and Editing Procedures

Using Standard and Project Procedures

Introduction
Use the drag & drop function in the navigation window or the context menu to insert
a procedure in the current code.
Project procedures can only be used within the current project, standard
procedures are available for all projects on the computer.
Procedures, once created, can be used in other projects or on other computers. To
do this, copy the module containing the procedures in the appropriate project or
standard directory.

Using Procedures in Graphics Designer and Global Script
Procedures defined in Global Script can be called in actions in Global Script and
Graphics Designer. On executing the action in runtime, the entire module which
contains the procedure is loaded.
Please observe the following in order to use a global tag defined in a procedure in
Global Script:
When using Graphics Designer, always call the procedure in which the tag is
defined so that the tag can be used. I the procedure is not called in, the
corresponding module is not loaded and access cannot be made to the tag.
In the case of picture-independent actions in Global Script, at least one procedure
in the module containing the tag must be called in at least one global action.
Note:
In the general declaration part of screens, no check is made whether a procedure
or function name has already been assigned. Therefore, a name can occur
several times and it is not defined which function will be executed. This is standard
behavior of the MS Scripting Engine.
Procedure
Procedure
1

Open the procedure or action in which the procedure should be inserted.

2

Use the drag & drop function to move the procedure to be inserted from
the navigation window to the correct position in the code.
or
Place the cursor at the insert position in the code. Select the procedure
in the navigation window with the mouse and then select the " Pass
Procedure Call " context menu command.

Printout of the Online Help
Creating Procedures and Actions with VBS

37

Creating and Editing Procedures

8.4

11.05

Adding Module-Related Information

Introduction
Related information can be added to each module in order to quickly recognize the
functionality of the module or the procedures contained in it when edited at a later
date. If several operators are involved in configuring a project, you should provide
module-related information for your colleagues.
When a new module is created, the creation date is entered in the module-related
information automatically and is unchangeable. The Module is also assigned the
version number 1.0. The version numbers can be individually assigned when
editing a module. When a module is changed and saved, the current date of
change is entered automatically and is unchangeable.
The following information can be added:


" Created by "



" Changed by "



" Comments " e.g. module functionality/procedures contained

It is still possible to define a password for the module. Further information on
assigning passwords is provided in " Protecting Modules with a Password " .

38

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Procedures

Procedure
Procedure
1

Open Global Script.

2

Select the module in which information is to be added in the navigation
window.

3

4

Select the " Info/Trigger " button in the toolbar or select " Info " in the
context menu. The " Properties... " dialog appears.

Enter the required information.

Note:
The " Info/Trigger " dialog can also be called if an open procedure is selected in the
navigation window. The information stored in this dialog is always valid for the
entire module and all the procedures contained in it.

Printout of the Online Help
Creating Procedures and Actions with VBS

39

Creating and Editing Procedures

8.5

11.05

Protecting a Module with a Password

Introduction
A module can be assigned a password to protect it from unauthorized access. The
password is a part of the module-related information.
Note:
If a module is protected by a password, all the procedures contained in it are also
protected by the password.
Procedure
Procedure
1

Open Global Script.

2

Select the module to be assigned a password in the navigation window.

3

Select the " Info/Trigger " button in the toolbar or select " Info " in the
context menu. The " Properties... " dialog appears.

4

Select the " Password " check box.
The " Password Input " dialog appears.

5

Enter a password and confirm it.

6
Click on OK to confirm your input.
Results
If an attempt is made to open the module or a procedure contained in it, a prompt
appears requesting the password.
Deactivate Password Protection
To clear the password protection, disable the " Password " check box.
Changing the password
To change the password, open in the Properties dialog and click the " Change "
button. Then enter the new password.
Caution
If you forget the module password, the module cannot be edited.
Note:
The " Info/Trigger " dialog can also be called if an open procedure is selected in the
navigation window. The information stored in this dialog is always valid for the
entire module and all the procedures contained in it.

40

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

8.6

Creating and Editing Procedures

Saving a Procedure

Introduction
Individual procedures are not stored in the module in which the procedure has
been programmed.
Before saving a module, check the code for correct syntax. When saving a module,
the procedures contained are automatically checked and, in the case of syntax
errors, a prompt appears as to whether the module should be saved with the errors
or not. In this way, for example, modules and procedures can be saved which are
not fully programmed. Syntactically incorrect procedures do not run in runtime.
Caution
If a module contains a syntactically incorrect procedure, the module can no longer
be loaded. Procedures can no longer be called from the module.
Note:
The syntax check can only detect syntax errors in the code. Programming errors,
such as missing references, only become visible in Runtime. Therefore, always
check the scripts in the runtime environment and use a debugger, if necessary, to
detect and eliminate errors.
Only syntactically correct modules are called in runtime.
Note:
A list of all the possible syntax errors is available in the Appendix under " Basic
Principles of VBScript " .
The module containing the erroneous or unfinished procedures is displayed in
the navigation window with the adjacent symbol.
If a procedure is subjected to a syntax check prior to saving, any errors are
displayed in the lower part of the editor window. Double click on an error line to
access the error position in the code directly.
The module containing only syntactically correct procedures is displayed in the
navigation window with the adjacent symbol.
Use the " Save As " command to store the module under another name. Note that
the new module is only displayed in the navigation window after updating the view.

Prerequisite
The procedure/module to be saved must be open in the editor window.

Printout of the Online Help
Creating Procedures and Actions with VBS

41

Creating and Editing Procedures

11.05

Procedure
Procedure
1
2

3

42

Click the " Syntax Check " button in the toolbar.
If syntax errors appear in the output window, double click on the error line
and correct the error in the code. Repeat steps 1 and 2 until the code is
correct.
Save the module using the " Save " button in the toolbar.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

8.7

Creating and Editing Procedures

Renaming a Procedure or Module

Introduction
Procedures and modules are renamed in the following cases:


When a standard name (procedure# or Modul#), which was automatically
assigned when the new module/new procedure was created, is changed to a
self-explanatory name.



When a module or procedure is copied in order, for example, to create a new
module with similar content from an existing one. Please note that procedure
names must be unique within a project. Procedure names which exist twice are
issued as errors during the syntax check. Contrary to procedure names, the
same name can be applied to modules when the modules are stored in
different directories.

Note:
The module name is always identical to the file name in the WinCC file system. If
a module name is changed, e.g. in Windows Explorer, the new module name is
taken over from Global Script in the navigation window.
Procedure
Renaming Procedures
Procedure
1

Open the procedure to be renamed.

2

Enter the new name in the header of the procedure.

3

Save the procedure so that the name is transferred to the navigation
window. Procedure names are always unique and may not be used more
than once.
Renaming Modules
Procedure
1

Close the module to be renamed.

2

Select the module in the navigation window and choose the " Rename "
option from the context menu.

3

Enter the new name in the navigation window. Module names are always
unique at directory level and may not be used more than once.

Printout of the Online Help
Creating Procedures and Actions with VBS

43

Creating and Editing Procedures

44

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9

Creating and Editing Actions

Creating and Editing Actions

Introduction
When using VBS in WinCC, there is no differentiation between local (valid for
entire project) and global (valid on all computers) actions. A configured action is
always valid globally.
A copied action is available for use in runtime following a restart or opening and
saving the action. This becomes visible in the editor wen the view is updated.
VBS actions can be used to make graphic objects and object properties dynamic in
runtime or to execute picture-independent actions.
Note:
Please note that the object name length of objects made dynamic in Graphics
Designer is limited to approx. 200 characters, and each special character used in
an object name is converted to five characters in the script files. The special
characters are represented by a four-place hexadecimal code behind the
preceding X. If the name of an object made dynamic is too long, a corresponding
error message appears. Further information is available in this help under
" Structure of VBScript Files " .
Caution
If you make an object property dynamic with a VBS action via the return value of a
script, the value of the object property is written only if it has changed in relation to
the last script run. It is not considered if the value had been changed from another
location.
Therefore it is illegal to change properties which have been made dynamic by VBS
action via the return value from another location (e.g., other C scripts or VBS
scripts).
If you do not observe this, wrong values can be the results.
Using the Actions
Actions can be used as follows:
On graphic objects in Graphics Designer
Making properties dynamic (action with return value), e.g.:
Function BackColor_Trigger(ByVal Item)
'VBS143
BackColor_Trigger = RGB(125,0,0)
End Function
Triggered by an event on an object (action without return value), e.g.:
Sub OnClick(ByVal Item)
'VBS144
Item.BackColor = RGB(255,0,0)
End Sub

Printout of the Online Help
Creating Procedures and Actions with VBS

45

Creating and Editing Actions

11.05

Picture-independent in Global Script
As a cyclic action, e.g. incrementing a tag:
Option Explicit
Function action
'VBS145
Dim objTag1
Dim lngValue
Set objTag1 = HMIRuntime.Tags( " Tag1 " )
lngValue = objTag1.Read
objTag1.Write lngValue + 1
action = CLng(objTag1.value)
End Function
Executing Actions
An action can be assigned several triggers. The action is always executed when
one of the triggering events occurs. Observe the following:


Actions in Global Script cannot be executed simultaneously. The action
triggered last is held in a queue until the action currently being performed is
completed.



When using Graphics Designer, cyclically and tag-driven actions cannot be
triggered simultaneously. If the execution of a tag-driven action hinders the
execution of a cyclic action, the cyclic action is executed when the tag-driven
action has finished. The cyclic action is held in a queue during the nonexecution phase. When the current action is completed, the cyclic action is
executed with the normal cycle.



In Graphics Designer, event-driven actions cannot be executed
simultaneously.

The action types mentioned do not prevent each other from being executed: The
execution of actions in Global Script has no influence on actions in Graphics
Designer. In the same way, in Graphics Designer, the execution of cyclically or tagdriven actions has no effect on the execution of event-driven actions.
Note:
Actions in pictures which are still running one minute after the picture has been
deselected are terminated by the system. This is recorded in a logfile entry.
Action Details
All the actions used in a picture can be displayed by means of the picture
properties. To do this mark the picture in WinCC Explorer and select the
" Properties " context menu command. After double clicking on an entry, detailed
information on the type of dynamics appears.
It is also possible to display all the tags and pictures used in actions by means of
the WinCC CrossReference. CrossReference can also be used for the to link tag
connections of Graphics Designer actions easily.

46

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Actions

Note:
For pictures and tags addresses in your code, always use the standard
formulations
HMIRuntime.BaseScreenName = " Screenname " and HMIRuntime.Tags
( " Tagname " ) to ensure that pictures and tags are detected by CrossReference.
Procedure - Action Restrictions
Actions can be used to program instructions and call procedures. Codes are
programmed within procedures for use at several points in a configuration. Actions
always have a trigger.

Creating and Editing Actions
Actions can be configured in Global Script and Graphics Designer. Use Global
Script to configure global actions which can be executed independently of the
picture currently open. Graphics Designer is used to configure actions related to
graphic objects which should be executed when the picture is opened in runtime or
when the configured trigger occurs.
The script editors in WinCC provide the option of checking that scripts have a
correct syntax without executing them. Errors in the script are displayed in the
output window under the editor window. Double click on the corresponding error
line to access the related point in the code.
Note:
The syntax check can only check objects known to the system at the moment of
execution. Therefore, the tags and objects addressed in the scripts must be
created in WinCC.
Only syntactically correct actions are executed in runtime.

Printout of the Online Help
Creating Procedures and Actions with VBS

47

Creating and Editing Actions

11.05

Note:
The automation objects " PDLRuntime " and " WinCC Runtime Project " cannot be
used in VBS actions.
Representation of Actions
If a syntactically incorrect action is stored, it is displayed in the Global Script
navigation window with the adjacent symbol.
If a syntactically correct action without a trigger is stored, it is displayed in the
Global Script navigation window with the adjacent symbol.
If a syntactically correct action with a trigger is stored, it is displayed in the
Global Script navigation window with the adjacent symbol.
Note:
Actions can only be saved in the Graphics Designer if they have the correct
syntax. If an action with errors should still be retained and exited, however, enter
the comments.

48

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.1

Creating and Editing Actions

Creating a New Action

Introduction
When a new action is created, the editor automatically suggests a file name
(Action#.bac), which can be changed.
Actions can be configured in Global Script and Graphics Designer.


Global Script is used to configure actions which can be executed, pictureindependently, in runtime. Open Global Script via WinCC Explorer.



Graphics Designer is used to configure a new action, related to the properties
of a graphic object, by clicking on the right mouse button in the " Dynamic "
column of the Properties tab control and selecting VBS Action. An action,
related to an event, is created in the same way using the Events tab control. In
both cases, the Graphics Designer action editor opens up.

Note:
The precise procedure for linking actions with graphic objects is described under
the WinCC help topic " Dynamics " .
Procedure
Procedure
1

Open Global Script.

2

Activating the Actions Tab Control in the Navigation Window.

3

Click on the adjacent button in the toolbar or select the " File " & gt; " New "
& gt; " Action " menu commands.
A new action is opened in the editor window. The action appears in the
navigation window after it has been saved.

Note:
When a new action is created, the non-deletable instruction " Option explicit " is
entered automatically in the declaration area. The instruction is necessary as it
prevents errors caused by the incorrect notation of tags without declaration.
The instruction requires that the tags are always specified with the instruction
" Dim " in the code.
Do not use the " Option explicit " instruction in the code as this can cause runtime
errors.

Printout of the Online Help
Creating Procedures and Actions with VBS

49

Creating and Editing Actions

9.2

11.05

How to Edit Actions

Introduction
An action is edited in the same way as a procedure in the editor window of the
editor or in the Graphics Designer action editor.
In order that an action can be executed in runtime, it requires a trigger. Actions
which are triggered by an event in Graphics Designer do not require the
assignment of a trigger.
If an action is modified while runtime is active, the change is applied when the
picture is reloaded (in the case of actions in Graphics Designer) or the next time
the action is called (in the case of actions in Global Script).
Note:
A change in the code in runtime cannot be applied when another action is being
carried out at the same time.
A procedure call can be inserted in the action by dragging the procedure from the
editor's navigation window and dropping in the corresponding position of the code
in the editor window. C scripts cannot be called in VBS actions.

Declaration Area in Actions
If you create actions in the Graphics Designer, you can display the declaration area
of the action using the
button. When a new action is created, the non-deletable
instruction " Option explicit " is entered automatically in the declaration area. The
instruction is necessary as it prevents errors caused by the incorrect notation of
tags without declaration.
The instruction requires that the tags are always specified with the instruction " Dim "
in the code.
Do not use the instruction " Option explicit " in your code since Runtime errors may
occur otherwise.
In the declaration area, you can also make general settings which you want to use
globally for the current picture, e.g.:


tag definitions



procedures which you only want to use in this picture

In declaration areas of actions, there may be independently defined global tags in
the areas " Event " and " Properties " of an object. There is no connection between
global tags of the same name on both areas.
Note:
Always make sure that the procedures in the declaration area have correct syntax,
i.e. with " Sub " - " End Sub " . Do not create directly executable codes in the
declaration area as this can cause runtime errors.

50

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Actions

Note:
If global tags are used in the declaration area of actions Graphics Designer, note
that the event-driven and cyclic/tag-driven actions are processed separately in
runtime. There is no synchronization of global tags between the two runtime
systems in runtime. If synchronization of tags is required, configure these using
the DataSet object or internal WinCC tags.
When making definitions in the declaration area, pay attention to the structure of
the Script files, as described under " Structure of VBScript files " .

Functions for Editing Actions
The script editors provide the following functions to assist you in creating action
code:
Intellisense and Highlight Syntax
During text entry, context-sensitive lists appear containing the properties, methods,
and objects possible at the current code position. If you insert an element from the
list, the required syntax is also indicated automatically.
Note:
Full intellisense for all objects can only be utilized in the Graphics Designer if the
list is accessed using the object name and the result is assigned to a tag.
Otherwise, only a list of standard properties is offered.
Example of full intellisense:
Dim Tag
Set Tag = ScreenItems ( " Circle1 " )
Tag. & lt; Intellisense & gt;
If picture window limits are exceeded during addressing, it is once again only the
standard properties which are offered since the picture of the picture window is not
loaded.
General VBS Functions
Use the " Function List " context menu command in the editor window to display a
list of general VBS functions.
Listing Objects, Properties and Methods
Using the context menu in the Editor window you can view a list of the possible
objects by calling the " Object List " command in the Graphics Designer. Global
Script only provides the HMIRuntime object in this list because there is no direct
access to the objects of Graphics Designer.
Use the " Properties/Methods " context menu command to acquire a list of the
possible properties and methods.
The same lists can be called in with the key combination & lt; CTRL + Spacebar & gt; but
according to the context of the script.

Printout of the Online Help
Creating Procedures and Actions with VBS

51

Creating and Editing Actions

11.05

Code Templates
In the " Code Templates " tab in the Navigation window of the Editor, you will find a
selection of frequently used instructions, e.g. for loops and conditional instructions.
The templates can be inserted in the procedure codes by means of drag & drop.
If you insert a code template into your code, it is important to note that, for
example, conditions in the templates are identified by " _XYZ_ " . You must replace
these placeholders with the appropriate information.
Selection Dialogs
If WinCC tags or objects are used in the code, the following selection dialogs are
available for use:


Opens a tag selection dialog specifies the selected tag name as the return
value.



Opens a tag selection dialog and returns the tag name with an associated
reference.



Opens a picture/object browser in which a picture/object can be selected
whose name is then used for the return value.



Opens a picture selection dialog for pictures and returns the picture name,
with sever prefix if necessary.

Syntax Check
Global Script supports you by providing a syntax check which you can perform
after the code has been created. Syntax errors in the code are displayed in the
output window of the editor. You can move to the erroneous point in the code
directly by double-clicking the error in the output window.
Note:
The syntax check can only detect syntax errors in the code. Programming errors,
such as missing references, only become visible in Runtime. Therefore, always
check the scripts in the runtime environment and use a debugger, if necessary, to
detect and eliminate errors. The way to test scripts with a debugger is described in
this documentation under the topics " Diagnostics " & gt; " Testing with the Debugger " .
Procedure
Procedure
1
2

Double click on the action on the Action tab control in the navigation
window.

3

52

Open Global Script.

Edit the action.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.3

Creating and Editing Actions

Adding Action-related Information

Introduction
Related information can be added to every action in Global Script in order that the
function of an action can be recognized at a later date when editing. If several
operators are involved in configuring a project, you should provide action-related
information for your colleagues.
When a new action is created, the creation date is entered in the action-related
information automatically and is unchangeable. The action is also assigned the
version number 1.0. The version numbers can be individually assigned when
editing an action. When an action is changed and saved, the current date of
change is entered automatically and is unchangeable.
The following information can be added:


" Created by "



" Changed by "



" Comments: " e.g. functionality of the action

It is also possible to define a password for the action. Further information on
assigning passwords is provided in " Protecting Actions with a Password " .
Note:
Additional information can only be made available in Global Script, not for actions
in Graphics Designer.

Printout of the Online Help
Creating Procedures and Actions with VBS

53

Creating and Editing Actions

11.05

Procedure
Procedure
1

Open Global Script.

2

Open the action for which information should be added.

3

4

54

Select the " Info/Trigger " button in the toolbar or select " Info/Trigger "
in the context menu. The " Properties... " dialog appears.

Enter the required information.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.4

Creating and Editing Actions

Protecting an Action with a Password

Introduction
An action in Global Script can be protected against unauthorized access by
assigning a password to it. The password is a part of the action-related information.
Note:
Only actions in Global Script can be assigned a password, not actions in Graphics
Designer.
Procedure
Procedure
1

Open Global Script.

2

Open the action to be protected by a password.

3

Select the " Info/Trigger " button in the toolbar or select " Info/Trigger "
in the context menu. The " Properties... " dialog appears.

4

Select the " Password " check box.

5

Click the " Change " button. The " Enter Password " window opens.

6

Enter a password and confirm it.

7
Click on OK to confirm your input.
Results
If an attempt is made to open the action, the system requests a password.
Deactivate Password Protection
To clear the password protection, disable the " Password " check box.
Changing the password
To change the password, open in the Properties dialog and click the " Change "
button. Then enter the new password.
Caution
If you forget the action password, the action cannot be edited.

Printout of the Online Help
Creating Procedures and Actions with VBS

55

Creating and Editing Actions

9.5

11.05

Saving Actions

Introduction
Before an action can be run in runtime, it must be saved. Save an action as any
other Windows file using the " File " & gt; " Save " commands or the corresponding icon.
Note:
Actions in Graphics Designer are automatically applied on closing the action editor
with the picture. Functions can only be saved in the Graphics Designer if they
have the correct syntax.
Note:
A list of all the possible syntax errors is available in the Appendix under " Basic
Principles of VBScript " .
In order to save an action under a different name, e.g. to use an action as a basis
for another action, use the " Save As " command.
Note that, when using " Save As " , only the file name is changed and not the action
name.
Prior to Saving
Before saving an action, qcheck the code for correct syntax. The syntax errors in
the code are displayed in the output window of Global Script. Double click on an
error line to access the error position in the code directly.
Note:
The syntax check can only detect syntax errors in the code. Programming errors,
such as missing references, only become visible in Runtime. Therefore, always
check the scripts in the runtime environment and use a debugger, if necessary, to
detect and eliminate errors.
If actions are saved without running a syntax check beforehand, the editor
comments that a syntactically incorrect action will be saved which cannot
subsequently be run in runtime.
Actions with syntax errors are displayed in the navigation window with the
adjacent symbol.
Procedure
Procedure
1
2

3

56

Click the " Syntax Check " button in the toolbar.
If errors are displayed in the lower part of the editor window, double click
on the error line and correct the error in the code. Repeat steps 1 and 2
until the code is correct.
Save the action using the " Save " button in the toolbar.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.6

Creating and Editing Actions

Triggers

Definition and Use
Triggers are implemented in order to execute actions in runtime. To allow this, a
trigger is connected to an action thus forming the triggering event which calls the
action. Actions without a trigger are not executed.
The triggers defined for an action are displayed in the Global Script navigation
window .

Trigger Types
The following triggers are available:
Acyclic triggers
They consist of the specification of date and time. The action linked to such a
trigger is executed on the date and at the time specified.
Cyclic triggers
They consist of the specification of a time interval and start time. The following
cyclic triggers are available:


Standard cycle. The beginning of the first interval coincides with the start of
Runtime. The length of the interval is determined by the cycle.



Hourly. The start of the time interval is defined in minutes and seconds. The
length of the interval is one hour.



Daily. The start of the time interval is defined by the time (hour, minute and
second). The length of the interval is one day.



Weekly. The start of the time interval is defined by the weekday (Monday,
Tuesday, ...) and time. The length of the interval is one week.



Monthly. The start of the time interval is defined by the day and time. The
length of the interval is one month.



Yearly. The start of the time interval is defined by the day, month and time. The
length of the interval is one year.

Time-controlled triggers are used for Global Script actions and for actions to make
graphic objects dynamic.

Printout of the Online Help
Creating Procedures and Actions with VBS

57

Creating and Editing Actions

11.05

Tag Triggers


They consist of one or more specified tags. The action which is connected to
such a trigger is always executed when a change in the value of one of these
tags has been detected.



The way in which the tag value is queried can be individually defined for each
tag. Select from the following modes:



Cyclic query of the tag value: Specify a standard cycle. The tag value is
queried at the defined intervals (e.g. every 2 seconds). The action is triggered
when the system detects a change of the tag value. Depending on the size of
the cycle, it is possible that the tag value is changed but it is not detected by
the system. If, for example, a cycle of 5 minutes has been set, the tag value
may change several times within the 5 minute period but only the value set
when the next query is made is detected. The value changes between the two
queries are not registered.



Changes in the tag value: Each change in the tag value is detected by the
system. The action is executed each time the tag value changes.

Tag triggers are used for Global Script actions and for actions to make graphic
objects dynamic.
Event-driven
When an action is configured related to an event on a graphic object, the action is
triggered when a specific event has occurred, e.g. following a mouse click or the
change of the background color due to another action.

Effects of Triggers on Actions
If the action is only linked to one trigger, the action is executed as soon as the
triggering event occurs.
However, an action can be linked to several triggers, e.g. to a cyclic trigger and a
tag trigger. The action is then executed when one of the defined, triggering events
occurs. If two events occur simultaneously, the action is executed twice in
succession. If two tags contained in the trigger change simultaneously, the action
is only executed once.
Processing Actions in Graphics Designer
The following rules apply to processing actions in Graphics Designer:



No cyclic/tag triggered actions can be executed as long as another cyclic/tag
triggered action is running.



The two action types do not affect each other: An event-driven action can also
be executed when a cyclic action is already in progress.



58

No event-driven actions can be executed as long as another event-driven
action is running.

If the execution of actions is blocked by other actions (e.g. a cyclic action by a
tag-triggered action), each action which is blocked is executed once at the next
possible moment. Cyclic actions then run in their normal intervals after the oneoff execution.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Actions

Processing Actions in Global Script
Picture-independent actions from Global Script are executed in runtime in
succession after being triggered. If an action is triggered while another action is in
progress, the second action is retained in a queue until it can be executed.
Actions in Global Script and Graphics Designer do not affect each other.
Note:
If the action should not be executed at each event, it is possible to define a
condition in the action, the result of which controls whether the action is executed
or not.
Notes on Configuring Triggers
For system-related reasons, it may not be possible to guarantee that an action with
a cyclic trigger is executed at precisely the specified times. If this is guaranteed,
the task (e.g. checks) can be realized in the PLC.
The tag triggers should have priority over cyclic triggers: With cyclic actions, the
action is always executed, e.g. every 20 seconds. The tag trigger only executes the
action if a change in the value of the tag has been detected (e.g. case of cyclic
queries). This reduces the load on the system and increases performance.

If a tag trigger is used, configure the " Upon Change " cycle to start as seldom as
possible. This query cycle causes the tag to trigger the action following every
change. This causes high system loads.

Linking Tag Triggers
The CrossReference from WinCC can be used to quickly find all the application
points of tags, even in VBS actions. Tag triggers in actions in Graphics Designer
can be " linked " using CrossReference, i.e. replaced by other tags at all or selected
points.
Note:
Tags can also be directly linked in Graphics Designer by marking the graphic
object and selecting the " Linking ... " command from the context menu.

Printout of the Online Help
Creating Procedures and Actions with VBS

59

Creating and Editing Actions

11.05

Note:
When addressing pictures and tags in the code, use the standard formulations
HMIRuntime.BaseScreenName = " Screenname " and HMIRuntime.Tags
( " Tagname " ), in order to ensure that pictures and tags are acquired by the
CrossReference.
Further information on CrossReference is available in the WinCC documentation.

60

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.6.1

Creating and Editing Actions

Adding a " Timer " Type Trigger

Introduction
" Timer " type triggers execute an action at a certain time. " Timer " type triggers can
be cyclic or acyclic triggers.


Acyclic triggers trigger an action once at the configured time.



Cyclic triggers trigger an action at regular intervals. The time interval and start
time for the time must be triggered. If a standard cycle is selected as the cyclic
trigger, the start time is always the start of runtime. User-specific cycles can
also be selected as standard cycles.

Note:
Cyclic triggers guarantee a high updating rate of the system but require high
system loads. Only select cyclic triggers for actions in which updating is very
important.
In the case of a high system load, it is possible that actions can no longer be
executed.
" Timer " type triggers are used to make the properties in Graphics Designer
dynamic and execute global actions.

Procedure
Procedure
1
2

Open the action.
Select the " Info/Trigger " button in the toolbar or select " Info/Trigger "
in the context menu. The " Properties... " dialog appears.

3

Select the " Triggers " tab control.

4

Select the " Timer " trigger and then select the trigger type to be created:
cyclic or acyclic.

5

Click the " Add " button. The " Add Trigger " dialog appears.

Printout of the Online Help
Creating Procedures and Actions with VBS

61

Creating and Editing Actions

11.05

Procedure
6

If the " acyclic " trigger type has been selected: Enter a relevant trigger
name and define the time at which the action should be executed.

7

If the " cyclic " trigger type has been selected: Enter a relevant trigger
name and define the start time at which the action should be executed for
the first time. Enter a cycle at which the action should be repeated.
Click on OK to confirm your input.

Note:
An action can be assigned several triggers. The action is always executed when
one of the triggering events occurs.

62

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.6.2

Creating and Editing Actions

Adding Tag Type Trigger

Introduction
" Tag " type triggers execute an action following the change of a tag value. Any
internal or external tag stored in WinCC can be used as a trigger tag.
Actions with tag triggers can be executed at the following times:


On change of tag: The action is executed each time the tag value changes.
Since this setting causes a very high system utilization, the updating rate
should be set as low as possible.



Query the tag status according to standard cycle (including user cycles):
Define a cycle in whose intervals the tag value should be queried. The action is
only executed when the tag value has changed when queried. When the query
status is a large value, it is possible that the tag value changes but it is not
detected by the system. The action is not executed in such cases.

If an action is linked with several tags, the action is executed when one of the tag
values changes.

Procedure
Procedure
1
2

Open the action.
Select the " Info/Trigger " button in the toolbar or select " Info/Trigger "
in the context menu. The " Properties... " dialog appears.

3

Select the " Triggers " tab control.

4

Select " Trigger " as the tag.

5

Click the " Add " button. The " Add Trigger " dialog appears.

Printout of the Online Help
Creating Procedures and Actions with VBS

63

Creating and Editing Actions

11.05

Procedure
6

64

Enter the name of the tag to be used as the trigger or click the button
beside the " Tag Name " field in order to select a tag from the tag selection
dialog.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Creating and Editing Actions

Procedure
7

Double click on the " Standard cycle " field to open the selection dialog for
the tag update cycle:

Select a cycle and click on OK to confirm the selection.

Printout of the Online Help
Creating Procedures and Actions with VBS

65

Creating and Editing Actions

9.6.3

11.05

Modifying a Trigger

Introduction
A defined trigger can be modified at any time, even during runtime.

Procedure
Procedure
1

Open the action whose triggers should be modified.

2
Select the " Info/Trigger " button in the toolbar or select " Info/Trigger " in
the context menu. The " Properties... " dialog appears.
Alternatively, call in the dialog without executing the action by double
clicking on the trigger in the navigation window.
3
4

Select the trigger to be modified and click the " Change " button.

5

66

Select the " Triggers " tab control.

After modifying the trigger, confirm the entries with OK.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.6.4

Creating and Editing Actions

Deleting a Trigger

Introduction
Defined triggers can be deleted at any time. Triggers can also be deleted during
runtime.
If a trigger is deleted during runtime, it takes effect after saving the action.
Note:
Actions without a trigger are not executed in Runtime. None of the actions which
used the deleted trigger are executed any longer.
Procedure
Procedure
1

Open the Global Script Editor or the Graphics Designer action editor.

2

Open the action.

3

Select the " Info/Trigger " button in the toolbar or select " Info/Trigger "
in the context menu. The " Properties... " dialog appears.

4

Select the " Triggers " tab control.

5

Select the trigger to be deleted and click the " Delete " button.

The trigger is deleted immediately.

Printout of the Online Help
Creating Procedures and Actions with VBS

67

Creating and Editing Actions

11.05

Note:
Triggers can also be deleted directly in the Global Script navigation window using
the " Delete " command in the context menu.

68

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

9.7

Creating and Editing Actions

Renaming an Action

Introduction
Actions can be renamed in Global Script. When an action is renamed, the action
name and file name are changed.
The action to be renamed must not be open in the editor window.

Procedure
Procedure
1

Open Global Script.

2

Select the name of the action to be renamed in the editor's navigation
window.

3

Select the " Rename " command from the context menu.

4

Enter a new name for the action with the extension *.bac.

Printout of the Online Help
Creating Procedures and Actions with VBS

69

Creating and Editing Actions

70

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Activating Global Actions in Runtime

10 Activating Global Actions in Runtime
Introduction
Scripts defined in Global Script are always executed when the configured trigger
occurs. Scripts in the graphical runtime system are executed when the picture is
called in and the configured event or trigger occurs.
In order for the picture-independent Global Script global actions to be executed,
the Global Script Editor must be registered in the startup list of the runtime
computer.

Requirements
Procedure
1

Select the " Properties " command in the computer's context menu WinCC
Explorer. The " Computer Properties " dialog will open.

2

Click on the " Startup " tab

3

Activate Global Script Runtime.

4

Click on OK to confirm your input.

Printout of the Online Help
Creating Procedures and Actions with VBS

71

Activating Global Actions in Runtime

72

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11 Diagnostics
Introduction
If the scripts are executed and tested in runtime, the Diagnostics window can be
used to display an analysis quickly.

Diagnostics Tools
WinCC provides a range of tools with which to analyze the behavior of actions in
runtime:


The GSC Runtime and GSC Diagnostics application windows



Use of a debugger

GSC Runtime and GCS Diagnostics
The GSC Runtime and GSC Diagnostics application window are used by inserting
them in a process screen. This can be a process screen developed for diagnostic
purposes which is called in runtime.
The application windows are used for different strategies:
While runtime is active, GSC Runtime provides information on the dynamic
behavior of all (Global Script) actions, enables the individual startup as well as log
on and off of each individual action and offers the access point to the Global Script
Editor.
GSC Diagnostics issues the chronological sequence of calls of the trace methods
contained in the actions. This also applies to trace methods in procedures which
were called in actions. The targeted use of trace methods, e.g. to issue tag values,
enables the progress of action and the procedures called in them to be traced. The
trace methods are specified in the form " HMIRuntime.Trace( & lt; output & gt; ) " .
The trace output from C and VBS is displayed in the GSC Diagnostics window.
Debugger
In order to test the scripts in runtime, a debugger can be used instead of the
Diagnostics window. The scope of material supplied in WinCC contains the
Microsoft Script Debugger; its use is described under the help topic " Testing with
the Debugger " .

Printout of the Online Help
Creating Procedures and Actions with VBS

73

Diagnostics

11.05

11.1 GSC Diagnostics

Introduction
GSC Diagnostics displays the chronological sequence of calls of the trace methods
contained in the actions in the Diagnostics window. This also applies to trace
methods in procedures which were called in actions. The targeted use of trace
methods, e.g. to issue tag values, enables the progress of action and the
procedures called in them to be traced.
In order to use GSC Diagnostics, insert a GSC Diagnostics type application
window in a process screen. The GSC Diagnostics attributes can be used to
control the appearance of the GSC Diagnostics window.
In the case of a picture change, the content of the GSC Diagnostics window is
deleted.
Note:
Messages are also displayed in the " GSC Diagnostics " window when the
debugger is activated.

11.1.1 Inserting the GSC Diagnostics Window in a Picture

Introduction
In order to use GSC Diagnostics, insert a GSC Diagnostics process screen. The
process screen can be an existing picture or a picture which serves customized
diagnostics purposes. GSC Diagnostics cannot be inserted directly in the process
screen as an application but is inserted as an application in an application window.
In this case, the application window is a component part of the process screen.

Prerequisite
Graphics Designer has been started and the process screen is open.

Procedure
Procedure
1
2

Select the " Global Script " option from the " Window Contents " dialog and
confirm the selection with " OK " .

3

Select the " GSC Diagnostics " option from the " Templates " dialog.

4

74

Use the " Smart Objects " object palette to insert the " Application Window "
in the picture.

Confirm the selection with OK in order to insert the Diagnostics window.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.1.2 GSC Diagnostics Attributes

Overview
GSC Diagnostics has attributes which affect the appearance of the GSC
Diagnostics window in runtime. These relate to the geometric attributes, particularly
to the following:


Display: This attribute defines whether the window should be visible or hidden.
The attribute can be made dynamic with the name Visible.



Sizeable: This attribute defines whether the size of the window should be
changeable in runtime.



Movable: This attribute defines whether the window should be moveable or not
during runtime.



Border: This attribute defines whether the window is provided with a border. If
the window has a border, its height and width can be modified in runtime.



Title: This defines whether the window has a title bar.



Can be maximized: This attribute defines whether the title bar should contain
the button to maximize the window.



Can be closed: This attribute defines whether the title bar should contain the
button to close the window.



Foreground: This attribute defines whether the window should always be in the
foreground.

11.1.3 GSC Diagnostics Toolbar

Overview
The GSC Diagnostics toolbar enables the output in the diagnostics window to be
controlled and to save, print and open window content:

1: Delete the content of the diagnostics window
2: Stop the window being updated
3: Activate the window being updated
4: Opens a text file in the window
5: Saves the window contents in a text file
6: Print the window contents

Printout of the Online Help
Creating Procedures and Actions with VBS

75

Diagnostics

11.05

11.2 GSC Runtime

Introduction
GSC Runtime is a window which displays the dynamic behavior of all Global Script
actions in Runtime. In addition, GSC Runtime can also be used during runtime to
influence the execution of each individual action and provide access to the Global
Script editor.
C actions and VBS actions are differentiated in the GSC Runtime window:


Symbolizes a C-Action



Symbolizes a VBS Action

The following information is issued:


Action name: The name of the action



ID: Action ID. They are used internally by the system. GSC Runtime supplies
the corresponding action name, together with the Action ID. The link between
ID and action name is only valid until runtime is stopped or, during runtime,
until an action is saved.



Status: Provides information on the current status of the action. Refer to the
table below for the possible statuses.



Activation Interval: The time in the form Hour:Minute:Second, which should
elapse between the action being called.



Return Value: The return value of the action



Started On: Date and time the current action was started



Next Start: Date and time the action will be started again



Error message: Contains the error text in the case of an error

Actions Status
Possible action status:



Action was deactivated



Action was stopped.



Action in progress



Error logging on the action!



76

Action was activated.

Error executing the action!

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

Context menu


The following functions are available for every action in the context menu:



Log off: The relevant action will not be executed again when the current
execution has finished.



Log on: The relevant action will be executed again when the next trigger event
occurs



Start: The relevant action will be executed once.



Edit: The relevant action will be opened in the Global Script editor for editing.
Runtime will remain active. If the edited action is compiled (when necessary)
and saved the changes will be applied by the runtime system immediately.



The option of opening the context menu for every action can be controlled by
assigning an authorization.



In order to use GSC Runtime, insert a GSC Runtime type application window
in a process screen. The GSC Runtime attributes can be used to control the
appearance of the GSC Runtime window.

Note:
Updating the GSC Runtime window increases the system load. The system load is
dependent on how many actions are visible in the window. The system load can
be lowered by reducing the height of the window so that fewer lines are visible.

Printout of the Online Help
Creating Procedures and Actions with VBS

77

Diagnostics

11.05

11.2.1 Inserting the GSC Runtime Window in a Picture

Introduction
In order to use GSC Runtime, insert a GSC Runtime process screen. The process
screen can be an existing picture or a picture which serves customized diagnostic
purposes. GSC Runtime cannot be inserted directly in the process screen but is
inserted as an application in an application window. In this case, the application
window is a component part of the process screen.

Prerequisite
Graphics Designer has been started and the process screen is open.

Procedure
Procedure
1
2

Select the " Global Script " option from the " Window Contents " dialog and
confirm the selection with " OK " .

3

Select the " GSC Runtime " option from the " Templates " dialog.

4

78

Use the " Smart Objects " object palette to insert the " Application Window "
in the picture.

Confirm the selection with OK in order to insert the Diagnostics window.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.2.2 GSC Runtime Attributes

Overview
GSC Runtime has attributes which affect the appearance of the GSC Runtime
window in runtime. These relate to the geometric attributes, particularly to the
following:


Display: This attribute defines whether the window should be visible or hidden.
The attribute can be made dynamic with the name Visible.



Sizeable: This attribute defines whether the size of the window should be
changeable in runtime.



Movable: This attribute defines whether the window should be moveable or not
during runtime.



Border: This attribute defines whether the window is provided with a border. If
the window has a border, its height and width can be modified in runtime.



Title: This defines whether the window has a title bar.



Can be maximized: This attribute defines whether the title bar should contain
the button to maximize the window.



Can be closed: This attribute defines whether the title bar should contain the
button to close the window.



Foreground: This attribute defines whether the window should always be in the
foreground.

Printout of the Online Help
Creating Procedures and Actions with VBS

79

Diagnostics

11.05

11.3 Testing with the Debugger

Introduction
A debugger can be used to test the VBScripts in Runtime, e.g.:


Microsoft Script Debugger (contained in material supplied with WinCC, can be
used with Windows 2000 and Windows XP)



Debugger " InterDev " (contained in scope of installation material supplied with
Developer Studio )



Microsoft Script Editor (MSE) Debugger (contained in material supplied with
Microsoft Office)

The following description relates exclusively to handling the Microsoft Script
Debugger.

Installation
To install the Script Debugger included in the WinCC scope of supply execute in
your computer the ScriptDebugger setup. You access the ScriptDebugger setup by
selecting " Additional Software " on the installation menu.
Note:
The following settings must be defined in the MSE Debugger so that the running
processes are displayed:
- In the " Process " window, click the " Properties... " button and activate the " Just-InTime-Debug " option in the " Debugger Properties " dialog.
- Restart the computer.
You should also have activated in the MS Internet Explorer the " Disable script
debugging " option so that the Internet Explorer cannot prevent the WinCC
debugging procedure.

80

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.3.1 How to Activate the Debugger

Principle
There are several ways of activating the debugger:


Automatic activation of the debugger when an error occurs in runtime.



Opening an error box in runtime via which the debugger can be activated.



Starting the debugger from the Start menu and opening a running runtime
scripts.

Prerequisite
In order to use the Microsoft Script Debugger to test the scripts, the debugger
software must be copied from WinCC onto the configuration computer.

Procedure
The following procedure describes the first two points, activating the debugger in
WinCC.
Procedure
1

In the computer's pop-up menu in WinCC Explorer, select the command
" Properties " . The " Computer Properties " dialog appears.

2

Select the " Runtime " tab control.

3

Activate the required debug options. The debug behavior for actions in
Global Script and Graphics Designer can be set independently of each
other:

Select " Start debugger " when the debugger should be started directly
following an error in the runtime.
Select " Display error dialog " when the debugger should not be started
directly but an error box should be opened containing information on the
error. The debugger can be started from the error box by means of a
button.
4

Click on OK to confirm your input.

Printout of the Online Help
Creating Procedures and Actions with VBS

81

Diagnostics

11.05

Starting the Debugger and Opening a Running Script
The debugger can also be started up later and linked to the system currently
running. Define a connection in the debugger to the respective processes,
" pdlrt.exe " for the Graphical Runtime System and " gscrt.exe " for the Global
Runtime System. The way to open a running script in the debugger is described
under the topic " Select Script " .

Exiting the Debuggers
It is possible to stop the debugger without exiting the WinCC runtime.

82

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.3.2 Principles of Debugging

Introduction
The Microsoft Script Debugger supplied with WinCC can be used to debug the
VBScripts. The Microsoft Script Debugger can be used to:


View the script source code to be debugged



Step-by-step processing of the scripts to be checked



Display and modify tag and property values



View and monitor the script progress

Note:
Please note that the code displayed in the debugger is write-protected. The code
cannot be changed directly in the debugger but can only test the necessary
changes.
Error types
A distinction is made between the following types of error by the debug:
Syntax errors
Syntax errors occur, for example, when a key word is written incorrectly or a
parenthesis is not closed. When a syntax check from WinCC is used, syntax errors
can be excluded before testing the scripts in runtime. In principle, only syntactically
correct scripts can be saved in Graphics Designer. The WinCC syntax check also
checks:


Whether the procedure names are unique in Global Script



Whether an action module in Global Script contains only one procedure



Whether the action part in Graphics Designer contains only one procedure

As a result of the syntax check in WinCC, the script is parsed without being
executed. The script is parsed again directly before executing in runtime. All the
script parts are parsed, even those which are executed after a certain action has
been executed at a later time.
If the script contains syntax errors, the script is not executed in runtime.
Runtime error
A runtime error occurs when an attempt is made to execute an invalid/erroneous
action, e.g. because a tag has not been defined. In order to intercept runtime
errors, use the " On Error Resume Next " command in the VBScript. The command
causes the subsequent command to be executed following a runtime error.
Afterwards, the error code can be checked via the Err object. In order to deactivate
the processing of runtime errors in the script, use the " On Error Goto 0 " command.

Printout of the Online Help
Creating Procedures and Actions with VBS

83

Diagnostics

11.05

Logical error
The debugger is particularly helpful in clearing up logical errors. A logical error
occurs when an unexpected result is received because, for example, a condition
was incorrectly checked. To clear logical errors, go through the scripts step-by-step
in order to detect the part which does not function properly.

Basic Procedure
When an error has occurred and the debugger is open, the script appears in a
window, write-protected. It is possible to navigate through the script document, set
breakpoints, execute the script again in runtime and to process the script step-bystep.
The most important steps for successful debugging of the scripts are described
under " Processing Scripts Step-by-Step " .
The source codes of the scripts cannot be edited directly in the scripts. When an
error has been detected, the error can be corrected in the original script in WinCC,
e.g. load the picture again and update it in the debugger.
Note:
Tips and tricks for debugging, frequently occurring error codes and other
information is available in the Microsoft Script Debugger online help.
Change Picture During Debug
If a picture change is executed during debugging, the script document of the " old "
picture remains open but is no longer valid. If necessary, invalid errors are
displayed because the objects called following the picture change are no longer
available.

84

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.3.3 Components of Microsoft Script Debugger

Introduction
The Microsoft Script Debugger offers several components which assist in
debugging:
" Command Window "
The " Command Window " is called in using the " View " & gt; " Command Window " menu
commands.
While a script is running in runtime, the " Command Window " of the debugger can
be used, for example, to compile and modify values of tags and properties in the
script currently running. Changes made in the " Command Window " are effected
directly in the running script so that planned changes can be tested immediately.
The following actions can be executed in the " Command Window " :


Enter commands: Commands can be entered and executed directly in
VBScript.



Change tag values: Tag values can be compiled and modified directly in the
" Command Window " . This relates to both tags in the current script as well as
global tags.



Modify properties: It is possible to read and write the properties of all objects in
the current script context.

The " Command Window " can always be used when a script has reached a
breakpoint or a skip has been made from a breakpoint to other commands.
Note:
Please note that the changes executed in the " Command Window " have no effect
on the source code of the script but only serve for test purposes in the debugger.
" Running Documents " Window
The " Running Documents " window is called via the " View " & gt; " Running Documents "
menu command.
This window displays all the scripts currently running in WinCC Runtime, separated
according to scripts, from Global Script ( " Global Script Runtime " ) and scripts from
the graphical runtime system ( " PDLRT " ). All the running Global Script Runtime
actions and modules are displayed. In the graphical runtime system, the scripts are
separated according to trigger-controlled actions (picturename_trigger) and eventcontrolled actions (picturename_events).
" Call Stack " Window
The " Call Stack " window is called via the " View " & gt; " Call Stack " menu command.
This window displays a list of all running actions and called procedures. When a
procedure is called, for example, the name is added to the " Call Stack " list. When
the procedure has finished, the name is removed from the list. A procedure can be
selected from the list in order to skip to the corresponding position in the script
document at which the procedure was called.

Printout of the Online Help
Creating Procedures and Actions with VBS

85

Diagnostics

11.05

11.3.4 Structure of VBScript Files

Principle
In order not to hinder the simultaneous processing of cyclic and event-driven
scripts in the graphical runtime system, the event-driven actions and cyclic/tagdriven actions are strictly separated during processing. In this way, a cyclic action,
for example, cannot hinder the execution of an action initiated by clicking a button.
To ensure this, the event-driven actions and the cyclic/tag-driven actions are stored
in separate script files when saving a picture. If a global picture section has been
defined in actions in Graphics Designer, this is copied into both scripts. In the same
way, modules which are used in an action are also copied in both script files.
If a tag from a module should be used, the corresponding module must be called
in. Otherwise, the module is not copied in the script file and an error is generated.
Note:
Since the two script files are handled separately, they have no common data area.
Therefore, there is no synchronization of global tags between the two script files. If
synchronization is required, implement this using the DataSet object or internal
WinCC tags.
Structure of the Script Files
When scripts are debugged with a debugger, the script files always open the
different runtime systems.
In the case of the graphical runtime system, this means that you receive two script
files per picture:


& lt; Picture name & gt; .pdl_events: Contains the event-driven actions.



& lt; Picture name & gt; .pdl_triggers: Contains the cyclic and tag-controlled actions.

The following section describes how the script files are structured:
Graphical runtime system

86

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

Global Script Runtime

Note:
Please note that the actions and procedures of the graphic runtime system are not
displayed with the action name in the script file under which it was saved in
WinCC. The name conventions for actions and procedures in the script files sate
described in " Action and Procedure Names in the Debugger " .

Printout of the Online Help
Creating Procedures and Actions with VBS

87

Diagnostics

11.05

11.3.5 Action and Procedure Names in Debugger

Action and Procedure Names in Debugger
The names of procedures and actions in debugger script files differ from the names
under which they were saved by the scripts in WinCC.
The action and procedure names in the script files are compiled according to the
following rules:
Action type

Name of the script file

Cyclic or tag-driven
actions on a property

ObjectName_PropertyName_Trigger

Mouse events

ObjectName_OnClick
ObjectName_OnLButtonDown
ObjectName_OnLButtonUp
ObjectName_OnRButtonDown
ObjectName_OnRButtonUp

Keyboard events

ObjectName_OnKeyDown
ObjectName_OnKeyUp

Object events

ObjectName_OnObjectChanged
ObjectName_OnSetFocus

Events on properties

ObjectName_PropertyName_OnPropertyChanged
ObjectName_PropertyName_OnPropertyStateChanged

Picture events

Document_OnOpen
Document_OnClosed

Permitted length of action names
The names of the actions in the script files are limited to 255 characters. Each
special character used in an object name is converted to five characters. The
special characters are represented by a four-place hexadecimal code behind the
preceding X. If, for example, an action is configured on a button with the name
" PushHere " per mouse click, the script in the script file appears as
" PushHere_OnClick " .
If the object name compiled is too long, an error message is issued during the
syntax check in WinCC. As a result of this restriction, graphic object names cannot
be selected with any length during configuration.

88

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

Note:
If you wish to determine the name of an object in Runtime, push & lt; Strg+Alt+Shift & gt;
and position the mouse over the corresponding object. The picture name and
object name then appears in a tooltip.

Printout of the Online Help
Creating Procedures and Actions with VBS

89

Diagnostics

11.05

11.3.6 Selecting a Script for Editing

Introduction
If the Microsoft Script Debugger is called from the Windows Start menu instead of
automatic activation using WinCC, scripts which are currently running can be
called in for editing in runtime.

Prerequisite
Runtime is activated, the picture to be debugged is active.

Procedure
Procedure
1

Start the debugger from the Windows Start menu ( " Start " & gt; " Programs " & gt;
" Options " & gt; " Microsoft Script Debugger " ).

2

Activate the " View " & gt; " Running Documents " command from the menu
bar.
The " Running Documents " window is opened. This window displays all
the scripts currently running in WinCC Runtime, separated according to
scripts, from Global Script ( " Global Script Runtime " ) and scripts from the
graphical runtime system ( " PDLRT " ).

The example above, " Startbild.pdl " is active and only event-driven scripts
are available in the start picture.
3

90

Double click on the script document in the " Running Documents " window
that is to be debugged. The script document is opened in the debugger
window, write protected.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.3.7 Processing Scripts Step-by-Step

Introduction
The Microsoft Script Debugger can be used to process the scripts step-by-step in
order, for example, to locate logical errors systematically. The effect of each
individual script line can be tested in runtime.

The procedure in principle
1. Activate the document to be debugged in runtime.
2. Start the debugger manually from the Start menu and open the required script
file or activate the debugger in WinCC. When activated in WinCC, the
debugger automatically opens when an attempt is made to execute an
erroneous script.
3. Set a breakpoint in the script file. Breakpoints are normally set in front of code
lines in which errors are suspected.
4. Switch to WinCC runtime and trigger an action which causes the script to run.
The debugger stops at the first breakpoint and marks the current line.
5. In order to go through the script document step-by-step, select one of the
following menu commands: " Debug " & gt; " Step Into " : Skip to the next code line. If
the script calls a procedure in this line, it skips to the procedure using the " Step
Into " command. The procedure called can then be processed step-by-step.
" Debug " & gt; " Step Over " : Skips the procedure called. The procedure is called but
the debugger does not stop at the individual lines of the procedure. Instead, it
moves to the next line of the current script after the procedure has been
executed.
6. To interrupt the step-by-step processing of a procedure, select the " Debug " & gt;
" Step Out " menu commands. The debugger then skips to the next action.
7. Proceed step-by-step to the end of the document or select the " Debug " & gt; " Run "
menu items to start the script again in runtime.

Printout of the Online Help
Creating Procedures and Actions with VBS

91

Diagnostics

11.05

11.3.8 Setting Breakpoints

Introduction
Breakpoints can be set in a script to stop at specific points when processing it and
to start the debugger. Set a breakpoint in front of a line, for example, which you
suspect contains a script error.
It is possible to:


Set breakpoints at specific lines to locate logical errors in the script step-bystep.



Set a breakpoint and call the debugger before the next line in the script is
processed. This procedure is used, for example, for events such as " Change
picture " .

When a script file is updated in the debugger, all the breakpoints are lost.
If a breakpoint is set in one of the script files " & lt; picture name & gt; .pdl_trigger " or
" & lt; picture name & gt; .pdl_event, all the trigger-driven or all event-driven procedures are
stopped, respectively, in runtime.

Prerequisite
Runtime is activated, the picture to be debugged is active.

Procedure
Setting a breakpoint
Procedure
1

Start the debugger and select the script. If automatic activation of the
debuggers in WinCC has been selected, the debugger is called in as
soon as an erroneous script is executed.

2

Position the cursor on the action in which a breakpoint should be set.

3

Open the " Debug " menu and select the " Toggle Breakpoint " item or the
icon from the toolbar.
The next line which can be executed is marked by a red point.

4

92

Change to WinCC Runtime and execute the action to be debugged.
The debugger stops at the first breakpoint found in the script. The
current line is displayed on a yellow background. The script can then be
processed step-by-step.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.3.9 Deleting Breakpoints

Introduction
When an error has been cleared properly, the breakpoints in a script can be
cleared individually or all together.

Procedure
Procedure
1

Position the cursor in the line whose breakpoint is to be deleted.

2

Open the " Debug " menu and select the " Toggle Breakpoint " item or the
icon from the toolbar.
The line is displayed without a marker.

3

To delete all the breakpoints in a script, open the " Debug " menu and
select the " Clear all Breakpoints " entry or the

icon in the toolbar.

11.3.10 How to Set Bookmarks in Scripts

Introduction
During the debug routine, bookmarks can be set on code lines so that they can be
found easier again one line later.
Setting or deleting bookmarks
Position the mouse pointer into the cell where you wish to set a bookmark, and
push & lt; Ctrl+F2 & gt; to set or delete a bookmark.
Skipping to the next bookmark
Press & lt; F2 & gt; to skip to the next bookmark in the script.
Skipping to the previous bookmark
Press & lt; SHIFT+F2 & gt; to skip to the previous bookmark in the script.

Printout of the Online Help
Creating Procedures and Actions with VBS

93

Diagnostics

11.05

11.3.11 How to Determine and Modify Tag and Property Values

Introduction
While a script is running in runtime, the " Command Window " of the debugger can
be used, for example, to compile and modify values of tags or properties in the
script currently running. It is possible, for example, to reset a process value for a
script to zero without having to stop the process.
Note:
If you wish to determine the name of a WinCC object in Runtime, push
& lt; Ctrl+Alt+Shift & gt; and position the mouse over the corresponding object. The
picture name and object name then appears in a tooltip.
Prerequisite
The script runs in runtime and the debugger is opened.

Procedure
Procedure
1
2

Switch to WinCC runtime and trigger an action which causes the script to
be executed.
The debugger stops at the first breakpoint.

3

Open the " View " menu and activate the " Command Window " entry.
The " Command Window " appears.

4

In order to determine the value of a tag or property, enter a " ? " followed
by a Space and the name of the tag or property whose value is to be
determined, e.g. " ? myTag " .
Push & lt; Return & gt; to execute the command.

5

94

Set at least one breakpoint in the current script.

In order to modify the value of a tag/property, assign a value in the VBS
syntax.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Diagnostics

11.3.12 Executing Script Commands

Introduction
While a script is running in runtime, the " Command Window " of the debugger can
be used to execute script commands directly and thus manipulate the running of
the current script. The script commands can be executed directly for test purposes
without creating the command in a script and activating it. It is possible, for
example:


To call methods



To call procedures



To manipulate object properties

" Command Window " can basically be used to execute all commands which can
also be executed from a VBScript.

Prerequisite
The script runs in runtime and the debugger is opened.

Procedure
Procedure
1

Set at least one breakpoint in the current script.

2

Switch to WinCC runtime and trigger an action which causes the script to
be executed.
The debugger stops at the first breakpoint.

3

Open the " View " menu and activate the " Command Window " entry.
The " Command Window " appears.

4

Enter the required command and press " ENTER " .

Note:
If a faulty command is entered in the Command window, no error message is
issued in runtime. The message " & lt; Script Error & gt; " appears in the Command window
instead.

Printout of the Online Help
Creating Procedures and Actions with VBS

95

Diagnostics

96

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Printing VBScripts

12 Printing VBScripts
Principle
The actions and procedures configured in both Global Script and in Graphics
Designer can be documented in WinCC.
The documentation options are distinguished between:


Print Feedback Doc: In Graphics Designer, all the configured actions are
printed with the feedback of the current picture. The Feed Back contains the Cactions and VBS actions, located beside each other, differentiated by the
source text (C or VBScript).



Print current script: The Feed Back in Global Script always contains the
currently open procedure or action.

WinCC provided predefined print layouts for the layout of the Feed Back.
Customized print layouts can also be developed and linked to the Print Job tab
control with " Project Documentation - Setup " .

Procedure
Procedure
1

Open Global Script or Graphics Designer according to the scripts to be
documented.

2

Configure the print job, if necessary, using the " Project Documentation Setup " command.

3

Use the " View Project Documentation " command to preview the data to
be printed.

4

Select the menu commands " File " & gt; " Print Project Documentation " to
print the data.

Printout of the Online Help
Creating Procedures and Actions with VBS

97

Printing VBScripts

98

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13 VBS Reference
VBS Object Model in WinCC

The WinCC object model of the graphic runtime system enables access to the
graphic objects and tags in runtime:

Objects
Objects and lists are provided for access to all the objects in the graphic runtime
systems: Graphic objects, pictures, layers and tags.

The properties of the individual objects can be used to modify specific graphic
objects and tags in runtime , e.g. activating an operating element per mouse click
or triggering a color change by modifying a tag value.

Printout of the Online Help
Creating Procedures and Actions with VBS

99

VBS Reference

11.05

Methods
Methods, which are applied to individual objects, can be used to read out tag
values for further processing or displaying diagnostics messages in runtime.

13.1 Objects and Lists

Overview
The objects and lists provided in WinCC object models enables access to graphic
objects and tags in runtime.

Navigation in Object Models
Access is made to objects in the VBS object model in hierarchical sequence. If, for
example, a picture element is accessed within a picture, access is made to the
picture element in the picture via its parent object (the surrounding picture).
Example

Only the basic picture name is issued in this example.

100

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Access to Graphic Objects
In WinCC, access is made to pictures, layers and graphic objects in runtime via the
superordinate " HMIRuntime " object. Access to objects and layers is always made
via the picture (screen) in which they are contained.

Access to Tags
In WinCC, tags are accessed directly in runtime via the superordinate
" HMIRuntime " object. Tag values can be read out or set anew.

Lists
Lists of WinCC object models behave in the same way as standard collections of
VBS. Exception: The " Tags " list has no Enum function.

Printout of the Online Help
Creating Procedures and Actions with VBS

101

VBS Reference

11.05

13.1.1 AlarmLogs Object

Description

Using the object, swapped archive segments of Alarm Logging may be
reconnected to Runtime, or previously swapped archive segments of Alarm
Logging may be deleted again. Therein


Archive segments to be swapped are copied to the common archiving directory
of the WinCC project, or



Previously swapped archive segments are deleted in the common archiving
directory.

Using parameters you may control from where archive segments are to be
swapped. You may also specify the time period over which archive segments are
to be swapped or deleted. Archive segments are copied to the common archiving
directory of the project.
If an error occurred during the operation with archiving segments, the method used
returns an error message. Additional information may be found under the subject
heading " Error Messages from the Data Bank Area " .

Usage
Previously swapped archive segments of Alarm Logging may be connected with
Runtime ( " Restore " method).
Previously swapped archive segments of Alarm Logging may be deleted from the
Runtime project ( " Remove " method).

Example
In the following example, archive segments from Alarm Logging are swapped and
the return value is output as Trace.
'VBS187
HMIRuntime.Trace " Ret: " &
HMIRuntime.Logging.AlarmLogs.Restore( " D:\Folder " , " 2004-09-14 " , " 2004-09-20 " ,1) & vbNewLine

102

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.1.2 DataItem Object

Description

The DataItem object is used to access the contents of the DataSet list. Values or
object references are stored in the list as DataItem.
Access uses the name under which the value was added to the list. Single access
using an index is not recommended since the index changes during adding or
deleting of values. The index may be used to output the complete contents of the
list. The output is in alphabetical order.
Note:
For object references it must be ascertained that objects are multiread-enabled.

Example
The example shows how the value of 'Motor1' is output as Trace.
'VBS163
HMIRuntime.Trace " motor1: " & HMIRuntime.DataSet( " motor1 " ).Value &
vbNewLine
The following example enumerates all DataItem objects of the DataSet list. Name
and value are output as Trace.
'VBS164
Dim data
For Each data In HMIRuntime.DataSet
HMIRuntime.Trace data.Name & " : " & data.Value & vbNewLine
Next

Note:
For objects, value may possibly not be output directly

Printout of the Online Help
Creating Procedures and Actions with VBS

103

VBS Reference

11.05

13.1.3 DataLogs Object

Description

Using the object, swapped archive segments of Tag Logging may be reconnected
to Runtime, or previously swapped archive segments of Tag Logging may be
deleted again. Therein


Archive segments to be swapped are copied to the common archiving directory
of the WinCC project, or



Previously swapped archive segments are deleted in the common archiving
directory.

Using parameters you may control from where archive segments are to be
swapped. You may also specify the time period over which archive segments are
to be swapped or deleted. In addition, you may set the archive type ( " Tag Logging
Fast " , " Tag Logging Slow " , " Tag Logging Fast and Tag Logging Slow " ). Archive
segments are copied to the common archiving directory of the project.
If an error occurred during the operation with archiving segments, the method used
returns an error message. Additional information may be found under the subject
heading " Error Messages from the Data Bank Area " .
Error Messages from the Data Bank Area

Usage
Previously swapped archive segments of Tag Logging may be connected with
Runtime ( " Restore " method).
Previously swapped archive segments of Tag Logging may be deleted from the
Runtime project ( " Remove " method).

Example
In the following example, fast archive segments from Tag Logging are swapped
and the return value is output as Trace.
'VBS188
HMIRuntime.Trace " Ret: " &
HMIRuntime.Logging.DataLogs.Restore( " D:\Folder " , " 2004-09-14 " , " 2004-09-20 " ,1,1) & vbNewLine

104

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.1.4 DataSet Object (List)

Description

Using the DataSet object, data may be exchanged across several actions.
A DataSet object is global and defined by the Screen object. Any VBS action may
access the data.
The DataSet object at the Screen object must be addressed according to picture
hierarchy and shall persist as long as the picture is displayed. The global object
persists over the entire Runtime time period.
Access uses the DataItem object.
Note:
Objects of type Screen, Screens, ScreenItem, ScreenItems, Tag and TagSet
cannot be included in the DataSet list.
The DataSet object does not support any classes.

Usage
Using the " DataSet " list, you may:


Output or process (enumerate) all objects in the list.



Output the number of elements contained ( " Count " property).



Process a specific object in the list ( " Item " method).



Add an object to the list ( " Add " method).



Remove a specific object from the list ( " Remove " method).



Remove all objects from the list ( " RemoveAll " method).

Access to list elements uses:
HMIRuntime.DataSet( " Itemname " )

Printout of the Online Help
Creating Procedures and Actions with VBS

105

VBS Reference

11.05

For a picture-specific list, access uses:
HMIRuntime.Screens( " Screenname " ).DataSet( " Itemname " )
In a picture, you may access the DataSet object of the picture by using:
DataSet( " Itemname " )
If upon access the stated name does not exist in the list, VT_Empty is returned and
an Exception is triggered.

Example
The example shows how to add a value to the list, how to read it and remove it. It
make sense to perform this in several different actions.
'VBS162
HMIRuntime.DataSet.Add " motor1 " , 23
HMIRuntime.Trace " motor1: " & HMIRuntime.DataSet( " motor1 " ).Value &
vbNewLine
HMIRuntime.DataSet.Remove( " motor1 " )

13.1.5 HMIRuntime Object

Description

The HMIRuntime object represents the graphic runtime environment.

106

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Usage
The " HMIRuntime " object can be used for the following, for example:


Read or set the current Runtime language ( " Language " property).



Read or set the name of the current base picture ( " BaseScreenName "
property).



Read the path of the active Runtime project ( " ActiveProject " property).



Access tags ( " Tags " property).



Access tags of a list ( " DataSet " property).



Exit runtime ( " Stop " method).



Display messages in a diagnostics window ( " Trace " method).

Example
The following command terminates WinCC runtime:
'VBS3
HMIRuntime.Stop

13.1.6 Item Object

Description
The " Item " object provides a reference to the current object.

Usage
The " Item " object is used, for example, to address the properties of the object
currently selected in Graphics Designer.

Example
In the following example, a rectangle has been created. When the object has been
selected, all the properties of the current object can be set a background color red:
'VBS195
Item.BackColor = (255,0,0)

Printout of the Online Help
Creating Procedures and Actions with VBS

107

VBS Reference

11.05

13.1.7 Layer Object

Description

The Layer returns the result of access to the Layers list.

Parent Object
Picture, in which the picture layer is.

Usage
Depending on certain events, the Layer object can be used to obtain access to the
properties of a complete layer in order, for example, to hide or unhide a layer with
operating elements according to the operator authorization.
The " Layer " object can be used to:


To activate or deactivate the visualization of a layer ( " Visible " property).



To read out the name of a layer ( " Name " property).

Note:
The Layer Property defines the layer in which the object is located. Layer 0 is
displayed as layer “0”. During access using VBS, the layers are counted up from
1. Therefore, layer 1 must be referred to as layers(2).
Example
In the following example, Layer 1 is set invisible:
'VBS4
Layers(2).Visible = vbFalse

108

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.1.8 Layers Object (List)

Description

The Layers list enables access to all 32 layers of the graphical runtime system.

Parent Object
Picture, in which the picture layer is.

Usage
The " Layers " list can be used to:


Process all layers in the list ( " _NewEnum " property).



Count all layers contained in the list ( " Count " property).



Process a layer from the list ( " Item " method).

The properties represent default properties and methods of a list and are not
described in detail in the WinCC documentation.

Printout of the Online Help
Creating Procedures and Actions with VBS

109

VBS Reference

11.05

13.1.9 Logging Object

Description

Using the object, swapped archive segments may be reconnected to Runtime, or
previously swapped archive segments may be deleted again. Therein


Archive segments to be swapped are copied to the common archiving directory
of the WinCC project, or



Previously swapped archive segments are deleted in the common archiving
directory.

Using parameters you may control from where archive segments are to be
swapped. You may also specify the time period over which archive segments are
to be swapped or deleted. Archive segments are copied to the common archiving
directory of the project.
If an error occurred during the operation with archiving segments, the method used
returns an error message. Additional information may be found under the subject
heading " Error Messages from the Database Area " .
Error Messages from the Data Bank Area

Usage
Previously swapped archive segments of Alarm Logging and Tag Logging may be
connected with Runtime ( " Restore " method).
Previously swapped archive segments of Alarm Logging and Tag Logging may be
deleted from the Runtime project ( " Remove " method).

Example
In the following example, archive segments from Alarm Logging and Tag Logging
are swapped and the return value is output as Trace.
'VBS189
HMIRuntime.Trace " Ret: " & HMIRuntime.Logging.Restore( " D:\Folder " , " 2004-0914 " , " 2004-09-20 " ,-1) & vbNewLine

110

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.1.10 ScreenItem Object

Description

The ScreenItem object returns the result of access to the ScreenItem list.

Parent Object
Picture containing the picture element.

Usage
The ScreenItem object can be used to access the properties of graphic objects
within a picture according to certain events.
The " ScreenItem " object can be used for the following, for example:


To activate or deactivate the visualization of an object ( " Visible " property).



To release or block the operation of an object ( " Enabled " property).



Change the width and height of an object ( " Height " and " Width " properties).



Change the position of an object ( " Top " and " Left " properties).



Read out and define a layer in which a graphic object is located ( " Layer "
property).



Read out or define the name of a graphic object ( " ObjectName " property).



Define a reference to the superordinate picture ( " Parent " property).

Using the " Activate " method, the focus is set on the respective ScreenItem object.
If the focus cannot be set because the object is non-operable, for example, an
error is generated. Using error processing (On Error Resume Next), the error may
be evaluated.

Possible features of ScreenItem
The " ScreenItem " object can contain the following object types:
Standard objects

Smart Objects

Windows
Objects

Controls

Continue

Ellipse

3D Bar

Button

WinCC Alarm
Control

Customized
object

Printout of the Online Help
Creating Procedures and Actions with VBS

111

VBS Reference

11.05

Standard objects

Smart Objects

Windows
Objects

Controls

Ellipse Arc

Application
Window

Check Box

WinCC
Group object
Digital/Analog Clock

Ellipse Segment

Bar

Option Group

WinCC DXF Control

Circle

Picture Window Round Button WinCC Function
Trend Control

Circular Arc

Control

Pie Segment

I/O Field

WinCC Online Table
Control

Line

Graphic Object

WinCC Online Trend
Control

Polygon

OLE Object

WinCC Push Button
Control

Polygon Line

Group Display

WinCC Slider
Control

Rectangle

Text List

HMI Symbol Library
1.4.1

Rounded
Rectangle

Status Display

Slider

Continue

WinCC Gauge
Control

Static Text
Connector
Detailed descriptions of the individual object types is provided under " ScreenItem
Object Types " . The ScreenItem object's " Type " property can be used to address
the object types via the VBS Type ID.

Object properties
The " ScreenItem " object has different properties according to the features. The
following section describes the properties which all ScreenItem object types have:

112

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

When a specific object type is addressed, certain further properties are added to
the standard properties:

The additional properties are indicated in the descriptions of the individual object
types.

Example
In the following example, the radius of a circle is defined in runtime per mouse click
on 2:
Sub OnClick (ByVal Item)
'VBS5
Dim objCircle
Set objCircle= ScreenItems( " Circle1 " )
objCircle.Radius = 2
End Sub

Printout of the Online Help
Creating Procedures and Actions with VBS

113

VBS Reference

11.05

13.1.11 ScreenItems Object (List)

Description

The " ScreenItems " list can be used to reference an object in the picture.
Parent Object
Picture containing the picture element.
Usage
The " ScreenItems " list can be used to:


To display or edit all objects in the list (i.e. all objects within a picture)
( " _NewEnum " property).



To count the objects in a picture ( " Count " property).



To process a specific object in the list ( " Item " method).

The properties are standard properties and methods of a collection and are not
described in detail in the WinCC documentation.
Special features of the ScreenItem object
If an external control (ActiveX control or OLE object) is embedded in WinCC, it is
possible that the properties of the embedded controls have the same name with
the general properties of the ScreenItem object. In such cases, the ScreenItem
properties have priority.
The properties of the embedded controls can also be addressed via the " object "
property:
The " object " property is only provided by ActiveX controls and OLE objects.
Example:
'Control1 ist ein eingebettetes ActiveX-Control mit der Eigenschaft type
Dim Control
Set Control=ScreenItems( " Control1 " )
Control.object.type
'Control1 ist ein WinCC-Control
Dim Control
Set Control=ScreenItems( " Control1 " )
Control.type

114

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Example
In the following example, the name of the objects in the current picture are
displayed in a message box:
Sub OnClick(ByVal Item)
'VBS6
Dim lngAnswer
Dim lngIndex
lngIndex = 1
For lngIndex = 1 To ScreenItems.Count
lngAnswer = MsgBox(ScreenItems(lngIndex).Objectname, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next
End Sub

13.1.12 Screen Object

Description

The Screen object returns the result of access to the Screen list. All the properties
and methods of this object can also be edited directly in runtime. The " Screen "
object represents a WinCC picture in runtime and contains all the properties of the
picture document and picture view.
The " Screen " object also contains the following:


A list of all the graphic objects contained in the addressed picture which can be
addressed by the " ScreenItems " object.



A list of all the layers contained in the addressed picture which can be
addressed by the " Layers " object.

Printout of the Online Help
Creating Procedures and Actions with VBS

115

VBS Reference

11.05

Parent Object
A picture window in which the Screen object is embedded.
When the Screen object is the basic picture, the Parent object is not defined and
set to zero.
Usage
The " Screen " object can be used for the following, for example:


To release or block the operation of a screen ( " Enabled " property).



Change the width and height of a screen ( " Height " and " Width " properties).



Zoom a picture ( " Zoom " property).



Modify the fill pattern, background color and fill pattern color ( " Fillstyle " ,
" Backcolor " and " Fillcolor " properties).

Note:
If a Change Picture is executed, all the open references are invalid for pictures no
longer open. It is then no longer possible to work with these references.
Example
In the following example, the width of the first picture in Runtime is increased by 20
pixels:
'VBS7
Dim objScreen
Set objScreen = HMIRuntime.Screens(1)
MsgBox " Screen width before changing: " & objScreen.Width
objScreen.Width = objScreen.Width + 20
MsgBox " Screen width after changing: " & objScreen.Width
Notes on Cross References
All the pictures which are addressed with the standard formulation
HMIRuntime.BaseScreenName = " Screenname "
are automatically compiled by the CrossReference of WinCC and then listed in the
picture properties.
If pictures are addressed with different formulations in the code, this can be notified
by the following section of the CrossReference:
' WINCC:SCREENNAME_SECTION_START
Const ScreenNameInAction = " ScreenName "
' WINCC:SCREENNAME_SECTION_END
The section can be inserted in VBS actions as often as required.
Note:
Always enter picture names without the extension " PDL " for reasons of
compatibility with future versions.

116

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.1.13 Screens Object (List)

Description

By using the picture window technique, several windows can be opened
simultaneously in WinCC runtime but only one basic picture exists. The " Screens "
list enables access to all open pictures in runtime using the picture names. The
Screens list contains all invisible pictures.

Usage
When configuring a multi-user project, it is essential to specify the server prefix to
access a picture which is not on the local computer.
The " Screens " list can be used to:


Display or edit all the pictures within the list ( " _NewEnum " property).



To count the pictures in a project ( " Count " property).



To process a specific picture in the list ( " Item " method).



Initiate new drawing of all visible pictures ( " Refresh " method).

The properties are standard properties and methods of a collection and are not
described in detail in the WinCC documentation.
The access code, required in the VBS environment in the
HMIRuntime.Screens( & lt; access code & gt; ) instruction, must fulfill the syntax
requirements:
[ & lt; Grundbildname & gt; .] & lt; Bildfenstername & gt; [: & lt; Bildname & gt; ] ...
. & lt; Bildfenstername & gt; [: & lt; Bildname & gt; ]

Printout of the Online Help
Creating Procedures and Actions with VBS

117

VBS Reference

11.05

This means:


The access code expresses the picture hierarchy.



The picture names in the code can be omitted at any point.



The " AccessPath " property of the " Screen " object corresponds to the full
access code.



Always enter picture names without the extension " PDL " for reasons of
compatibility with future versions.



The basic picture can be addressed by the access code " " .

In addition, it has been defined that the basic picture can be addressed with Index
1.

Examples
The pictures are addressed by the hierarchy information in the list. There are two
options here, with or without use of the picture name. In the following examples, a
basic picture " BaseScreenName " is configured with a picture window
" ScreenWindow " . The picture window contains the picture " ScreenName " .
Addressing with the picture name
'VBS8
Set objScreen =
HMIRuntime.Screens( " BaseScreenName.ScreenWindow:ScreenName " )
Addressing without the picture name
'VBS9
Set objScreen = HMIRuntime.Screens( " ScreenWindow " )
Referencing the basic picture in various ways
'VBS10
Set objScreen = HMIRuntime.Screens(1)
'VBS11
Set objScreen = HMIRuntime.Screens( " " )
'VBS12
Set objScreen = HMIRuntime.Screens( " BaseScreenName " )

118

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.1.14 Project Object

Description

Using the object, information may be requested from the current Runtime project.
The project object is returned as the result of ActiveProject.

Usage
Using the " Project " object, you may:


Read the path of the current Runtime project ( " Path " property).



Read the name of the current Runtime project, without path or file extension
( " Name " property).

Example
The following example returns name and path of the current Runtime project as
Trace:
'VBS159
HMIRuntime.Trace " Name: " & HMIRuntime.ActiveProject.Name & vbNewLine
HMIRuntime.Trace " Path: " & HMIRuntime.ActiveProject.Path & vbNewLine

Printout of the Online Help
Creating Procedures and Actions with VBS

119

VBS Reference

11.05

13.1.15 Tag Object

Description

A tag object is returned via the " Tags " list. A tag object can be used to address all
the properties and methods of a tag.
When creating a tag object, all the properties are installed with the following
values:


Value = VT_EMPTY



Name = Tag name



QualityCode = BAD NON-SPECIFIC



TimeStamp = 0



LastError = 0



ErrorDescription = " "

Note:
A summary of possible Quality Codes may be found in WinCC Information System
under key word " Communication " & gt; " Diagnostics " or " Communication " & gt; " Quality
Codes " .
Usage
The " Tag " object can be used to:


Read out information on the tag ( " Name " , " QualityCode " , " TimeStamp " ,
" LastError " and " ErrorDescription " properties)



Set a value for a tag ( " Write " method, " Value " property)



Read a value for a tag ( " Read " method, " Value " property)

Read the value of a " Tag1 " tag:
'VBS13
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Read()
MsgBox objTag.Value

120

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Declaration of tags in WinCC
Always define internal tags in VBScript using the " Dim " instruction in order to
prevent writing tags wrongly.
When creating a new action, the " Option explicit " instruction is automatically
entered in the declaration area and cannot be deleted.
Do not use the " Option explicit " instruction in the code because it may cause
runtime errors.
Example: Declaration of a VBScript " lngVar " tag:
'VBS14
Dim lngVar
lngVar = 5
MsgBox lngVar
Note:
Tag names must not contain any special characters.
Note:
Please note that when creating a tag, it must not contain a value (Value =
VT_EMPTY). Initialize the tags after declaration with the corresponding value.
Notes on Cross References
All the pictures which are addressed with the standard formulation
HMIRuntime.Tags( " Tagname " )
are automatically compiled by the CrossReference of WinCC and then listed in the
picture properties.
If tags are addressed with different formulations in the code, this can be notified by
the following section of the CrossReference:
' WINCC:TAGNAME_SECTION_START
Const TagNameInAction = " TagName "
' WINCC:TAGNAME_SECTION_END
The section can be inserted in VBS actions as often as required.
Note:
It is not possible to guarantee the compilation of combined tag names from the
CrossReference.

Printout of the Online Help
Creating Procedures and Actions with VBS

121

VBS Reference

11.05

13.1.16 Tags Object (List)

Description

The " Tags " list enables access to tags in WinCC runtime. The result of access to
the " Tags " list is returned by an object of the type " Tag " . The Tag object can be
used to access all the tag properties and methods.
Note:
" Tags " is a list with a restricted functional scope. The tags in the list cannot be
accessed via the index but only by using the tag names. The standard methods
get_Count and get_NewEnum cannot be used in the Tags list.
Usage
Tags in the list are accessed via:
HMIRuntime.Tags( " Tagname " )
The Tags list is used to declare tags (tag objects) for read and write access. In
order that the read and write access can be executed without any errors, the
corresponding tags must be available in the WinCC Tag Management.
Using VBScript in WinCC it is possible to address tags directly by their name to
define and read values. If you wish to inquire about additional tag properties, such
as quality code or time stamp, or wish to execute error processing, you must
address the tag through tags list. The tag object returned enables access to all tag
properties and methods.
Using the " CreateTagSet " method, you may generate a TagSet object which allows
simultaneous access to several tags.

Example
There are two options when creating tags:


With specification of the server prefix: For tags in multi-user systems which are
not stored locally.



Direct use of the tag name: For tags stored locally on the computer.

Specification of the server prefix
'VBS15
Dim objTag
Set objTag = HMIRuntime.Tags( " Serverprefix::Tagname " )
If the server prefix is entered directly, the " ServerPrefix " property is assigned the
corresponding value.

122

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Specification of the tag name
'VBS16
Dim objTag
Set objTag = HMIRuntime.Tags( " Tagname " )
If just the tag name is used, the " ServerPrefix " and " TagPrefix " properties are
assigned the values from the current context (current picture window).

Printout of the Online Help
Creating Procedures and Actions with VBS

123

VBS Reference

11.05

13.1.17 TagSet Object (List)

Description
The object " TagSet " enables simultaneous access to several tags in one call. This
features better performance and lower communication load that single access to
various tags.

Usage
Using the TagSet object, you may:


Add tags to the list ( " Add " method)



Access tag objects contained in the list, and their properties ( " Item " method)



Write all tags of the list ( " Write " method)



Read all tags of the list ( " Read " method)



Remove single tags from the list ( " Remove " method)



Remove all tags from the list ( " RemoveAll " method)

Tags in the list are accessed via:
'VBS169
Dim myTags
myTags = HMIRuntime.Tags.CreateTagSet
myTags( " Tagname " )
In order to have error-free read/write access to tags (tag objects) of the list, the
respective tags must exist in WinCC tag management.
If an error occurred during read/write access, the method used will return an error
message using the " LastError " and " ErrorDescription " properties.
Example
The following example shows how to generate a TagSet object, how to add tags,
and how to write values.
'VBS168
Build a Reference to the TagSet Object
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
'Add Tags to the Collection
group.Add " Motor1 "
group.Add " Motor2 "
'Set the Values of the Tags
group( " Motor1 " ).Value = 3
group( " Motor2 " ).Value = 9
'Write the Values to the DataManager
group.Write

124

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2 Object Type of the ScreenItem Object

Introduction
The following section lists all the available types of the " ScreenItem " object.
The features of the " ScreenItem " object represent all the graphic objects available
in WinCC Graphics Designer.
The object types are divided into the following groups according to their
arrangement in Graphics Designer:

13.2.1 Standard objects

13.2.1.1 Ellipse

Description

Object Type of the ScreenItem Object. Represents the graphic object " Ellipse "

Type Identifier in VBS
HMIEllipse

Usage
In the following example, the object with the name " Ellipse1 " is moved 10 pixels to
the right:
'VBS17
Dim objEllipse
Set objEllipse = ScreenItems( " Ellipse1 " )
objEllipse.Left = objEllipse.Left + 10

Printout of the Online Help
Creating Procedures and Actions with VBS

125

VBS Reference

11.05

13.2.1.2 Ellipse Arc

Description

Object Type of the ScreenItem Object. Represents the graphic object " Ellipse Arc "

Type Identifier in VBS
HMIEllipticalArc

Usage
In the following example, the object with the name " EllipseArc1 " is moved 10 pixels
to the right:
'VBS18
Dim objEllipseArc
Set objEllipseArc = ScreenItems( " EllipseArc1 " )
objEllipseArc.Left = objEllipseArc.Left + 10

13.2.1.3 Ellipse Segment

Description

Object Type of ScreenItem Object. Represents the graphic object " Ellipse
Segment "

Type Identifier in VBS
HMIEllipseSegment

126

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Usage
In the following example, the object with the name " EllipseSegment1 " is moved 10
pixels to the right:
'VBS19
Dim objEllipseSeg
Set objEllipseSeg = ScreenItems( " EllipseSegment1 " )
objEllipseSeg.Left = objEllipseSeg.Left + 10

13.2.1.4 Circle

Description

Object Type of ScreenItem Object. Represents the graphic object " Circle "

Type Identifier in VBS
HMICircle

Usage
In the following example, the object with the name " Circle1 " is moved 10 pixels to
the right:
'VBS20
Dim objCircle
Set objCircle = ScreenItems( " Circle1 " )
objCircle.Left = objCircle.Left + 10

13.2.1.5 Circular Arc

Printout of the Online Help
Creating Procedures and Actions with VBS

127

VBS Reference

11.05

Description

Object Type of ScreenItem Object. Represents the graphic object " Circular Arc "

Type Identifier in VBS
HMICircularArc

Usage
In the following example, the object with the name " CircularArc1 " is moved 10
pixels to the right:
'VBS21
Dim objCircularArc
Set objCircularArc = ScreenItems( " CircularArc1 " )
objCircularArc.Left = objCircularArc.Left + 10

13.2.1.6 Pie Segment

Description

Object Type of ScreenItem Object. Represents the graphic object " Pie Segment "

Type Identifier in VBS
HMICircleSegment

Usage

128

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

In the following example, the object with the name " PieSegment1 " is moved 10
pixels to the right:
'VBS22
Dim objCircleSeg
Set objCircleSeg = ScreenItems( " PieSegment1 " )
objCircleSeg.Left = objCircleSeg.Left + 10

13.2.1.7 Line

Description

Object Type of ScreenItem Object. Represents the graphic object " Line "

Type Identifier in VBS
HMILine

Usage
In the following example, the object with the name " Line1 " is moved 10 pixels to the
right:
'VBS23
Dim objLine
Set objLine = ScreenItems( " Line1 " )
objLine.Left = objLine.Left + 10

13.2.1.8 Polygon

Printout of the Online Help
Creating Procedures and Actions with VBS

129

VBS Reference

11.05

Description

Object Type of ScreenItem Object. Represents the graphic object " Polygon "

Type Identifier in VBS
HMIPolygon

Usage
In the following example, the object with the name " Polygon1 " is moved 10 pixels
to the right:
'VBS24
Dim objPolygon
Set objPolygon = ScreenItems( " Polygon1 " )
objPolygon.Left = objPolygon.Left + 10

13.2.1.9 Polygon Line

Description

Object Type of ScreenItem Object. Represents the graphic object " Polyline "

Type Identifier in VBS
HMIPolyLine

130

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Usage
In the following example, the object with the name " Polyline1 " is moved 10 pixels to
the right:
'VBS25
Dim objPolyline
Set objPolyline = ScreenItems( " Polyline1 " )
objPolyline.Left = objPolyline.Left + 10

13.2.1.10 Rectangle

Description

Object Type of ScreenItem Object. Represents the graphic object " Rectangle "

Type Identifier in VBS
HMIRectangle

Usage
In the following example, the object with the name " Rectangle1 " is moved 10 pixels
to the right:
'VBS26
Dim objRectangle
Set objRectangle = ScreenItems( " Rectangle1 " )
objRectangle.Left = objRectangle.Left + 10

Printout of the Online Help
Creating Procedures and Actions with VBS

131

VBS Reference

11.05

Notes on Error Handling
The rectangle and rounded rectangle are mapped to an " HMIRectangle " type in the
object model. Since the two objects have different properties, the availability of the
property (dynamic type compilation in runtime) should be queried via an exception
measure. The exception measure is activated for the corresponding procedure by
the following instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:
On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
Sub OnClick(ByVal Item)
'VBS27
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If " HMIRectangle " = objScreenItem.Type Then
'
'=== Property " RoundCornerHeight " only available for RoundRectangle
objScreenItem.RoundCornerHeight = objScreenItem.RoundCornerHeight * 2
If 0 & lt; & gt; Err.Number Then
HMIRuntime.Trace objScreenItem.Name & " : no RoundedRectangle " & vbCrLf
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

132

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2.1.11 Rounded Rectangle

Description

Object Type of ScreenItem Object. Represents the graphic object " Rounded
Rectangle " .

Type Identifier in VBS
HMIRectangle

Usage
In the following example, the object with the name " RoundedRectangle1 " is moved
10 pixels to the right:
'VBS28
Dim objRoundedRectangle
Set objRoundedRectangle = ScreenItems( " RoundedRectangle1 " )
objRoundedRectangle.Left = objRoundedRectangle.Left + 10

Notes on Error Handling
The rectangle and rounded rectangle are mapped to an " HMIRectangle " type in the
object model. Since the two objects have different properties, the availability of the
property (dynamic type compilation in runtime) should be queried via an exception
measure. The exception measure is activated for the corresponding procedure by
the following instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:

Printout of the Online Help
Creating Procedures and Actions with VBS

133

VBS Reference

11.05

On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
Sub OnClick(ByVal Item)
'VBS29
Dim objScreenItem
On Error Resume Next 'Activation of errorhandling
For Each objScreenItem In ScreenItems
If " HMIRectangle " = objScreenItem.Type Then
'
'=== Property " RoundCornerHeight " available only for RoundRectangle
objScreenItem.RoundCornerHeight = objScreenItem.RoundCornerHeight * 2
If 0 & lt; & gt; Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & " : no RoundedRectangle " &
vbCrLf
Err.Clear 'Delete errormessage
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

13.2.1.12 Static Text

134

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description

Object Type of ScreenItem Object. Represents the graphic object " Static Text "

Type Identifier in VBS
HMITextField

Usage
In the following example, the object with the name " StaticText1 " is moved 10 pixels
to the right:
'VBS30
Dim objStaticText
Set objStaticText = ScreenItems( " StaticText1 " )
objStaticText.Left = objStaticText.Left + 10

13.2.1.13 Connector

Description

Object Type of ScreenItem Object. Represents the graphic object " Connector "

Type Identifier in VBS
HMIConnector
Usage

Printout of the Online Help
Creating Procedures and Actions with VBS

135

VBS Reference

11.05

In the following example, the object with the name " Connector1 " is moved 10 pixels
to the right:
'VBS31
Dim objConnector
Set objConnector = ScreenItems( " Connector1 " )
objConnector.Left = objConnector.Left + 10

136

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2.2 Smart Objects

Smart objects available

13.2.2.1 3D Bar

Description

Object Type of ScreenItem Object. Represents the graphic object " 3D Bar "

Type Identifier in VBS
HMIBar

Usage
In the following example, the object with the name " 3DBar1 " is moved 310 pixels to
the right:
'VBS32
Dim objBar
Set objBar = ScreenItems( " 3DBar1 " )
objBar.Left = objBar.Left + 10

Notes on Error Handling
Bars and 3D bars are imaged in the object model on a " HMIBar " type. Since the
two objects have different properties, the availability of the property (dynamic type
compilation in runtime) should be queried via an exception measure. The exception
measure is activated for the corresponding procedure by the following instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:

Printout of the Online Help
Creating Procedures and Actions with VBS

137

VBS Reference

11.05

On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
'VBS148
Sub OnClick(ByVal Item)
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If " HMIBar " = objScreenItem.Type Then
'
'=== Property " Layer00Value " only available for 3D bar
objScreenItem.Layer00Value = objScreenItem.Layer00Value * 2
If 0 & lt; & gt; Err.Number Then
HMIRuntime.Trace objScreenItem.Name & " : no 3D bar " & vbCrLf
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

138

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2.2.2 Application Window

Description

Object Type of ScreenItem Object. Represents the graphic object " Application
Window "

Type Identifier in VBS
HMIApplicationWindow

Usage
In the following example, the object with the name " ApplicationWindow1 " is moved
10 pixels to the right:
'VBS33
Dim objAppWindow
Set objAppWindow = ScreenItems( " ApplicationWindow1 " )
objAppWindow.Left = objAppWindow.Left + 10

13.2.2.3 Bar

Description

Object Type of ScreenItem Object. Represents the graphic object " Bar "

Type Identifier in VBS
HMIBar

Printout of the Online Help
Creating Procedures and Actions with VBS

139

VBS Reference

11.05

Usage
In the following example, the object with the name " Bar1 " is moved 10 pixels to the
right:
'VBS34
Dim objBar
Set objBar = ScreenItems( " Bar1 " )
objBar.Left = objBar.Left + 10

Notes on Error Handling
Bars and 3D bars are imaged in the object model on a " HMIBar " type. Since the
two objects have different properties, the availability of the property (dynamic type
compilation in runtime) should be queried via an exception measure. The exception
measure is activated for the corresponding procedure by the following instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:
On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
'VBS147
Sub OnClick(ByVal Item)
Dim objScreenItem
'
'Activation of errorhandling:
On Error Resume Next
For Each objScreenItem In ScreenItems
If " HMIBar " = objScreenItem.Type Then
'
'=== Property " LimitHigh4 " only available for bar
objScreenItem.LimitHigh4 = objScreenItem.LimitHigh4 * 2

140

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

If 0 & lt; & gt; Err.Number Then
HMIRuntime.Trace objScreenItem.Name & " : no bar " & vbCrLf
'
'Delete error message
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

13.2.2.4 Picture Window

Description

Object Type of ScreenItem Object. Represents the graphic object " Picture Window "

Type Identifier in VBS
HMIScreenWindow

Usage
In the following example, the object with the name " ScreenWindow1 " is moved 10
pixels to the right:
'VBS35
Dim objScrWindow
Set objScrWindow = ScreenItems( " ScreenWindow1 " )
objScrWindow.Left = objScrWindow.Left + 10

13.2.2.5 Control

Printout of the Online Help
Creating Procedures and Actions with VBS

141

VBS Reference

11.05

Description

Object Type of ScreenItem Object. Represents the graphic object " Control "
The Control object type always assumes the properties of the Control type
selected. In the case of controls provided by WinCC, the properties are indicated
under the description of the corresponding Control.
In the case of controls from external suppliers, the control properties are supplied
and thus not a part of this description. However, the control properties can be
queried using the " Item " property.

Type Identifier in VBS
Special WinCC type descriptions or version-independent ProgID

Usage
In the following example, the object with the name " Control1 " is moved 10 pixels to
the right:
'VBS36
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 10
Special feature
The controls provided by WinCC return a special ID as the type. It can be found
under the topic " Type Identification in VBS " in the individual descriptions of the
WinCC Controls.

Use of Controls from External Suppliers
In the case of non-WinCC controls, the version-independent ProgID is returned as
the type.
It is possible to determine the version-dependent ProgID or " User friendly Name "
from the ProgID: In the following example, " Control1 " is a control embedded in the
picture which already returns the version-independent ProgID as a result of the
Type property.
Note:

142

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Since not every Control has a version-dependent ProgID, an error handling
measure should be integrated to query the version-dependent ProgID or
UserFriendlyName. If no error handling is used, the code is terminated
immediately without any result when no ProgID is found.
Determine the version-dependent ProgID as follows:
'VBS37
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems( " Control1 " )
strCurrentVersion = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \CurVer\ " )
MsgBox strCurrentVersion
Note:
In order that example above works, a multimedia control should be inserted in the
picture.
Determine the User Friendly Name as follows:
'VBS38
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems( " Control1 " )
strFriendlyName = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \ " )
MsgBox strFriendlyName
Note:
In order that example above works, a multimedia control should be inserted in the
picture.
If a non-WinCC control is used, it is possible that the properties provided by the
control have the same names as the general ScreenItem properties. In such cases,
the ScreenItem properties have priority. The " hidden " properties of an external
control supplier can be accessed using the additional " Object " property. Address
the properties of an external control supplier as follows:
Control.object.type
Only use the form
Control.type
In the case of identical names, the properties of the ScreenItem object are used.

Printout of the Online Help
Creating Procedures and Actions with VBS

143

VBS Reference

11.05

13.2.2.6 I/O Field

Description

Object Type of ScreenItem Object. Represents the graphic object " I/O Field "

Type Identifier in VBS
HMIIOField

Usage
In the following example, the object with the name " IOField1 " is moved 10 pixels to
the right:
'VBS39
Dim objIOField
Set objIOField = ScreenItems( " IOField1 " )
objIOField.Left = objIOField.Left + 10

13.2.2.7 Graphic Object

Description

Object Type of ScreenItem Object. Represents the graphic object " Graphic Object "

Type Identifier in VBS
HMIGraphicView

144

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Usage
In the following example, the object with the name " GraphicObject1 " is moved 10
pixels to the right:
'VBS40
Dim objGraphicView
Set objGraphicView= ScreenItems( " GraphicObject1 " )
objGraphicView.Left = objGraphicView.Left + 10

13.2.2.8 OLE Object

Description

Object Type of ScreenItem Object. Represents the graphic object " OLE Object " .
The return value is a STRING type.

Type Identifier in VBS
Version-independent ProgID

Usage
In the following example, the object with the name " OLEElement1 " is moved 10
pixels to the right:
'VBS41
Dim objOLEElement
Set objOLEElement = ScreenItems( " OLEElement1 " )
objOLEElement.Left = objOLEElement.Left + 10
Special feature
In the case of OLE objects, the version-independent ProgID is returned as the
type.
It is possible to determine the version-dependent ProgID or " User friendly Name "
from the ProgID: In the following example, " OLEObject1 " is a control embedded in
the picture which already returns the version-independent ProgID as a result of the
Type property.

Printout of the Online Help
Creating Procedures and Actions with VBS

145

VBS Reference

11.05

Note:
Since not every Control has a version-dependent ProgID, an error handling
measure should be integrated to query the version-dependent ProgID or
UserFriendlyName. If no error handling is used, the code is terminated
immediately without any result when no ProgID is found.
Determine the version-dependent ProgID as follows:
'VBS42
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems( " OLEElement1 " )
strCurrentVersion = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \CurVer\ " )
MsgBox strCurrentVersion
Note:
In order that the example above works, a Word document should be embedded in
the picture as an OLE object.
Determine the User Friendly Name as follows:
'VBS43
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems( " OLEElement1 " )
strFriendlyName = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \ " )
MsgBox strFriendlyName
Note:
In order that the example above works, a Word document should be embedded in
the picture as an OLE object.
Using OLE objects
If an OLE object is used, it is possible that the properties provided by the OLE
object have the same names as the general ScreenItem properties. In such cases,
the ScreenItem properties have priority. The " hidden " properties of an OLE object
can be accessed using the additional " Object " property. Address the properties of
an OLE object as follows:
OLEObjekt.object.type
Only use the form
OLEObjekt.type
In the case of identical names, the properties of the ScreenItem object are used.

146

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2.2.9 Group Display

Description

Object Type of ScreenItem Object. Represents the graphic object " Group Display "

Type Identifier in VBS
HMIGroupDisplay

Usage
In the following example, the object with the name " GroupDisplay1 " is moved 10
pixels to the right:
'VBS44
Dim objGroupDisplay
Set objGroupDisplay = ScreenItems( " GroupDisplay1 " )
objGroupDisplay.Left = objGroupDisplay.Left + 10

13.2.2.10 Text List

Description

Object Type of ScreenItem Object. Represents the graphic object " Text List "

Type Identifier in VBS
HMISymbolicIOField

Printout of the Online Help
Creating Procedures and Actions with VBS

147

VBS Reference

11.05

Usage
In the following example, the object with the name " TextList1 " is moved 10 pixels to
the right:
'VBS45
Dim objSymIO
Set objSymIO = ScreenItems( " TextList1 " )
objSymIO.Left = objSymIO.Left + 10

13.2.2.11 Status Display

Description

Object Type of ScreenItem Object. Represents the graphic object " Status Display "

Type Identifier in VBS
HMIGraphicIOField

Usage
In the following example, the object with the name " StatusDisplay1 " is moved 10
pixels to the right:
'VBS46
Dim objGraphicIO
Set objGraphicIO= ScreenItems( " StatusDisplay1 " )
objGraphicIO.Left = objGraphicIO.Left + 10

148

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2.3 Windows Objects

13.2.3.1 Button

Description

Object Type of ScreenItem Object. Represents the graphic object " Button "

Type Identifier in VBS
HMIButton

Usage
In the following example, the object with the name " Button1 " is moved 10 pixels to
the right:
'VBS47
Dim cmdButton
Set cmdButton = ScreenItems( " Button1 " )
cmdButton.Left = cmdButton.Left + 10

Notes on Error Handling
Buttons and pushbuttons are mapped in the object model to an " HMIButton " type.
Since the objects have different properties, the availability of the property (dynamic
type compilation in runtime) should be queried via an exception measure. The
exception measure is activated for the corresponding procedure by the following
instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:

Printout of the Online Help
Creating Procedures and Actions with VBS

149

VBS Reference

11.05

On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
Sub OnClick(ByVal Item)
'VBS48
Dim objScreenItem
On Error Resume Next 'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = " HMIButton " Then
'
'=== Property " Text " available only for Standard-Button
objScreenItem.Text = " Windows "
If 0 & lt; & gt; Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & " : no Windows-Button " & vbCrLf
Err.Clear 'Delete error message
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling
End Sub

13.2.3.2 Check Box

150

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description

Object Type of ScreenItem Object. Represents the graphic object " Check Box "

Type Identifier in VBS
HMICheckBox

Usage
In the following example, the object with the name " CheckBox1 " is moved 10 pixels
to the right:
'VBS49
Dim chkCheckBox
Set chkCheckBox = ScreenItems( " CheckBox1 " )
chkCheckBox.Left = chkCheckBox.Left + 10

13.2.3.3 Option Group

Description

Object Type of ScreenItem Object. Represents the graphic object " Option Group "

Type Identifier in VBS
HMIOptionGroup
Usage

Printout of the Online Help
Creating Procedures and Actions with VBS

151

VBS Reference

11.05

In the following example, the object with the name " RadioBox1 " is moved 10 pixels
to the right:
'VBS50
Dim objOptionGroup
Set objOptionGroup = ScreenItems( " RadioBox1 " )
objOptionGroup.Left = objOptionGroup.Left + 10

13.2.3.4 Round Button

Description

Object Type of ScreenItem Object Represents the graphic object " Round Button "

Type Identifier in VBS
HMISwitch

Usage
In the following example, the object with the name " RoundButton1 " is moved 10
pixels to the right:
'VBS51
Dim objSwitch
Set objSwitch= ScreenItems( " RoundButton1 " )
objSwitch.Left = objSwitch.Left + 10

13.2.3.5 Slider

152

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description

Object Type of ScreenItem Object. Represents the graphic object " Slider "

Type Identifier in VBS
HMISlider

Usage
In the following example, the object with the name " Slider1 " is moved 10 pixels to
the right:
'VBS53
Dim sldSlider
Set sldSlider = ScreenItems( " Slider1 " )
sldSlider.Left = sldSlider.Left + 10
Notes on Error Handling
Sliders and WinCC slider controls are mapped in the object model to an
" HMISlider " type. Since the objects have different properties, the availability of the
property (dynamic type compilation in runtime) should be queried via an exception
measure. The exception measure is activated for the corresponding procedure by
the following instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:
On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.

Printout of the Online Help
Creating Procedures and Actions with VBS

153

VBS Reference

11.05

In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
Sub OnClick(Byval Item)
Dim ScreenItem
' Aktivierung der Fehlerbehandlung:
On Error Resume Next
For Each ScreenItem In ScreenItems
If ScreenItem.Type = " HMISlider " Then
'=== Eigenschaft " BevelColorUp " ist nur bei einem WinCC Slider Control
vorhanden
ScreenItem.BevelColorUp = 1
If (Err.Number & lt; & gt; 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + " : kein Windows-Slider " + vbCrlf)
' Fehlermeldung löschen
Err.Clear
End If
'=== Eigenschaft " BorderStyle " ist nur bei einem Windows-Slider vorhanden
ScreenItem.BorderStyle = 1
If (Err.Number & lt; & gt; 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + " : kein WinCC Slider Control " +
vbCrlf)
Err.Clear
End If
End If
Next
On Error GoTo 0 ' Deaktivierung der Fehlerbehandlung
End Sub

154

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2.4 Controls

Special features with controls
In the case of non-WinCC controls, the version-independent ProgID is returned as
the type.
It is possible to determine the version-dependent ProgID or " User friendly Name "
from the ProgID: In the following example, " Control1 " is a control embedded in the
picture which already returns the version-independent ProgID as a result of the
Type property.
Note:
Since not every Control has a version-dependent ProgID, an error handling
measure should be integrated to query the version-dependent ProgID or
UserFriendlyName. If no error handling is used, the code is terminated
immediately without any result when no ProgID is found.
Determine the version-dependent ProgID as follows:
'VBS153
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems( " Control1 " )
strCurrentVersion = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \CurVer\ " )
MsgBox strCurrentVersion
Note:
In order that example above works, a multimedia control should be inserted in the
picture.
Determine the User Friendly Name as follows:
'VBS154
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems( " Control1 " )
strFriendlyName = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \ " )
MsgBox strFriendlyName
Note:
In order that example above works, a multimedia control should be inserted in the
picture.
Restrictions of VBS for Dynamization by Controls
If Controls are to be dynamized with, the following conditions must be fulfilled:

Printout of the Online Help
Creating Procedures and Actions with VBS

155

VBS Reference

11.05

Methods
The " ByRef " declaration may only be implemented as a " Variant " (ByRef xxx as
Variant)
The " ByVal " declaration may only be implemented with tag types (ByVal xxx as
Long)
Characteristics
The " ByRef " declaration may only be implemented as a " Variant " (ByRef xxx as
Variant)
The " ByVal " declaration may only be implemented with tag types (ByVal xxx as
Long)
Events
The " ByRef " declaration is not permitted.
The " ByVal " declaration may only be implemented as a " Variant " (ByVal xxx as
Variant)
Arrays
If arrays are used, they must be declared with (ByRef xxx As Variant).
In order that arrays can be transferred in variants, variant tag must also be inserted
as an intermediate tag according to the following scheme:
'VBS151
Dim arrayPoints(200)
Dim vArrayCoercion
'Variant for array Coercion
' Make the VBS Array compatibile with the OLE Automation
vArrayCoercion = (arrayPoints)
objTrendControl.DataXY = vArrayCoercion ' this array will occur in the control

Use of Controls from External Suppliers
If a non-WinCC control is used, it is possible that the properties provided by the
control have the same names as the general ScreenItem properties. In such cases,
the ScreenItem properties have priority. The " hidden " properties of an external
control supplier can be accessed using the additional " object " property. Address
the properties of an external control supplier as follows:
Control.object.type
If the following form is used:
Control.type
The properties of the ScreenItem object are used in the case of identical names.
Double parameter
When using a Control which is not an internal WinCC control, it is possible that the
event prototypes contain a parameter with the name " Item " . In this case, the name
of the parameter is renamed according to " ObjectItem " in the VBS prototype
submitted. If this name already exists, the name is differentiated by numbers being
appended.

156

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.2.4.1 WinCC Alarm Control

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC Alarm
Control "

Type Identifier in VBS
HMIMessageView

Usage
In the following example, the object with the name " Control1 " is moved 10 pixels to
the right:
'VBS54
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 10

13.2.4.2 WinCC Digital Analog Clock

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC
Digital/Analog Clock "

Type Identifier in VBS
HMIClock

Printout of the Online Help
Creating Procedures and Actions with VBS

157

VBS Reference

11.05

Usage
In the following example, the object with the name " Control1 " is moved 11 pixels to
the right:
'VBS55
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 11

13.2.4.3 WinCC DXF Control

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC DXF
Control "

Type Identifier in VBS
HMIDXFView

Usage
In the following example, the object with the name " Control1 " is moved 12 pixels to
the right:
'VBS56
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 12

13.2.4.4 WinCC Function Trend Control

158

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC Function
Trend Control "

Type Identifier in VBS
HMIFunctionTrendView

Usage
In the following example, the object with the name " Control1 " is moved 13 pixels to
the right:
'VBS57
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 13

13.2.4.5 WinCC Gauge Control

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC Gauge
Control "

Type Identifier in VBS
HMIGauge
Usage

Printout of the Online Help
Creating Procedures and Actions with VBS

159

VBS Reference

11.05

In the following example, the object with the name " Control1 " is moved 14 pixels to
the right:
'VBS58
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 14

13.2.4.6 WinCC Online Table Control

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC Online
Table Control "

Type Identifier in VBS
HMITableView

Usage
In the following example, the object with the name " Control1 " is moved 15 pixels to
the right:
'VBS59
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 15

13.2.4.7 WinCC Online Trend Control

160

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC Online
Trend Control "

Type Identifier in VBS
HMITrendView

Usage
In the following example, the object with the name " Control1 " is moved 16 pixels to
the right:
'VBS60
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 16

13.2.4.8 WinCC Push Button Control

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC Push
Button Control "

Type Identifier in VBS
HMIButton
Usage

Printout of the Online Help
Creating Procedures and Actions with VBS

161

VBS Reference

11.05

In the following example, the object with the name " Control1 " is moved 17 pixels to
the right:
'VBS61
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 17
Note:
The events KeyDown, KeyUp and KeyPress cannot be addressed by VBS. if it is
required to make controls dynamic with the help of VBS, no parameter must be
declared with ByRef.
Notes on Error Handling
Buttons and pushbuttons are mapped in the object model to an " HMIButton " type.
Since the objects have different properties, the availability of the property (dynamic
type compilation in runtime) should be queried via an exception measure. The
exception measure is activated for the corresponding procedure by the following
instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:
On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
'VBS62
Dim objScreenItem
On Error Resume Next 'Activation of errorhandling
For Each objScreenItem In ScreenItems
If objScreenItem.Type = " HMIButton " Then
'
'=== Property " Text " available only for Standard-Button
objScreenItem.Text = " Windows "

162

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

If 0 & lt; & gt; Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & " : no Windows-Button " & vbCrLf
Err.Clear 'Delete error message
End If
'
'=== Property " Caption " available only for PushButton
objScreenItem.Caption = " Push "
If 0 & lt; & gt; Err.Number Then
HMIRuntime.Trace objScreenItem.ObjectName & " : no Control " & vbCrLf
Err.Clear
End If
End If
Next
On Error Goto 0 'Deactivation of errorhandling

13.2.4.9 WinCC Slider Control

Description

Object Type of ScreenItem Object. Represents the graphic object " WinCC Slider
Control "

Type Identifier in VBS
HMISlider

Usage
In the following example, the object with the name " Control1 " is moved 19 pixels to
the right:
'VBS63
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 19
Notes on Error Handling

Printout of the Online Help
Creating Procedures and Actions with VBS

163

VBS Reference

11.05

Sliders and WinCC slider controls are mapped in the object model to an
" HMISlider " type. Since the objects have different properties, the availability of the
property (dynamic type compilation in runtime) should be queried via an exception
measure. The exception measure is activated for the corresponding procedure by
the following instruction:
On Error Resume Next
The instruction causes the VBScript engine to initiate the follow-on command in the
case of a runtime error.
The error code can subsequently be checked using the Err object. In order to
deactivate the handling of runtime errors in scripts, use the following command:
On Error Goto 0
Handling errors always relates to the procedure layer. If a script in a procedure
causes an error, VBScript checks whether an error handling measure is
implemented in this layer. If not, control is transferred one layer up (to the calling
procedure). If there is no error handling measure here either, the control is
transferred yet another layer up. This continues until either the top module level is
reached or the code for runtime error handling is located. If the activation of the
runtime error handling fails, the control is transferred to the top level on the internal
VBScript runtime error handing. This opens an error dialog and stops the script.
The " On Error Resume Next " command can be installed on all layers (i.e. also in
procedures). When the error handling measure is use, it can basically be
determined whether the user is actually using the required implementation type.
In addition, it can be ensured that there is no termination of execution due to a
faulty access to the object.

Examples of error handling
Sub OnClick(Byval Item)
Dim ScreenItem
' Aktivierung der Fehlerbehandlung:
On Error Resume Next
For Each ScreenItem In ScreenItems
If ScreenItem.Type = " HMISlider " Then
'=== Eigenschaft " BevelColorUp " ist nur bei einem WinCC Slider Control
vorhanden
ScreenItem.BevelColorUp = 1
If (Err.Number & lt; & gt; 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + " : kein Windows-Slider " + vbCrlf)
' Fehlermeldung löschen
Err.Clear
End If
'=== Eigenschaft " BorderStyle " ist nur bei einem Windows-Slider vorhanden
ScreenItem.BorderStyle = 1
If (Err.Number & lt; & gt; 0) Then
HMIRuntime.Trace(ScreenItem.ObjectName + " : kein WinCC Slider Control " +
vbCrlf)
Err.Clear
End If
End If
Next

164

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

On Error GoTo 0 ' Deaktivierung der Fehlerbehandlung
End Sub

13.2.4.10 HMI Symbol Library 1.4.1

Description

Object Type of ScreenItem Object. Represents the graphic object " HMI Symbol
Library "

Type Identifier in VBS
HMISymbolLibrary

Usage
In the following example, the object with the name " Control1 " is moved 20 pixels to
the right:
'VBS64
Dim objControl
Set objControl = ScreenItems( " Control1 " )
objControl.Left = objControl.Left + 20

13.2.5 Customized Object

Description

Printout of the Online Help
Creating Procedures and Actions with VBS

165

VBS Reference

11.05

Object Type of ScreenItem Object. Represents the graphic object " Customized
Object "

Type Identifier in VBS
HMIScreenModule

Usage
In the following example, the object with the name " CustomizedObject1 " is moved
10 pixels to the right:
'VBS65
Dim objCustomObject
Set objCustomObject = ScreenItems( " CustomizedObject1 " )
objCustomObject.Left = objCustomObject.Left + 10

13.2.6 Group Object

Description

Object Type of ScreenItem Object. Represents the graphic object " Group "

Type Identifier in VBS
HMIGroup

Usage
In the following example, the object with the name " Group1 " is moved 10 pixels to
the right:
'VBS66
Dim objGroup
Set objGroup = ScreenItems( " Group1 " )
objGroup.Left = objGroup.Left + 10

166

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3 Characteristics

Overview
The properties of the individual objects can be used to modify specific graphic
objects and tags in runtime , e.g. activating an operating element per mouse click
or triggering a color change by modifying a tag value.
Properties on graphic objects can be addressed via the following syntax:
Dim obj
Set obj = ScreenItems( " object1 " )
obj.property = Wert
In the following example, the object with the name " Control1 " is moved 10 pixels to
the right:
Dim obj
Set obj = ScreenItems( " control1 " )
obj.Left = obj.Left + 10
All the properties of the object and graphic object types in VBS are listed below in
alphabetical order.

13.3.1 A
13.3.1.1 AccessPath Property
Description
Displays the storage path (with hierarchy information) of a screen object (picture).
The property corresponds to the full access code on the Screens Collections.
STRING (read only)

Example
In the following example, the path of the picture " ScreenWindow1 " is issued:
'VBS67
Dim objScreen
Set objScreen = HMIRuntime.Screens( " ScreenWindow1 " )
MsgBox objScreen.AccessPath

13.3.1.2 Activate Property

Printout of the Online Help
Creating Procedures and Actions with VBS

167

VBS Reference

11.05

Description
The data to be displayed is only requested from the archive server when this
attribute is set. In order to reduce the picture opening times, this attribute should
not be set and the value only dynamically changed when necessary.
Write/Read access
To differentiate between the " Activate " property form the " Activate " method, the
property is accessed via " Object " .
Example
Dim ctrl
Set ctrl = ScreenItems( " Control " )
ctrl.Object.activate = true

13.3.1.3 ActiveProject Property
Description
Returns an object of type " Project " .

13.3.1.4 ActiveScreen Property

Description
Supplies a reference to the picture which contains the object with the current focus.
Usage
" ActiveScreen " is used in Runtime to address the properties of the picture which
contains the currently focussed object.
Example
The following example assigns the name of the current picture to the tag
" strScrName " and outputs it in a message:
'VBS68
Dim strScrName
strScrName = HMIRuntime.ActiveScreen.Objectname
MsgBox strScrName

168

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.1.5 ActiveProject Property

Description
Returns an object of type " Project " .

13.3.1.6 ActiveScreenItem Property

Description
Supplies a reference to the object currently in focus.

Usage
" ActiveScreenItem " is used in Runtime in order to address the properties of the
object currently in focus.

Example
The following example displays the name of the object in the " ScreenWindow1 "
picture which has the focus:
'VBS69
Dim objScreen
Set objScreen = HMIRuntime.Screens( " ScreenWindow1 " )
MsgBox objScreen.ActiveScreenItem.ObjectName

13.3.1.7 Actualize Property

Description
The " Index " property references a column pair or a trend. " Actualize " defines
whether a static or dynamic representation should be used for this column
pair/trend.


0: Static display



-1: Dynamic display

13.3.1.8 ActualPointLeft Property

Printout of the Online Help
Creating Procedures and Actions with VBS

169

VBS Reference

11.05

Description
Defines or returns the x-coordinate of the current corner point in relation to the
original picture (top left). Each corner point is identified by an index which is
derived from the number ( " PointCount " ) of corner point available.
A change of the value can affect the properties " Width " (object width) and " Left " (xcoordinate of the object position).

13.3.1.9 ActualPointTop Property

Description
Defines or returns the y-coordinate of the current corner point in relation to the
original picture (top left). Each corner point is identified by an index which is
derived from the number ( " PointCount " ) of corner point available.
A change of the value can affect the properties " Height " (object height) and " Top "
(y-coordinate of the position).

13.3.1.10 AdaptBorder Property

Description
TRUE, when the border should be dynamically adjusted to the size of the text.
BOOLEAN write-read access.
For text list and I/O field: Read only access.

13.3.1.11 AdaptPicture Property

Description
Defines whether the picture displayed in a picture window should be adapted to the
size of the picture window in runtime or not. Read only access.
TRUE, when the picture adapts to the picture window size.
FALSE, when the picture does not adapt to the picture window size.

13.3.1.12 AdaptSize Property

170

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Defines whether the picture window should adapt to the size of the picture
displayed in it during runtime or not. Read only access.
TRUE, when the picture window adapts to the picture size.
FALSE, when the picture window does not adapt to the picture size.

13.3.1.13 AdjustRuler Property

Description
Specifies if the ruler window should be adjusted to the trend window upon each
appearance.
TRUE, if you move the ruler window and make it appear and disappear again, it
will be displayed in its original position and its original size.

13.3.1.14 AlarmHigh Property

Description
Defines the top limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the
" TypeAlarmHigh " property.
The " CheckAlarmHigh " property defines whether the monitoring function for the
limit value is activated.

13.3.1.15 AlarmLogs Property

Description
Returns an object of type " AlarmLogs " .
AlarmLogs (read-only)

13.3.1.16 AlarmLow Property

Printout of the Online Help
Creating Procedures and Actions with VBS

171

VBS Reference

11.05

Description
Defines the bottom limit value at which an alarm should be triggered or returned.
The type of the evaluation (in percent or absolute) is defined in the
" TypeAlarmLow " property.
The " CheckAlarmLow " property defines whether the monitoring function for the
limit value is activated.

13.3.1.17 Alignment Property

Description
Defines or returns the representation of the scale (left/right or top/bottom)
according to the position of the bar graph object. The " Scaling " property must be
set to TRUE for the scale to be displayed.

13.3.1.18 AlignmentLeft Property

Description
Defines or returns the horizontal alignment of the text. Value range from 0 to 2.
0 = left
1 = centered
2 = right

13.3.1.19 AlignmentTop Property

Description
Defines or returns the vertical alignment of the text. Value range from 0 to 2.
0 = top
1 = centered
2 = bottom

172

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.1.20 AllowPersistence Property

Description
TRUE, when settings regarding persistence are possible. BOOLEAN write-read
access.

13.3.1.21 AllServer Property

Description
Defines that the data to be displayed in the message window is required by all
servers participating in a distributed system on which Alarm Logging is activated.
Write/Read access.

13.3.1.22 Analog Property

Description
TRUE, when the clock is to be displayed as an analog clock. BOOLEAN write-read
access.

13.3.1.23 AngleAlpha Property

Description
Defines or returns depth angle a for the 3D-effect of the " 3DBarGraph " object.
Value range in degrees from 0 to 90.

13.3.1.24 AngleBeta Property

Description
Defines or returns depth angle b for the 3D-effect of the " 3DBarGraph " object.
Value range in degrees from 0 to 90.

Printout of the Online Help
Creating Procedures and Actions with VBS

173

VBS Reference

11.05

13.3.1.25 AngleMax Property

Description
Defines or returns the angle on the scale at which the scale graduation ends.
LONG write-read access.
The start and end of the scale graduation are described by the attributes
" AngleMin " and " AngleMax " in angular degrees. AngleMin & lt; AngleMax applies.
Angle 0 degrees is at the right side of the horizontal diameter of the graduated
scale disk. Positive angle values are counted in a counterclockwise direction.

13.3.1.26 AngleMin Property

Description
Defines or returns the angle on the scale at which the scale graduation begins.
LONG write-read access.

13.3.1.27 Application Property

Description
Returns the Graphics Designer application when the application property is used
without an object identifier. If the application property is used with object identifier,
it returns an application object which displays the application with which the
defined object was created. Read only access.

13.3.1.28 Archive Property

Description
The " Index " property references a pair of columns. " Archive " defines process
archive values linked to the column pair. The name of the process value archive is
specified in the following form: Server name::Archive name

174

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.1.29 Assignments Property

Description
A list which contains the assignments between the output values and the actual
output texts to be output.
The assignments are dependent on the list type set. The list type is defined with
the ListType property.
Read only access.

13.3.1.30 AssumeOnExit Property

Description
TRUE, if the entered text is assumed upon exiting the entry field (e.g., with the
& lt; Tab & gt; key or mouse click). BOOLEAN write-read access.

13.3.1.31 AssumeOnFull Property

Description
TRUE, when the content of the input field is full (specified number of characters
have been entered) and should be exited automatically and the input accepted.
BOOLEAN write-read access.

13.3.1.32 Autorange Property

Description
TRUE, when the value range of the Y-axis is determined automatically or defined
by using the " BeginValue " and " EndValue " attributes. BOOLEAN write-read
access.

13.3.1.33 AutorangeX Property

Printout of the Online Help
Creating Procedures and Actions with VBS

175

VBS Reference

11.05

Description
TRUE, when the value range of the X-axis is determined automatically. FALSE,
when it is determined by means of the " BeginX " and " EndX " attributes. BOOLEAN
write-read access.

13.3.1.34 AutorangeY Property

Description
TRUE, when the value range of the Y-axis is determined automatically. FALSE,
when it is determined by means of the " BeginY " and " EndY " attributes. BOOLEAN
write-read access.

13.3.1.35 AutoScroll Property

Description
Defines the behavior of the message window when a new message is received.
BOOLEAN write-read access.
TRUE: A newly received message is appended to the list displayed in the message
window and is automatically selected. The visible area of the message window is
moved, if necessary.
FALSE: A newly received message is not selected. The visible area of the
message window is not changed.
The targeted selection of messages is only possible when " AutoScroll " is not
active.
The " AutoScroll " property is deactivated when the attribute " MsgCtrlFlag " = " -1 " is
set. This means that the current message in the message window appears at the
top.

13.3.1.36 AutoSize Property

176

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Defines or returns the size adaptation of the object. The following values can be
set:


0: No size adaptation.



1: The picture ( " PictureSelected " , " PictureUnselected " properties) is adapted to
the button.



2: The button is adapted to the picture ( " PictureSelected " , " PictureUnselected "
properties).

13.3.1.37 Average Property

Description
TRUE, when the average value from the last 15 values should be calculated.
BOOLEAN write-read access.

13.3.1.38 Axe Property

Description
Defines or returns the position of the 3D bar in the coordinate system. Value range
from 0 to 2.
0: The 3D-bar is displayed on the X-axis.
1: The 3D-bar is displayed on the Y-axis.
2: The 3D-bar is displayed on the Z-axis.

13.3.1.39 AxisSection Property

Description
Defines or returns the distance between two long axis sections. The information on
the distance is given in scale units and is dependent on the minimum and
maximum values configured.

Printout of the Online Help
Creating Procedures and Actions with VBS

177

VBS Reference

11.05

13.3.2 B
13.3.2.1 BackBorderWidth Property

Description
Defines or returns the width of the 3D border in pixels. The value for the width is
dependent on the size of the object.

13.3.2.2 BackColor Property

Function
Defines or returns the background color for the object.
The background color is not displayed if " transparent " is defined as the fill pattern.
LONG (write-read access)
Special features of the WinCC slider control
The background color only takes effect when the object is at least partially filled.
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Enter the appropriate
decimal value for each of the three RGB values.
Example:
RGB(200, 150, 100)

Example
The following example defines the background of the " ScreenWindow1 " picture to
red:
'VBS70
Dim objScreen
Set objScreen = HMIRuntime.Screens( " ScreenWindow1 " )
objScreen.BackColor = RGB(255, 0, 0)

178

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.2.3 BackColor2 Property

Description
Defines or returns the bar color for the display of the current value. LONG writeread access.

13.3.2.4 BackColor3 Property

Description
Defines or returns the color of the bar background. LONG write-read access.

13.3.2.5 BackColorBottom Property

Description
Defines or returns the color for the bottom/right part of the slider. LONG write-read
access.

13.3.2.6 BackColorTop Property

Description
Defines or returns the color for the top/left part of the slider. LONG write-read
access.

13.3.2.7 BackFlashColorOff Property

Description
Defines or returns the color of the object background for the flash status " Off " .
LONG write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

179

VBS Reference

11.05

13.3.2.8 BackFlashColorOn Property

Description
Defines or returns the color of the object background for the flash status " On " .
LONG write-read access.

13.3.2.9 Background Property

Description
TRUE, when the background of the 3D-bar graph object should be visible.
BOOLEAN write-read access.

13.3.2.10 BackgroundPicture Property

Description
Returns the picture name of the background picture for the graduated scale disk.
Read only access

13.3.2.11 BackStyle Property

Description
WinCC Digital/Analog Clock
Defines the type of background of the analog clock:



1: The round numbered face of the clock is filled by the specified background
color. This enables a round analog clock to be displayed.



180

0: The rectangular background of the clock is filled by the specified background
color.

2: Numbered face and rectangular background are transparent.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

WinCC Gauge Control
Defines the type of background of the gauge:


0: The rectangular or square background of the gauge has a border color is
filled with the specified color. The circular graduated scale disk is filled by the
specified background color.



1: The rectangular or square background of the gauge is transparent. The
circular graduated scale disk is filled by the specified background color. This
enables a circular gauge to be displayed.



2: The rectangular or square background and graduated scale disk are
transparent.

WinCC Slider Control
Defines whether the object background should be transparent.


0: The object background is not transparent



1: The object background is transparent

HMI Symbol Library 1.3
Defines the icon background transparency. Write/Read access.


0: The background is transparent and, thus, invisible.



1: The background is visible, the color of the background is defined by the
" Background Color " attribute.

13.3.2.12 BarBackColor Property

Description
Defines the background color in the area of the slider. The area stretches form
" RangeMin " to " RangeMax " .

13.3.2.13 BarDepth Property

Description
Defines or returns the depth of the bar in pixels.

13.3.2.14 BarFillColor Property

Printout of the Online Help
Creating Procedures and Actions with VBS

181

VBS Reference

11.05

Description
Defines the fill color in the area of the slider. The area stretches from " RangeMin "
to the position of the slider.

13.3.2.15 BarHeight Property

Description
Defines or returns the height of the bar in pixels.

13.3.2.16 BarWidth Property

Description
Defines or returns the width of the bar in pixels.

13.3.2.17 BasePicReferenced Property

Description
TRUE, when the picture assigned in the object status display should be saved.
Otherwise, only the associated object reference is saved. Read only access.

13.3.2.18 BasePicTransColor Property

Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be
set to " transparent " . LONG write-read access.
The color is then only set to " transparent " when the " BasePicUseTransColor "
property has the value TRUE.

13.3.2.19 BasePicture Property

182

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Returns the basic picture for the object status display. Read only access.
The picture (*.BMP or *.DIB) must be located in the " GraCS " directory of the
current project so that it can be integrated.
In this context, the " BasePicReferenced " property defines whether the basic
picture should be saved together with the object status display or referenced.

13.3.2.20 BasePicUseTransColor Property

Description
TRUE, when the configured color ( " BasePicTransColor " property) of the bitmap
objects should be set to " transparent " . BOOLEAN write-read access.

13.3.2.21 BaseScreenName Property

Function
Defines or returns the current basic picture.
STRING (write-read access)
A picture change is executed using the
HMIRuntime.BaseScreenName = ( & lt; Serverpräfix & gt; ::) & lt; Neues Grundbild & gt;
command.
When reading out the " BaseScreenName " property, only the picture name without
server prefix is returned.
Note:
Always enter picture names without the extension " PDL " for reasons of
compatibility with future versions.
Example
The following example executes a picture change to " bild1.pdl " :
HMIRuntime.BaseScreenName = " bild1 "

13.3.2.22 BaseY Property

Printout of the Online Help
Creating Procedures and Actions with VBS

183

VBS Reference

11.05

Description
Defines or returns the vertical distance of the bottom bar edge to the top edge of
the objet field.

13.3.2.23 BaseX Property

Description
Defines or returns the horizontal distance of the right bar edge to the left edge of
the object field in pixels.

13.3.2.24 BeginTime Property

Description
WinCC Online Table Control
The " Index " property references a pair of columns. " BeginTime " defines the start
time for displaying this column pair. Write/Read access.
WinCC Online Trend Control
The " Index " property references a trend. " BeginTime " defines the start time for
displaying this trend. Whether the information is evaluated is dependent on the
TimeRange " and " CommonX " properties.

13.3.2.25 BeginValue Property

Description
The " Index " property references a trend. " BeginValue " defines the lower limit of the
value range to be displayed for the trend. Whether the information is evaluated is
dependent on the " Autorange " and " CommonY " properties.

184

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.2.26 BeginX Property

Description
Defines or returns the lower limit of the X-axis of a trend referenced with the
" Index " property. Whether the information is evaluated is dependent on the
" AutorangeX " and " CommonX " properties.

13.3.2.27 BeginY Property

Description
Defines or returns the lower limit of the Y-axis of a trend referenced with the
" Index " property. Whether the information is evaluated is dependent on the
" AutorangeY " and " CommonY " properties.

13.3.2.28 BevelColorDown Property

Description
Defines the color of the following border sections in the case of 3D representation
of the borders:


with depressed bevel ( " BevelStyle " = 1): top and left bevel section



with raised bevel ( " BevelStyle " = 2): bottom and right bevel section

13.3.2.29 BevelColorUp Property

Description
Defines the color of the following border sections in the case of 3D representation
of the borders:


with depressed bevel ( " BevelStyle " = 1): bottom and right bevel section



with raised bevel ( " BevelStyle " = 2): top and left bevel section

Printout of the Online Help
Creating Procedures and Actions with VBS

185

VBS Reference

11.05

13.3.2.30 BevelInner Property

Description
Defines or returns the appearance of the inner part of the object bevel. Write/Read
access.


0: inner part not available



1: " depressed " appearance



2: " raised " appearance



3: uniform gray border



4 or higher: uniformly colored order, border color = background color

13.3.2.31 BevelOuter Property

Description
Defines or returns the appearance of the outer part of the object bevel. Write/Read
access.


0: inner part not available



1: " depressed " appearance



2: " raised " appearance



3: uniform gray border



4 or higher: uniformly colored order, border color = background color

13.3.2.32 BevelWidth Property

Description
Defines or returns the border width for the inner part of the border (inner bevel) and
for the outer border part (outer bevel) in pixels. Write/Read access.

13.3.2.33 BitNumber Property

186

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Defines or returns the bit whose status must change in order to trigger a change of
value. The tag used must be of the type BYTE, WORD or DWORD.

13.3.2.34 BlinkColor Property

Description
Defines the color of the icon in the flash picture. LONG write-read access.

13.3.2.35 BlinkMode Property

Description
Defines the appearance of the icon surface of the flash picture.


0: Flashing is switched off.



1: The flash picture is invisible.



2: The flash picture is assigned a colored, shaded surface. The color of the
surface corresponds to the setting of the " BlinkColor " property.



Solid - 3 (3): The flash picture is assigned a colored, unshaded surface. The
color of the surface corresponds to the setting of the " BlinkColor " property.

13.3.2.36 BlinkSpeed Property

Description
Defines the length of the flashing interval.


Fast - 250: The length of the flashing interval is 250 ms.



Medium - 500: The length of the flashing interval is 500 ms.



Slow - 1000: The length of the flashing interval is 1000 ms.

The default value is Medium - 500.

13.3.2.37 BorderBackColor Property

Printout of the Online Help
Creating Procedures and Actions with VBS

187

VBS Reference

11.05

Description
Defines or returns the background color of the line for the object. LONG write-read
access. The background color is only visible with the property setting
" BorderWidth " & gt; 0.

13.3.2.38 BorderColor Property

Description
Defines or returns the line color for the object. LONG write-read access.

13.3.2.39 BorderColorBottom Property

Description
Defines or returns the border color for the bottom/right part of the object. LONG
write-read access.

13.3.2.40 BorderColorTop Property

Description
Defines or returns the border color for the top/left part of the object. LONG writeread access.

13.3.2.41 BorderEndStyle Property

Description
Defines or returns the line end style of the object. LONG write-read access.

13.3.2.42 BorderFlashColorOff Property

188

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Defines or returns the color of the object lines for the flashing status " Off " . LONG
write-read access.

13.3.2.43 BorderFlashColorOn Property

Description
Defines or returns the color of the object lines for the flashing status " On " . LONG
write-read access.

13.3.2.44 BorderStyle Property

Description
Defines or returns the line style for the object. Value range from 0 to 4.
0 = solid line
1 = dashed line
2 = dotted line
3 = dash-dotted line
4 = dash-dot-dot line

13.3.2.45 BorderWidth Property

Description
Defines or returns the line weight (in pixels) for the object.
WinCC Gauge Control:
Defines or returns the width of the middle border part in pixels.
The object border is composed of three parts. The middle part of the object border
is described by the " BorderWidth " property.
The color of the middle border part is in the background color.

13.3.2.46 BottomConnectedConnectionPointIndex Property

Printout of the Online Help
Creating Procedures and Actions with VBS

189

VBS Reference

11.05

Description
Specifies or sets the index number of the bottom connecting point.
LONG write-read access.

13.3.2.47 BottomConnectedObjectName Property

Description
Specifies or sets the object name of the object which is docked on at the bottom
connecting point.
LONG write-read access.

13.3.2.48 BoxAlignment Property

Description
TRUE, when the fields are arranged aligned to the right. BOOLEAN write-read
access.

13.3.2.49 BoxCount Property

Description
Defines or returns the number of fields. Value range from 0 to 31.

190

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.2.50 BoxType Property

Description
Defines or returns the field type. Value range from 0 to 2.


0: Output



1: Input



2: I/O field

13.3.2.51 ButtonColor Property

Description
Defines or returns the color of the slider. LONG write-read access.

13.3.2.52 ButtonCommand Property

Description
On changing the value of ButtonCommand, a message is issued to the WinCC
Alarm Control in order to influence the display in the message window.
Value (hex); Value (dec); Called function:


0x00000001; 1; Message List



0x00000002; 2; Short-term archive list



0x00000004; 4; Long-term archive list



0x00200000; 2097152; Lock List



0x00000008; 8; Acknowledge Central Signaling Device



0x00000010; 16; Single acknowledgment



0x00000020; 32; Group acknowledgment



0x00000040; 64; AutoScroll



0x00000080; 128; Selection Dialog



0x00000100; 256; Lock Dialog



0x00000200; 512; Print Message Report



0x00000800; 2048; Emergency Acknowledgment

Printout of the Online Help
Creating Procedures and Actions with VBS

191

VBS Reference

11.05



0x00001000; 4096; First Message



0x00002000; 8192; Last Message



0x00004000; 16384; Next message



0x00008000; 32768; Previous message



0x00010000; 65536; Info text Dialog



0x00020000; 131072; Comments Dialog



0x00040000; 262144; Loop in Alarm



0x00100000; 1048576; Print current view



0x00400000; 4194304; Lock/Release message



0x00800000; 8388608; Sort Dialog



0x01000000; 16777216; Time Base Dialog



0x02000000; 33554432; Hit List

13.3.2.53 Button1Width Property

Description
Defines or returns the width of the Button 1 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the
same width.

13.3.2.54 Button2Width Property

Description
Defines or returns the width of the Button 2 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the
same width.

13.3.2.55 Button3Width Property

Description
Defines or returns the width of the Button 3 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the
same width.

192

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.2.56 Button4Width Property

Description
Defines or returns the width of the Button 4 in pixels.
When the SameSize property is set to TRUE, all the buttons are specified the
same width.

13.3.3 C
13.3.3.1 Caption Property

Description
Application and picture windows
TRUE, when the application or picture window has a title bar in runtime. Read only
access.
The Caption property must be set to TRUE when the application or picture window
should have Maximize and Close buttons.
Controls
Defines or returns the text to be displayed on the label on the button or in the title
bar (Online Trend Control and Online Table Control). Write/Read access.

13.3.3.2 CaptionColor Property

Description
Defines or returns the color of the element labeling. LONG write-read access.

13.3.3.3 CaptionFont Property

Description
Returns the values for font, font style and font size as well as the " Underline " and
" Strikethrough " effects for the element labeling. Read only access.

Printout of the Online Help
Creating Procedures and Actions with VBS

193

VBS Reference

11.05

13.3.3.4 CaptionOffset Property

Description
Defines or returns the distance of the element labeling in relation to the top edge of
the object. The element labeling can only be positioned along the vertical diameter
of the graduated scale disk. The value of the attribute is related to the height of the
object and is measured from the top edge of the object to the base of the text.
Write/Read access.
The value range is 0 is 1:
0: The base of the text is at the top limit of the object. The text is no longer visible
because it is outside the object.
1: The base of the text is at the bottom limit of the object.

13.3.3.5 CaptionText Property

Description
Defines or returns the window title which is displayed in runtime.
The Caption property must be set to TRUE.

13.3.3.6 CellCut Property

Description
TRUE, when the content of the cells in a message line should be cut if the column
width is too small. BOOLEAN write-read access.

13.3.3.7 CenterColor Property

Description
Defines or returns the color of the circular center of the scale (cover of the pointer
axis). LONG write-read access.

194

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.3.8 CenterScale Property

Description
Defines or returns the diameter of the circular center of the scale (cover of the
pointer axis) in relation to the smaller value of the geometric width and height
attributes. Write/Read access.
The value range is 0.03 to 1:
1: The diameter corresponds to the smaller value of the " Width " or " Height "
geometric values.

13.3.3.9 CheckAlarmHigh Property

Description
TRUE, when the " AlarmHigh " limit value is to be monitored. BOOLEAN write-read
access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " AlarmHigh " , " ColorAlarmHigh " and " TypeAlarmHigh "
properties.

13.3.3.10 CheckAlarmLow Property

Description
TRUE, when the " AlarmLow " limit value is to be monitored. BOOLEAN write-read
access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " AlarmLow " , " ColorAlarmLow " and " TypeAlarmLow "
properties.

13.3.3.11 CheckLimitHigh4 Property

Description
TRUE, when the " Reserve 4 " upper limit value should be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " LimitHigh4 " , " ColorLimitHigh4 " and " TypeLimitHigh4 "
properties.

Printout of the Online Help
Creating Procedures and Actions with VBS

195

VBS Reference

11.05

13.3.3.12 CheckLimitHigh5 Property

Description
TRUE, when the " Reserve 5 " upper limit value should be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " LimitHigh5 " , " ColorLimitHigh5 " and " TypeLimitHigh5 "
properties.

13.3.3.13 CheckLimitLow4 Property

Description
TRUE, when the " Reserve 4 " lower limit value should be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " LimitLow4 " , " ColorLimitLow4 " and " TypeLimitLow4 "
properties.

13.3.3.14 CheckLimitLow5 Property

Description
TRUE, when the " Reserve 5 " lower limit value should be monitored. BOOLEAN
write-read access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " LimitLow5 " , " ColorLimitLow5 " and " TypeLimitLow5 "
properties.

13.3.3.15 CheckToleranceHigh Property

Description
TRUE, when the " ToleranceHigh " limit value is to be monitored. BOOLEAN writeread access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " ToleranceHigh " , " ColorToleranceHigh " and
" TypeToleranceHigh " properties.

196

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.3.16 CheckToleranceLow Property

Description
TRUE, when the " ToleranceLow " limit value is to be monitored. BOOLEAN writeread access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " ToleranceLow " , " ColorToleranceLow " and
" TypeToleranceLow " properties.

13.3.3.17 CheckWarningHigh Property

Description
TRUE, when the " WarningHigh " limit value is to be monitored. BOOLEAN writeread access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " WarningHigh " , " ColorWarningHigh " and
" TypeWarningHigh " properties.

13.3.3.18 CheckWarningLow Property

Description
TRUE, when the " WarningLow " limit value is to be monitored. BOOLEAN writeread access.
The limit value, the display on reaching the limit value and the type of evaluation
are defined by means of the " WarningLow " , " ColorWarningLow " and
" TypeWarningLow " properties.

13.3.3.19 ClearOnError Property

Description
TRUE, when the field entry is automatically deleted in the case of invalid input.
BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

197

VBS Reference

11.05

13.3.3.20 ClearOnNew Property

Description
TRUE, when the field entry is deleted as soon as the I/O field has the focus.
BOOLEAN write-read access.

13.3.3.21 Closeable Property

Description
TRUE, when the window can be closed in runtime. BOOLEAN write-read access.

13.3.3.22 CloseButton Property

Description
TRUE, when the window is provided with a " Close " button. Read only access.

13.3.3.23 CoarseGrid Property

Description
TRUE when the value axis is scaled by long tick marks. The distance between two
long tick marks can be changed using the " CoarseGridValue " property. BOOLEAN
write-read access.

13.3.3.24 CoarseGridX Property

Description
TRUE, when the X-axis graduation is scaled by long tick marks. The distance
between two long tick marks can be changed using the " CoarseGridValueX "
property. BOOLEAN write-read access.

198

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.3.25 CoarseGridY Property

Description
TRUE, when the Y-axis graduation is scaled by long tick marks. The distance
between two long tick marks can be changed using the " CoarseGridValueY "
property. BOOLEAN write-read access.

13.3.3.26 CoarseGridValue Property

Description
Defines the distance between two long tick marks in the scale. Whether the
information is evaluated is dependent on the value of the " CoarseGrid " property.

13.3.3.27 CoarseGridValueX Property

Description
Defines or returns the distance between two long tick marks on the graduation
scale of the X-axis. Whether the information is evaluated is dependent on the value
of the " CoarseGridX " property.

13.3.3.28 CoarseGridValueY Property

Description
Defines or returns the distance between two long tick marks on the graduation
scale of the Y-axis. Whether the information is evaluated is dependent on the value
of the " CoarseGridY " property.

13.3.3.29 CollectValue Property

Printout of the Online Help
Creating Procedures and Actions with VBS

199

VBS Reference

11.05

Description
Contains the respective status of the active message class in runtime as the start
value. LONG write-read access.
The value can be determined from the group display of hierarchically subordinate
pictures by making it dynamic using a tag.

13.3.3.30 ColMove Property

Description
TRUE, when the arrangement of columns can be changed. BOOLEAN write-read
access.

13.3.3.31 Color Property

Description
The " Index " property references a column pair or a trend. " Color " defines the color
of the font in the column or the trend. LONG write-read access. The color is defines
as an RGB value.

13.3.3.32 ColorAlarmHigh Property

Description
Defines or returns the bar color for the " AlarmHigh " limit value. LONG write-read
access.
The " CheckAlarmHigh " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.33 ColorAlarmLow Property

Description

200

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Defines or returns the bar color for the " AlarmLow " limit value. LONG write-read
access.
The " CheckAlarmLow " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.34 ColorBottom Property

Description
Defines or returns the color for the bottom/right stop of the slider object. LONG
write-read access.

13.3.3.35 ColorChangeType Property

Description
TRUE, if the change of color should occur segment by segment in the case of a
color change (e.g. on reaching a limit value). If set to FALSE, it defines the change
of color for the entire bar. BOOLEAN write-read access.

13.3.3.36 ColorLimitHigh4 Property

Description
Defines or returns the color for the " Reserve 4 " upper limit value. LONG write-read
access.
The " CheckLimitHigh4 " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.37 ColorLimitHigh5 Property

Description
Defines or returns the color for the " Reserve 5 " upper limit value. LONG write-read
access.

Printout of the Online Help
Creating Procedures and Actions with VBS

201

VBS Reference

11.05

The " CheckAlarmHigh5 " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.38 ColorLimitLow4 Property

Description
Defines or returns the color for the " Reserve 4 " lower limit value. LONG write-read
access.
The " CheckAlarmLow4 " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.39 ColorLimitLow5 Property

Description
Defines or returns the color for the " Reserve 5 " lower limit value. LONG write-read
access.
The " CheckAlarmLow5 " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.40 ColorToleranceHigh Property

Description
Defines or returns the color for the " ToleranceHigh " upper limit value. LONG writeread access.
The " CheckToleranceHigh " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.41 ColorToleranceLow Property

Description
Defines or returns the color for the " ToleranceLow " lower limit value. LONG writeread access.

202

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

The " CheckToleranceLow " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.42 ColorTop Property

Description
Defines or returns the color for the top/left stop of the slider object. LONG writeread access.

13.3.3.43 ColorWarningHigh Property

Description
Defines or returns the color for the " WarningHigh " upper limit value. LONG writeread access.
The " CheckWarningHigh " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.44 ColorWarningLow Property

Description
Defines or returns the color for the " WarningLow " lower limit value. LONG writeread access.
The " CheckWarningLow " property must have been set to TRUE if the bar color
should change on reaching the limit value.

13.3.3.45 ColTitle Property

Description
TRUE, when the columns in the message window should have a title bar.
BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

203

VBS Reference

11.05

13.3.3.46 Command Property

Description
TRUE, when updating of the values displayed in the control should be forced.

13.3.3.47 ColWidth Property

Description
TRUE, when it should be possible to change the widths of the columns in the
message window. The width of the columns can only be changed, however, when
the " AutoScroll " property is not active. BOOLEAN write-read access.

13.3.3.48 CommonTime Property

Description
TRUE, when a common time column is to be used in the table window. BOOLEAN
write-read access.

13.3.3.49 CommonX Property

Description
TRUE, when the trends in the trend window should be displayed with a common Xaxis. BOOLEAN write-read access.

204

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.3.50 CommonY Property

Description
TRUE, when the trends in the trend window should be displayed with a common Yaxis. BOOLEAN write-read access.

13.3.3.51 ContinousChange Property

Description
Defines the type of transfer of the value defined by the slider ( " Position " property)
in Runtime:


FALSE: The value of the " Position " property is transferred when the mouse
button is released.



TRUE: The value of the " Position " property is transferred immediately following
a change of the slider position.

13.3.3.52 Count Property

Description
Supplies the number of elements in a list.
INTEGER (read-only access).
Example
The example shows how the number of objects in a DataSet list is output.
'VBS165
HMIRuntime.Trace " Count: " & HMIRuntime.DataSet.Count & vbNewLine
The following example adds two tags to the TagSet list and outputs the count
properties as Trace.
'VBS177
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Motor1 "
group.Add " Motor2 "
HMIRuntime.Trace " Count: " & group.Count & vbNewLine

Printout of the Online Help
Creating Procedures and Actions with VBS

205

VBS Reference

11.05

13.3.3.53 CurrentContext Property

Description
In the case of a picture window, the server from which the picture comes and
contains the script is read out.
The " CurrentContext " property can return different results: If, for example, a picture
window displaying a server picture is set in a local basic picture, distinction is made
between two cases:


The " CurrentContext " property is used in an action of the picture window
picture: The result is the return of the symbolic computer name of the server
(Package property) extended by two colons,
e.g. " WinCCProject_MyComputer::.



The " CurrentContext " property is used in an action of the basic picture: The
result is returned in the form of an empty character string.

13.3.3.54 Cursor Property

Description
Controls the appearance of the cursor in runtime when positioned over an icon.


0: The cursor appears as an arrow and does not change when positioned over
the icon.



1: The cursor appears as a 3D arrow accompanied by a green lightening
symbol. In runtime, this indicates that the object concerned can be operated.

13.3.3.55 CursorControl Property

Description
TRUE, when Alpha Cursor mode is activated, the cursor skips to the next field in
the TAB sequence after exiting the field. BOOLEAN write-read access.
To do this, the " CursorMode " property must be set to TRUE.

13.3.3.56 CurveForm Property

206

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
WinCC Function Trend Control
Defines how the measuring points of a trend referenced by the " Index " property
should be connected. Write/Read access.
WinCC Online Trend Control
The " Index " property references a trend. " CurveForm " defines how the measuring
points should be connected.


0x00000012: Representation of the measuring points.



0x00000014: Measuring points are connected linearly.



0x00000011: Measuring points are connected via a step curve.



0x00000021: The area under the linearly connected trend is filled.



0x00000022: The area under the step curve is filled.

13.3.4 D
13.3.4.1
13.3.4.2 DangerColor Property

Description
Defines or returns the color of the danger zone on the scale. LONG write-read
access.

13.3.4.3 Danger Property

Description
Defines or returns the beginning of the " danger zone " . The zone stretches from the
" danger " value to the end of the scale. Write/Read access.

13.3.4.4 DataFormat Property

Printout of the Online Help
Creating Procedures and Actions with VBS

207

VBS Reference

11.05

Description
Returns the data type of the I/O field object. Read only access.
Value range from 0 to 3.
0: Binary
1: Decimal
2: Heximal
3: String

13.3.4.5 DataIndex Property

Description
Returns the current index of the data of the current trend.

13.3.4.6 DataLogs Property

Description
Returns an object of type " DataLogs " .
DataLogs (read-only)

13.3.4.7 DataSet Property

Description
Returns an object of type " DataSet " .
DataSet (read-only)

13.3.4.8 DataX Property

Description

208

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Inserts a single data record and must be set before calling " InsertData " .

13.3.4.9 DataXY Property

Description
Inserts several data records as an array with pairs of values and must be set
before calling " InsertData " .
The data in the array is assumed when " DataX " is of the VT_EMPTY type.
Otherwise, the " InsertData " attribute used the single value pair resulting from
DataX and DataY.

13.3.4.10 DataY Property

Description
Inserts a single data record and must be set before calling " InsertData " .

13.3.4.11 DeleteData Property

Description
Deletes data in the data buffer of the current trend.
TRUE: All trend data is deleted.
FALSE: The value pair at the " DataIndex " position are deleted.

Printout of the Online Help
Creating Procedures and Actions with VBS

209

VBS Reference

11.05

13.3.4.12 Delta Property

Description
Defines or returns the value difference between two main scale graduation marks.
Write/Read access.

13.3.4.13 DesiredCurveColor Property

Description
Defines the color of a setpoint trend which belongs to a trend referenced by the
" Index " property. The color is defines as an RGB value. Whether the information is
evaluated is dependent on the value of the " DesiredCurveVisible " property.

13.3.4.14 DesiredCurveCurveForm Property

Description
Defines the form of representation of a setpoint trend which belongs to a trend
referenced by the " Index " property. Whether the information is evaluated is
dependent on the value of the " DesiredCurveVisible " property.
0x00000011: Measuring points are connected by a solid line via a step curve
0x00000012: Representation of the measuring points
0x00000014: Measuring points are connected linearly with a solid line
0x00000021: The area under the linearly connected trend is filled.
0x00000022: The area under the step curve is filled.
0x00000031: Measuring points are connected by a dashed line via a step curve
0x00000032: Measuring points are connected linearly with a dashed line

13.3.4.15 DesiredCurveSourceNumberOfUAValues Property

Description
Defines the number of value pairs of a setpoint trend which belongs to a trend
referenced by the " Index " property. Whether the information is evaluated is
dependent on the value of the " DesiredCurveVisible " property.

210

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.4.16 DesiredCurveSourceUAArchive Property

Description
Defines the name of the user archive from which the value of a setpoint trend,
which belongs to a trend referenced by " Index " , is read. Whether the information is
evaluated is dependent on the value of the " DesiredCurveVisible " property.

13.3.4.17 DesiredCurveSourceUAArchiveStartID Property

Description
Defines the starting point for the value of a setpoint trend, which belongs to a trend
referenced by " Index " , from which the values should be read from the archive.
Whether the information is evaluated is dependent on the value of the
" DesiredCurveVisible " property.

13.3.4.18 DesiredCurveSourceUAColumnX Property

Description
Defines the column in the user archive from which the X-values of a setpoint trend,
which belongs to a trend referenced by " Index " , should be read. Whether the
information is evaluated is dependent on the value of the " DesiredCurveVisible "
property.

13.3.4.19 DesiredCurveSourceUAColumnY Property

Description
Defines the column in the user archive from which the Y-values of a setpoint trend,
which belongs to a trend referenced by " Index " , should be read. Whether the
information is evaluated is dependent on the value of the " DesiredCurveVisible "
property.

Printout of the Online Help
Creating Procedures and Actions with VBS

211

VBS Reference

11.05

13.3.4.20 DesiredCurveVisible Property

Description
TRUE, a setpoint trend which belongs to a trend referenced by " Index " should be
displayed. BOOLEAN write-read access.

13.3.4.21 Direction Property

Description
Defines or returns the bar direction or the position of the slider object. BOOLEAN
write-read access. Value range from 0 to 3.
0 = top
1 = bottom
2 = left
3 = right

13.3.4.22 DXFFilename Property

Description
Specifies the name of the DXF file to be displayed. The extension " DXF " can be
omitted and is then automatically appended.
If the name is specified with path, the file is also copied in the GraCS directory of
the project directory structure. This ensures that when copying the project, all the
picture files are copied at the time. If the DXF file is entered manually and the
specified path is not available (or still not), a message appears.
An attempt is initially made, in runtime, to open the file from the specified path. If
this is not possible, the file in the project directory is used.
If the name is entered without the path, the file is expected in the GraCS directory
of the project directory.

212

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.5 E
13.3.5.1 Edit Property

Description
Activates Editing mode for a cell as long as the " Editable " property has been set to
TRUE for the corresponding column.

13.3.5.2 Editable Property

Description
The " Index " property references a pair of columns. " Editable " defines whether the
column pair should be editable. BOOLEAN write-read access.

13.3.5.3 EditAtOnce Property

Description
TRUE, if accessing the field with the & lt; Tab & gt; key permits input immediately and
without further action. BOOLEAN write-read access.

13.3.5.4 Enabled Property

Function
Enables or disables possible operation of an object or issues the corresponding
value. TRUE: Enable operation, FALSE: Operation is disabled.
BOOLEAN write-read access.

Example
The following example disables all objects in the picture " NewPDL1 " :
'VBS71
Dim objScreen

Printout of the Online Help
Creating Procedures and Actions with VBS

213

VBS Reference

11.05

Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
objects
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Enabled=False 'Lock object
Next

'Read names of

13.3.5.5 EndAngle Property

Description
Defines or returns the end of the object. The information is in counterclockwise
direction in degrees, beginning at the 12:00 clock position.

13.3.5.6 EndTime Property

Description
Online Table Control
The " Index " attribute references a pair of columns. " EndTime " defines the end time
for displaying this column pair. Whether the information is evaluated is dependent
on the TimeRange " and " CommonTime " properties. Write/Read access.
Online Trend Control
The " Index " attribute references a trend. " EndTime " defines the end time for
displaying this trend. Whether the information is evaluated is dependent on the
" Autorange " , " TimeRange " and " CommonX " properties.

13.3.5.7 EndValue Property

Description
The " Index " property references a trend. " EndValue " defines the upper limit of the
value range to be displayed for the trend. Whether the information is evaluated is
dependent on the " Autorange " and " CommonY " properties.

214

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.5.8 EndX Property

Description
Defines the upper limit of the X-axis of a trend referenced with " Index " . Whether the
information is evaluated is dependent on the " AutorangeX " and " CommonX "
properties.

13.3.5.9 EndY Property

Description
Defines the upper limit of the Y-axis of a trend referenced with " Index " . Whether the
information is evaluated is dependent on the " AutorangeY " and " CommonY "
properties.

13.3.5.10 ErrorDescription Property

Function
Error description of the " LastError " property. The error description is provided in
English only.
STRING (read only)
The following error messages are defined:
Output

Description

" "

OK

" Operation Failed "

Execution error

" Variable not found "

Tag error

" Server down "

Server not available

" An error occurred for one or several tags "

Multi Tag Error (Error in one or
several tags)

In order that ErrorDescription returns a value, a read process must be executed
beforehand.
If an error occurs during read or write of several tags using the TagSet object, the
error is set to " Multi Tag Error " . In order to determine at which tag the error
occurred and what type of error it was, the ErrorDescription property of each tag
must be analyzed.

Printout of the Online Help
Creating Procedures and Actions with VBS

215

VBS Reference

11.05

Example
The following example displays the error description for " Tag1 " :
'VBS72
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objtag.Read
MsgBox objTag.ErrorDescription

The following example adds two tags to the TagSet list and outputs the
ErrorDescription property as Trace.
'VBS179
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Motor1 "
group.Add " Motor2 "
HMIRuntime.Trace " ErrorDescription: " & group.ErrorDescription & vbNewLine
The ErrorDescription property of a tag contained in the list may be accessed as
follows:
HMIRuntime.Trace " ErrorDescription: " & group( " Motor1 " ).ErrorDescription &
vbNewLine

13.3.5.11 Exponent Property

Description
TRUE, when the display of numbers should be with exponents (e.g. " 1.00e+000 " ).
BOOLEAN write-read access.

13.3.5.12 ExtendedOperation Property

Description
TRUE, when the slider regulator is set at the respective end value
(minimum/maximum value). This is done by clicking the mouse in an area outside
the current regulator setting. BOOLEAN write-read access.

216

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.5.13 ExtendedZoomingEnable Property

Description
Activates/deactivates the ExtendedZooming properties of a picture.
Using ExtendedZooming, the view of a process picture in Runtime may be
enlarged or reduced by using the mouse wheel.
BOOLEAN write-read access.

Example
Activates ExtendedZooming for picture NewPDL1.
'VBS155
Dim objScreen
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
objScreen.ExtendedZoomingEnable = 1

13.3.6 F
13.3.6.1 FillColor Property

Description
Defines or returns the fill pattern color for the object.
LONG (write-read access)
Determination of Color Value
The color is displayed in RGB format (Red, Green, Blue). Enter the appropriate
decimal value for each of the three RGB values.
Example:
RGB(200, 150, 100)

Example
The following example defines the fill color for " ScreenWindow1 " to blue:
'VBS73
Dim objScreen
Set objScreen = HMIRuntime.Screens( " ScreenWindow1 " )
objScreen.FillStyle = 131075
objScreen.FillColor = RGB(0, 0, 255)

Printout of the Online Help
Creating Procedures and Actions with VBS

217

VBS Reference

11.05

13.3.6.2 Filling Property

Description
TRUE, when the object can be filled by closed border lines (e.g. representing the
fill level of a tank). BOOLEAN write-read access.
The fill level of the object is set by means of the " FillingIndex " property.

13.3.6.3 FillingIndex Property

Description
Defines the %age value (related to the height of the object) to which the object with
closed border line is to be filled.
The fill level is represented by the current background color. The unfilled
background is transparent.

13.3.6.4 FillStyle Property

Description
Defines or returns the fill style for the object.
LONG (write-read access)
Fill Pattern

Value

Fill Pattern

Value

65536
0

196624

131075

196625

131076

196626

131077

196627

131074

196628

131072

196629

131073

196630

196608

196631

196609

196632

196610

196633

196611

196634

196612

196635

196613

196636

196614

218

196623

196637

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Fill Pattern

Value

Fill Pattern

Value

196615

196638

196616

196639

196617

196640

196618

196641

196619

196642

196620

196643

196621

196644

196622

--

--

Example
The following example sets the fill style for " ScreenWindow1 " to transparent:
Dim myScr
Set myScr = HMIRuntime.Screens( " Bildfenster1 " )
myScr.FillStyle = 65536

13.3.6.5 FillStyle2 Property

Description
Defines or returns the fill style of the bar.

13.3.6.6 FineGrid Property

Description
TRUE, when the value axis is scaled by short tick marks. The distance between
two short tick marks can be changed using the " FineGridValue " property.
BOOLEAN write-read access.

13.3.6.7 FineGridValue Property

Description
Defines the distance between two short tick marks in the scale. Whether the
information is evaluated is dependent on the value of the " FineGrid " property.

Printout of the Online Help
Creating Procedures and Actions with VBS

219

VBS Reference

11.05

13.3.6.8 FineGridValueX Property

Description
Defines the distance between two short tick marks on the X-axes scaling. Whether
the information is evaluated is dependent on the value of the " FineGridX " property.

13.3.6.9 FineGridValueY Property

Description
Defines the distance between two short tick marks on the Y-axes scaling. Whether
the information is evaluated is dependent on the value of the " FineGridX " property.

13.3.6.10 FineGridX Property

Description
TRUE, when the X-axis graduation is scaled by short tick marks. The distance
between two short tick marks can be changed using the " FineGridValueX "
property.

13.3.6.11 FineGridY Property

Description
TRUE, when the Y-axis graduation is scaled by short tick marks. The distance
between two short tick marks can be changed using the " FineGridValueY "
property.

13.3.6.12 FlashBackColor Property

Description
TRUE, when flashing of the background is activated. BOOLEAN write-read access

220

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.6.13 FlashBorderColor Property

Description
TRUE, when flashing of the object lines is activated. BOOLEAN write-read access.

13.3.6.14 FlashFlashPicture Property

Description
TRUE, when flashing of the flash picture is activated. BOOLEAN write-read
access.

13.3.6.15 FlashForeColor Property

Description
TRUE, when flashing of the text is activated. BOOLEAN write-read access.

13.3.6.16 FlashPicReferenced Property

Description
TRUE, when the assigned flash picture should be saved. Otherwise, only the
associated object reference is saved. Read only access.

13.3.6.17 FlashPicTransColor Property

Description
Defines which color of the bitmap object (.bmp, .dib) assigned to the flash picture
should be set to " transparent " . LONG write-read access.
The color is then only set to " transparent " when the " FlashPicUseTransColor "
property has the value TRUE.

Printout of the Online Help
Creating Procedures and Actions with VBS

221

VBS Reference

11.05

13.3.6.18 FlashPicture Property

Description
Returns the flash picture. Read only access.
The picture (*.BMP or *.DIB) must be located in the " GraCS " directory of the
current project so that it can be integrated.
In this context, the " FlashPicReferenced " property defines whether the flash
picture should be saved together with the object status display or referenced.

13.3.6.19 FlashPicUseTransColor Property

Description
TRUE, when the configured color ( " FlashPicTransColor " property) of the bitmap
objects assigned to the flash picture should be set to " transparent " . BOOLEAN
write-read access.

13.3.6.20 FlashRate Property

Description
Defines or returns the flash frequency. Value range from 0 to 2.
0 = slow
1 = medium
2 = fast

13.3.6.21 FlashRateBackColor Property

Description
Defines or returns the flash frequency for the object background. Value range
from 0 to 2.
0 = slow
1 = medium
2 = fast

222

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.6.22 FlashRateBorderColor Property

Description
Defines or returns the flash frequency for the lines of the object. Value range from
0 to 2.
0 = slow
1 = medium
2 = fast

13.3.6.23 FlashRateFlashPic Property

Description
Defines or returns the flash frequency for the flash picture. Value range from 0 to 2.
0 = slow
1 = medium
2 = fast

13.3.6.24 FlashRateForeColor Property

Description
Defines or returns the flash frequency for the object label. Value range from 0 to 2.
0 = slow
1 = medium
2 = fast

Printout of the Online Help
Creating Procedures and Actions with VBS

223

VBS Reference

11.05

13.3.6.25 Flip Property

Description
Mirrors the icon on the vertical and/or horizontal middle axis of the icon.


Zero - 0: The icon is mot mirrored.



Horizontal - 1: The icon is mirrored on the vertical, middle axis.



Vertical - 2: The icon is mirrored on the horizontal, middle axis.



Both - 3: The icon is mirrored both on the horizontal and vertical middle axes.

13.3.6.26 FocusColor Property

Description
If the focus is positioned on the control in runtime, the labeling and position text are
identified by a border. FocusColor defines the color of the border.

13.3.6.27 FocusRect Property

Description
TRUE, when the button should be provided with a selection border, in runtime, as
soon as it receives the focus. BOOLEAN write-read access.

13.3.6.28 FocusWidth Property

Description
If the focus is positioned on the control in runtime, the labeling and position text are
identified by a border. FocusWidth defines the width of the border, value range of
1-10 pixels. LONG write-read access.

224

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.6.29 Font Property

Description
Defines or returns the font. Write/Read access.
The font object has the following sub-properties


Size



Bold (yes/no)



Name (font name)



Italic (yes/no)



Underline (yes/no)



StrikeThrough (yes/no)

If two font properties are directly assigned, only the default property " Name " is
assumed.

Example
'VBS74
Dim objControl1
Dim objControl2
Set objControl1 = ScreenItems( " Control1 " )
Set objControl2 = ScreenItems( " Control2 " )
objControl2.Font = objControl1.Font ' take over only the type of font

13.3.6.30 FontBold Property

Description
TRUE, when the text in the object should be assigned the " bold " attribute.
BOOLEAN write-read access.

13.3.6.31 FontItalic Property

Description
TRUE, when the text in the object should be assigned the " italic " attribute.
BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

225

VBS Reference

11.05

13.3.6.32 FontName Property

Description
Defines or returns the font name of the text in the object.
All the fonts installed in Windows are available for selection.

13.3.6.33 FontPosition Property

Description
Returns the font name for the display of the slider position in the bottom part of the
object. All the fonts installed in Windows are available for selection. Read only
access.

13.3.6.34 FontSize Property

Description
Defines or returns the font size of the text in the object in points.

13.3.6.35 FontStrikeThru Property

Description
TRUE, when the text in the object should be assigned the " strikethrough " attribute.
BOOLEAN write-read access.

13.3.6.36 FontUnderline Property

Description
TRUE, when the text in the object should be assigned the " underline " attribute.
BOOLEAN write-read access.

226

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.6.37 ForeColor Property

Description
Defines or returns the color of the font for the text in the object. LONG write-read
access.

13.3.6.38 ForeFlashColorOff Property

Description
Defines or returns the color of the text for flash status " Off " . LONG write-read
access.

13.3.6.39 ForeFlashColorOn Property

Description
Defines or returns the color of the text for flash status " On " . LONG write-read
access.

13.3.6.40 FrameColor Property

Description
Defines or returns the color of the rectangular or square area located on the
graduated scale disk. LONG write-read access.

13.3.6.41 FrameColorDown Property

Description
Defines or returns the color for the right, bottom part of the 3D frame of the button
(button pressed). LONG write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

227

VBS Reference

11.05

13.3.6.42 FrameColorUp Property

Description
Defines or returns the color for the left, top part of the 3D frame of the button
(button not pressed). LONG write-read access.

13.3.6.43 FramePicture Property

Description
Returns the picture name of the background picture for the graduated scale disk.
Read only access.

13.3.6.44 FrameScale Property

Description
Defines or returns the diameter of the graduated scale disk in relation to smallest
value of the width and height geometric attributes. Write/Read access.
The value range is (scale distance - scale width) to 1.

13.3.6.45 FrameWidth Property

Description
Defines or returns the frame width of the button in pixels. Write/Read access.

228

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.6.46 FreezeProviderConnections Property

Description
Enables modification of the data connection properties ( " ProviderType " ,
" Source " ...), without the changes taking immediate effect. On changing
" SourceTagNameX " , for example, impermissible combinations can created with
" SourceTagNameY " .
Therefore, FreezeProviderConnections " must be set to TRUE before modifying a
data connection attribute. After modifying all the data connection,
" FreezeProviderConnection " is set to FALSE and the changes take effect.

13.3.7 G
13.3.7.1 GraphDirection Property

Description
Defines which edge of the trend window should display the current values.
Write/Read access.
0: Positive values run to the right and upwards.
-1: Positive values run to the left and upwards.
-2: Positive values run to the right and upwards.
-3: Positive values run to the right and downwards.

13.3.7.2 GridLineHorz Property

Description
TRUE, when the message window columns are separated by horizontal separating
lines. BOOLEAN write-read access.

13.3.7.3 GridLines Property

Printout of the Online Help
Creating Procedures and Actions with VBS

229

VBS Reference

11.05

Description
TRUE, when the trend window is displayed with grid lines parallel to the X-axis.
The distance between two grid lines can be changed using the " GridLineValue "
property. BOOLEAN write-read access.

13.3.7.4 GridLineValue Property

Description
Defines the distance between two grid lines. Whether the information is evaluated
is dependent on the value of the " GridLines " property.

13.3.7.5 GridlinesValueX Property

Description
Defines or returns the distance between two grid lines on the X-axis. Whether the
information is evaluated is dependent on the value of the " GridLinesX " property.

13.3.7.6 GridlinesValueY Property

Description
Defines or returns the distance between two grid lines on the Y-axis. Whether the
information is evaluated is dependent on the value of the " GridLinesY " property.

13.3.7.7 GridLineVert Property

Description
TRUE, when the message window columns are separated by vertical separating
lines. BOOLEAN write-read access.

13.3.7.8 GridlinesX Property

230

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
TRUE, when the trend window is displayed with grid lines parallel to the X-axis.
The distance between two grid lines can be changed using the " GridLineValueX "
property.

13.3.7.9 GridlinesY Property

Description
TRUE, when the trend window is displayed with grid lines parallel to the Y-axis.
The distance between two grid lines can be changed using the " GridLineValueX "
property.

13.3.8 H
13.3.8.1 HandFillColor Property

Description
Defines or returns the fill color of all the hands in the analog clock. In order that the
hands are displayed with the fill color defined, the " Handtype " property must be set
to " 0 " (covering). LONG write-read access.

13.3.8.2 Handtype Property

Description
Defines the representation of the hands:


0: The hands are filled in the hand color defined and the edges in the
foreground color.



1: The hands fill color is transparent and the edges displayed in the foreground
color.

13.3.8.3 HeaderSort Property

Printout of the Online Help
Creating Procedures and Actions with VBS

231

VBS Reference

11.05

Description
Specifies if sorting of messages by message block column header is possible.

13.3.8.4 Height Property

Description
Defines or returns the height of the object in pixels.
LONG (write-read access)
Example
The following example halves the height of all objects in the " NewPDL1 " picture
whose names begin with " Circle " :
'VBS75
Dim objScreen
Dim objCircle
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'Searching all circles
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
If " Circle " = Left(strName, 6) Then
'
'to halve the height of the circles
Set objCircle = objScreen.ScreenItems(strName)
objCircle.Height = objCircle.Height / 2
End If
Next

13.3.8.5 HiddenInput Property

Description
TRUE, when the input value should not be displayed when being entered. Each
character entered is substituted by a *. BOOLEAN write-read access.

13.3.8.6 Hotkey Property

232

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Returns the function key related to the mouse operation in respect of a button
object.
Read only access.

13.3.8.7 HourNeedleHeight Property

Description
Defines or returns the length of the hour hand for the analog clock. The
specification of the length is entered as a percentage value in relation to half the
length of the short side of the rectangular background. Write/Read access.
Example:
The short side of the rectangular background is 100 pixels long.
The hour hand length is specified as 50.
Therefore, the length of the hour hand is (100 pixel / 2) * 0.5 = 25 Pixel.

13.3.8.8 HourNeedleWidth Property

Description
Defines or returns the width of the hour hand for the analog clock. The width is
specified as a percentage value related to double the length of the hour hand.
Write/Read access.
Example:
The length of the hour hand is 25 pixels.
The hour hand width is specified as 10.
Therefore, the width of the hour hand is 25 pixel * 2 * 0.1 = 5 Pixel.

13.3.8.9 Hysteresis Property

Description
TRUE, when the display should appear with hysteresis. BOOLEAN write-read
access.

13.3.8.10 HysteresisRange Property

Printout of the Online Help
Creating Procedures and Actions with VBS

233

VBS Reference

11.05

Description
Defines or returns the hysteresis in a %age of the display value.
The Hysteresis property must be set to TRUE for the hysteresis to be calculated.

13.3.9 I
13.3.9.1 Index Property

Description
Check Box, Radio Box
Defines or returns the number (0 to 31) of the field whose text is to be defined.
Polygon, Polyline
Defines or returns the number of the corner point whose position coordinates are to
be modified or displayed.
WinCC Online Trend Control, WinCC Online Table Control, WinCC Function
Trend Control
The " Index " property is evaluated by other properties in order to be able to assign
the settings to a specific trend or column pair. The valid values for the index move
within the range from 0 to (NumItems - 1). The " NumItems " properties contains the
number of the trends/column pairs to be displayed.
Status Display
Defines or returns the status (0 to 255). A basic picture and flash picture can be
defined for each status value.

13.3.9.2 InnerBevelOffset Property

Description
Defines the distance between the inner and outer bevels.

13.3.9.3 InnerBevelStyle Property

234

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Defines the 3D effect for the inner bevel of the object.


0: No border.



1: The border is displayed depressed.



2: The border is displayed raised.



3: The border is displayed in one color without a 3D effect. The border color is
defined by the " BevelColorDown " property.

13.3.9.4 InnerBevelWidth Property

Description
Defines the width of the inner bevel in pixels.

13.3.9.5 InsertData Property

Description
Inserts data for the current trend.
TRUE: " DataIndex " is ignored and the data is appended to that in the data buffer.
FALSE: The data is inserted at the " DataIndex " position in the data buffer.
The trend window is redrawn following each operation involving " Insert Data " .

13.3.9.6 ItemBorderBackColor Property

Description
Defines or returns the background color for separation lines in the selection list of
the text list object. LONG write-read access. The background color is only visible
with the property setting ItemBorderStyle & gt; 0.

13.3.9.7 ItemBorderColor Property

Printout of the Online Help
Creating Procedures and Actions with VBS

235

VBS Reference

11.05

Description
Defines or returns the color for separation lines in the selection list of the text list
object. LONG write-read access.

13.3.9.8 ItemBorderStyle Property

Description
Defines or returns the color for the separation line style in the selection list of the
text list object. Value range from 0 to 4.
0 = solid line
1 = dashed line
2 = dotted line
3 = dash-dotted line
4 = dash-dot-dot line

13.3.9.9 ItemBorderWidth Property

Description
Defines or returns the dividing line weight in pixels in the selection list of the text list
object.

13.3.9.10 ItemVisible Property

Description
TRUE, when a trend or a column pair reference by the " Index " property is visible.
BOOLEAN write-read access.

236

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10 L
13.3.10.1 Label Property

Description
The " Index " property references a trend. Label is used to define the name of the
time axis or value axis in accordance with the value of the " TimeAxis " property.

13.3.10.2 LabelColor Property

Description
Defines the color of the scale label.

13.3.10.3 LabelX Property

Description
Defines or returns the label on the X-axis for a trend referenced by " Index "
according to the value of " TimeAxisX " . Write/Read access.

13.3.10.4 LabelY Property

Description
Defines or returns the label on the Y-axis for a trend referenced by " Index "
according to the value of " TimeAxisY " . Write/Read access.

13.3.10.5 LanguageSwitch Property

Printout of the Online Help
Creating Procedures and Actions with VBS

237

VBS Reference

11.05

Description
Returns the value which defines where the language dependent assigned texts are
stored. Read only access.
TRUE, when the texts in the Text Library are managed. Translation to other
language occurs in the Text Library.
FALSE, when the texts are managed directly in the object. Translation to other
language can be carried out using EasyLanguage.

13.3.10.6 Language Property

Description
Defines the current runtime language or reads it.
You specify the Runtime language in VBS by using a country code, e.g., 1031 for
German - Default, 1033 for English - USA etc. A summary of all country codes may
be found in the Basics of VBScript under the subject header " Regional Scheme ID
(LCID) Diagram " .
INTEGER (write-read access)

Example
The following example sets the data language to German:
'VBS76
HMIRuntime.Language = 1031

13.3.10.7 LastError Property

Description
Returns an error code regarding the success of the last operation, e.g. information
on a tag write or read process. The " QualityCode " property can provide information
on the quality of the returned value. A description of the error can be called in using
the " ErrorDescription " property.
LONG (read only)
The following error codes are defined:
Code in hexadecimal notation
0x00000000

OK

0x80040001

238

Description
Execution error

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Code in hexadecimal notation

Description

0x80040002

Tag error

0x80040003

Server not available

0x80040004

Multi Tag Error (Error in one or
several tags)

In order that LastError returns a value, a read must be executed beforehand.
If an error occurs during read or write of several tags using the TagSet object, the
error is set to " Multi Tag Error " . In order to determine at which tag the error
occurred and what type of error it was, the LastError property of each tag must be
analyzed.

Example
The following example displays the error code for " Tag1 " :
'VBS77
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Read
MsgBox objTag.LastError
The following example adds two tags to the TagSet list and outputs the LastError
property as Trace.
'VBS178
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Motor1 "
group.Add " Motor2 "
HMIRuntime.Trace " LastError: " & group.LastError & vbNewLine
The LastError property of a tag contained in the list may be accessed as follows:
HMIRuntime.Trace " LastError: " & group( " Motor1 " ).LastError & vbNewLine

Printout of the Online Help
Creating Procedures and Actions with VBS

239

VBS Reference

11.05

13.3.10.8 Layer Property

Description
Returns the layer of the picture in which the object is located. There is a total of 32
layers available, whereby Layer " 0 " is the bottom layer and Layer " 31 " the top
layer.
The configured objects are initially in the background of a layer.
LONG (read only)
Note:
The Layer Property defines the layer in which the object is located. Layer 0 is
displayed as layer “0”. During access using VBS, the layers are counted up from
1. Therefore, layer 1 must be referred to as layers(2).
Example
The following example displays the name and layer of all the objects in the picture
" NewPDL1 " :
'VBS78
Dim objScreen
Dim objScrItem
Dim lngAnswer
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(strName & " is in layer " & objScrItem.Layer,vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

240

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10.9 Layer00Checked Property

Description
TRUE, when the 0 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer00Value and
Layer00Color properties.

13.3.10.10 Layer01Checked Property

Description
TRUE, when the 1 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer01Value and
Layer01Color properties.

13.3.10.11 Layer02Checked Property

Description
TRUE, when the 2 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer02Value and
Layer02Color properties.

13.3.10.12 Layer03Checked Property

Description
TRUE, when the 3 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer03Value and
Layer03Color properties.

13.3.10.13 Layer04Checked Property

Printout of the Online Help
Creating Procedures and Actions with VBS

241

VBS Reference

11.05

Description
TRUE, when the 4 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer04Value and
Layer04Color properties.

13.3.10.14 Layer05Checked Property

Description
TRUE, when the 5 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer05Value and
Layer05Color properties.

13.3.10.15 Layer06Checked Property

Description
TRUE, when the 6 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer06Value and
Layer07Color properties.

13.3.10.16 Layer07Checked Property

Description
TRUE, when the 7 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer07Value and
Layer07Color properties.

13.3.10.17 Layer08Checked Property

242

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
TRUE, when the 8 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer08Value and
Layer08Color properties.

13.3.10.18 Layer09Checked Property

Description
TRUE, when the 9 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer09Value and
Layer09Color properties.

13.3.10.19 Layer10Checked Property

Description
TRUE, when the 10 limit should be monitored. BOOLEAN write-read access.
Limit value and representation are defined with the Layer10Value and
Layer10Color properties.

13.3.10.20 Layer00Color Property

Description
Defines or returns the color for limit 0. LONG write-read access.
When monitoring of the limit value is activated (Layer00Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.21 Layer01Color Property

Printout of the Online Help
Creating Procedures and Actions with VBS

243

VBS Reference

11.05

Description
Defines or returns the color for limit 1. LONG write-read access.
When monitoring of the limit value is activated (Layer01Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.22 Layer02Color Property

Description
Defines or returns the color for limit 2. LONG write-read access.
When monitoring of the limit value is activated (Layer02Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.23 Layer03Color Property

Description
Defines or returns the color for limit 3. LONG write-read access.
When monitoring of the limit value is activated (Layer03Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.24 Layer04Color Property

Description
Defines or returns the color for limit 4. LONG write-read access.
When monitoring of the limit value is activated (Layer04Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.25 Layer05Color Property

244

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Defines or returns the color for limit 5. LONG write-read access.
When monitoring of the limit value is activated (Layer05Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.26 Layer06Color Property

Description
Defines or returns the color for limit 6. LONG write-read access.
When monitoring of the limit value is activated (Layer06Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.27 Layer07Color Property

Description
Defines or returns the color for limit 7. LONG write-read access.
When monitoring of the limit value is activated (Layer07Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.28 Layer08Color Property

Description
Defines or returns the color for limit 8. LONG write-read access.
When monitoring of the limit value is activated (Layer08Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

Printout of the Online Help
Creating Procedures and Actions with VBS

245

VBS Reference

11.05

13.3.10.29 Layer09Color Property

Description
Defines or returns the color for limit 9. LONG write-read access.
When monitoring of the limit value is activated (Layer09Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.30 Layer10Color Property

Description
Defines or returns the color for limit 10. LONG write-read access.
When monitoring of the limit value is activated (Layer10Checked property), the bar
turns to the color defined by this attribute on reaching the limit value.

13.3.10.31 Layer00Value Property

Description
Defines or returns the value for " Limit 0 " .
Monitoring only takes effect when the Layer00Checked property value is set to
TRUE.

13.3.10.32 Layer01Value Property

Description
Defines or returns the value for " Limit 1 " .
Monitoring only takes effect when the Layer01Checked property value is set to
TRUE.

246

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10.33 Layer02Value Property

Description
Defines or returns the value for " Limit 2 " .
Monitoring only takes effect when the Layer02Checked property value is set to
TRUE.

13.3.10.34 Layer03Value Property

Description
Defines or returns the value for " Limit 3 " .
Monitoring only takes effect when the Layer03Checked property value is set to
TRUE.

13.3.10.35 Layer04Value Property

Description
Defines or returns the value for " Limit 4 " .
Monitoring only takes effect when the Layer04Checked property value is set to
TRUE.

13.3.10.36 Layer05Value Property

Description
Defines or returns the value for " Limit 5 " .
Monitoring only takes effect when the Layer05Checked property value is set to
TRUE.

Printout of the Online Help
Creating Procedures and Actions with VBS

247

VBS Reference

11.05

13.3.10.37 Layer06Value Property

Description
Defines or returns the value for " Limit 6 " .
Monitoring only takes effect when the Layer06Checked property value is set to
TRUE.

13.3.10.38 Layer07Value Property

Description
Defines or returns the value for " Limit 7 " .
Monitoring only takes effect when the Layer07Checked property value is set to
TRUE.

13.3.10.39 Layer08Value Property

Description
Defines or returns the value for " Limit 8 " .
Monitoring only takes effect when the Layer08Checked property value is set to
TRUE.

13.3.10.40 Layer09Value Property

Description
Defines or returns the value for " Limit 9 " .
Monitoring only takes effect when the Layer09Checked property value is set to
TRUE.

248

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10.41 Layer10Value Property

Description
Defines or returns the value for " Limit 10 " .
Monitoring only takes effect when the Layer10Checked property value is set to
TRUE.

13.3.10.42 LayerDeclutteringEnable Property

Description
Activates/deactivates the LayerDecluttering properties of a picture.
LayerDecluttering enables fading in and out of layers depending on the set
minimum and maximum zoom.
BOOLEAN write-read access.

Example:
Activates LayerDecluttering for picture NewPDL1.
'VBS156
Dim objScreen
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
objScreen.LayerDeclutteringEnable = 1

13.3.10.43 Layers Property

Description
Returns an object of type " Layers " .
Layers (read-only)

Printout of the Online Help
Creating Procedures and Actions with VBS

249

VBS Reference

11.05

13.3.10.44 Left Property

Description
Defines or returns the X-coordinate of an object (measured from the top left edge
of the picture) in pixels. The X-coordinate relates to the top left corner of the
rectangle enclosing the object.
LONG (write-read access)

Example
The following example shifts all objects in the picture " NewPDL1 " 5 pixels to the
left:
'VBS79
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Left = objScrItem.Left - 5
Next

13.3.10.45 LeftComma Property

Description
Defines or returns the number of digits to the left of the decimal point (0 to 20).

13.3.10.46 LightEffect Property

Description
TRUE, when the light effect should be activated. BOOLEAN write-read access.

250

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10.47 LimitHigh4 Property

Description
Defines or returns the upper limit value for " Reserve 4 " .
The CheckLimitHigh4 property must be set to TRUE in order that the " Reserve 4 "
limit value can be monitored.
The type of the evaluation (in percent or absolute) is defined in the
TypeLimitHigh4 property.

13.3.10.48 LimitHigh5 Property

Description
Defines or returns the upper limit value for " Reserve 5 " .
The CheckLimitHigh5 property must be set to TRUE in order that the " Reserve 5 "
limit value can be monitored.
The type of the evaluation (in percent or absolute) is defined in the
TypeLimitHigh5 property.

13.3.10.49 LimitLow4 Property

Description
Defines or returns the lower limit value for " Reserve 4 " .
The CheckLimitLow4 property must be set to TRUE in order that the " Reserve 4 "
limit value can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow4
property.

13.3.10.50 LimitLow5 Property

Description
Defines or returns the lower limit value for " Reserve 5 " .
The CheckLimitLow5 property must be set to TRUE in order that the " Reserve 5 "
limit value can be monitored.
The type of the evaluation (in percent or absolute) is defined in the TypeLimitLow5
property.

Printout of the Online Help
Creating Procedures and Actions with VBS

251

VBS Reference

11.05

13.3.10.51 LimitMax Property

Description
Defines or returns the upper limit value as an absolute value depending on the
data format.
If the value to be displayed exceeds the upper limit value, it is identified by a
series of *** , indicating it cannot be displayed.

13.3.10.52 LimitMin Property

Description
Defines or returns the lower limit value as an absolute value depending on the data
format.
If the value to be displayed exceeds the upper limit value, it is identified by a
series of *** , indicating it cannot be displayed.

13.3.10.53 LineFont Property

Description
TRUE, when the font size should be automatically adapted to the line height.
BOOLEAN write-read access.

13.3.10.54 LineHeight Property

Description
TRUE, when the line height can be modified. BOOLEAN write-read access.
The " LineHeight " property is only deactivated if both properties " LineHeight " and
" LineFont " are set to " FALSE " .

252

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10.55 LineTitle Property

Description
TRUE, when the message window a column with consecutive number contains
queued messages. BOOLEAN write-read access.

13.3.10.56 LineWidth Property

Description
Specifies the line width of the trend referenced by " Index " . Value range from 0 to
10.

13.3.10.57 ListType Property

Description
Returns the data type displayed in the case of a text list object. Read only access.
Value range from 0 to 2.
0 = decimal
1 = binary
2 = bit

13.3.10.58 LoadDataImmediately Property

Description
TRUE, when the tag values for the time range to be displayed are loaded from the
archives on opening a picture. BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

253

VBS Reference

11.05

13.3.10.59 LocaleID Property

Description
Defines the language to be displayed in the control, e.g. 1031 for German.
Write/Read access.
The full list of language codes is available in the WinCC documentation (Index & gt;
Language ID).

13.3.10.60 LockBackColor Property

Description
Defines or returns the background color of the button for a locked measuring point.
LONG write-read access.
The LockStatus property must be set to TRUE for the background color to be
displayed.

13.3.10.61 LockStatus Property

Description
TRUE, when a locked measuring point should be displayed. BOOLEAN write-read
access.

13.3.10.62 LockText Property

Description
Defines the label of the button for a locked measuring point.
The LockStatus property must be set to TRUE for the label to be displayed.

254

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10.63 LockTextColor Property

Description
Defines or returns the color of the button label for a locked measuring point. LONG
write-read access.
The LockStatus property must be set to TRUE for the background color to be
displayed.

13.3.10.64 Logging Property

Description
Returns an object of type " Logging " .
Logging (read-only)

13.3.10.65 LongStrokesBold Property

Description
TRUE, when the long sections of a scale should be displayed in bold face.
BOOLEAN write-read access.

13.3.10.66 LongStrokesOnly Property

Description
TRUE, when only the long sections of a scale should be displayed . BOOLEAN
write-read access.

13.3.10.67 LongStrokesSize Property

Description
Defines or returns the length of the axis section in pixels.

Printout of the Online Help
Creating Procedures and Actions with VBS

255

VBS Reference

11.05

13.3.10.68 LongStrokesTextEach Property

Description
Returns the value which defines which sections of the scale displayed should be
labeled (1 = every section, 2 = every second section, etc.). Read only access

13.3.10.69 LowerLimit Property

Description
WinCC Online Trend Control/WinCC Function Trend Control
TRUE, when the " LowerLimitColor " specification is to be used in order to identify
the tag values (from a trend referenced via " Index " ) which lie below the value
defined in " LowerLimitValue " . BOOLEAN write-read access.
WinCC Online Table Control
The value of this attribute cannot be changed. Read only access.

13.3.10.70 LowerLimitColor Property

Description
WinCC Online Trend Control/WinCC Function Trend Control
Defines the color to be used in order to identify the tag values (from trend
referenced via " Index " ) which lie below the value defined in " LowerLimitValue " .
Whether the information is evaluated is dependent on the value of the " LowerLimit "
property. The color is defines as an RGB value. LONG write-read access.
Online Table Control
The value of this attribute cannot be changed. Read only access.

256

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.10.71 LowerLimitValue Property

Description
WinCC Online Trend Control/WinCC Function Trend Control
Tag values (from a trend referenced via " Index " ) which lie below the value defined
by " LowerLimitValue " are identified by the color specified in " LowerLimitColor " .
Whether the information is evaluated is dependent on the value of the " LowerLimit "
attribute.
Online Table Control
The value of this attribute cannot be changed. Read only access.

13.3.11 M
13.3.11.1 Marker Property

Description
TRUE, when the limit values should be displayed as scale values. BOOLEAN
write-read access.

13.3.11.2 Max Property

Description
Defines or returns the absolute value in the case of a full value display. This value
is displayed if the scale display is active.

13.3.11.3 MaximizeButton Property

Description
TRUE, when the object can be maximized in runtime. Read only access.

Printout of the Online Help
Creating Procedures and Actions with VBS

257

VBS Reference

11.05

13.3.11.4 MCGUBackColorOff Property

Description
Defines or returns the background color for flash status " Off " in the case of the
" Departed Unacknowledged " status. LONG write-read access.

13.3.11.5 MCGUBackColorOn Property

Description
Defines or returns the background color for flash status " On " in the case of the
" Departed Unacknowledged " status. LONG write-read access.

13.3.11.6 MCGUBackFlash Property

Description
TRUE, when the background should flash when a message departs
unacknowledged. BOOLEAN write-read access.

13.3.11.7 MCGUTextColorOff Property

Description
Defines or returns the color of the text for flash status " Off " in the case of the
" Departed Unacknowledged " status. LONG write-read access.

13.3.11.8 MCGUTextColorOn Property

Description
Defines or returns the background color of the text for flash status " Off " in the case
of the " Departed Unacknowledged " status. LONG write-read access.

258

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.11.9 MCGUTextFlash Property

Description
TRUE, when the font should flash when a message departs unacknowledged.
BOOLEAN write-read access.

13.3.11.10 MCKOBackColorOff Property

Description
Defines or returns the background color for flash status " Off " in the case of the
" Arrived " status. LONG write-read access.

13.3.11.11 MCKOBackColorOn Property

Description
Defines or returns the background color for flash status " On " in the case of the
" Arrived " status. LONG write-read access.

13.3.11.12 MCKOBackFlash Property

Description
TRUE, when the background should flash when a message arrives. BOOLEAN
write-read access.

13.3.11.13 MCKOTextColorOff Property

Description
Defines or returns the color of the text for flash status " Off " in the case of the
" Arrived " status. LONG write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

259

VBS Reference

11.05

13.3.11.14 MCKOTextColorOn Property

Description
Defines or returns the background color of the text for flash status " On " in the case
of the " Arrived " status. LONG write-read access.

13.3.11.15 MCKOTextFlash Property

Description
TRUE, when the font should flash when a message arrives. BOOLEAN write-read
access.

13.3.11.16 MCKQBackColorOff Property

Description
Defines or returns the background color for flash status " Off " in the case of the
" Departed Acknowledged " status. LONG write-read access.

13.3.11.17 MCKQBackColorOn Property

Description
Defines or returns the background color for flash status " On " in the case of the
" Departed Acknowledged " status. LONG write-read access.

13.3.11.18 MCKQBackFlash Property

Description
TRUE, when the background should flash when a message departs
acknowledged. BOOLEAN write-read access.

260

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.11.19 MCKQTextColorOff Property

Description
Defines or returns the color of the text for flash status " Off " in the case of the
" Departed Acknowledged " status. LONG write-read access.

13.3.11.20 MCKQTextColorOn Property

Description
Defines or returns the background color of the text for flash status " On " in the case
of the " Departed Acknowledged " status. LONG write-read access.

13.3.11.21 MCKQTextFlash Property

Description
TRUE, when the font should flash when a message departs acknowledged.
BOOLEAN write-read access.

13.3.11.22 MCText Property

Description
Defines or returns the label for the respective message class.

13.3.11.23 MeasurePoints Property

Description
The " Index " property references a trend. " MeasurePoints " defines the number of
measuring points to be displayed. The information is only evaluated when the
" TimeAxis " property is set to the value " -1 " .

Printout of the Online Help
Creating Procedures and Actions with VBS

261

VBS Reference

11.05

13.3.11.24 MessageClass Property

Description
Defines the respective message type (Alarm High, Alarm Low, Warning High,
Warning Low, ...) for which the " Display Text " , " Arrived- " , " Arrived Acknowledged - "
and " Departed Unacknowledged - " settings have been configured.

13.3.11.25 Min Property

Description
Defines or returns the absolute value in the case of the smallest value display. This
value is displayed if the scale display is active.

13.3.11.26 MinuteNeedleHeight Property

Description
Defines or returns the length of the minute hand for the analog clock. The
specification of the length is entered as a percentage value in relation to half the
length of the short side of the rectangular background. Write/Read access.
Example:
The short side of the rectangular background is 100 pixels long.
The minute hand width is specified as 80.
Therefore, the length of the minute hand is (100 pixel / 2) * 0.8 = 40 pixel.

13.3.11.27 MinuteNeedleWidth Property

Description
Defines or returns the width of the minute hand for the analog clock. The width is
specified as a percentage value related to double the length of the minute hand.
Example:
The length of the minute hand is 40 pixels.
The minute hand width is specified as 8.
Therefore, the width of the minute hand is 40 pixel * 2 * 0.08 = 6 pixels (rounded).

262

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.11.28 Moveable Property

Description
TRUE, when the object can be moved in runtime. Read only access.

13.3.11.29 MsgCtrlFlags Property

Description
Defines the sorting sequence in Alarm Control. Write/Read access.


0: Sorting is defined according to the entries in the time column in ascending
order, i.e. the oldest messages are at the top of the message window.



1: Sorting is defined according to the entries in the time column in descending
order, i.e. the oldest messages are at the bottom of the message window, the
latest at the top. In the case of this value, the " AutoScroll " property is
automatically deactivated, otherwise the current message could be moved out
of the display area of the message window.

13.3.11.30 MsgFilterSQL Property

Description
Defines an SQL Statement to the selected messages displayed in the message
window. Write/Read access.

13.3.12 N
13.3.12.1 Name Property

Description of layer and tag object
Returns the object name. STRING (read only)


In the case of tags, the name of the tag without server and tag prefix



In the case of layers, the layer name

Printout of the Online Help
Creating Procedures and Actions with VBS

263

VBS Reference

11.05

Tags
The tag " Name " property is used to address the tag via the tag list. The name of a
tag can contain a server prefix. In WinCC, tag names are structured according to
the following scheme:
& lt; Server prefix & gt; :: & lt; Tag prefix & gt; & lt; Tag Name & gt;
If the tag name alone is specified, the server prefix and tag prefix are removed
from the context of the picture.
If the tag is specified with a server prefix in the tag name, the tags and server prefix
of the context are ignored and the server prefix included is used.

WinCC Function Trend Control Description
The " Index " property references a trend. " Name " defines the name of the trend.

Description Project Object
Returns the name of the current Runtime project. STRING (read only)
Example
The following example returns the name of the current Runtime project as Trace:
'VBS160
HMIRuntime.Trace " Name: " & HMIRuntime.ActiveProject.Name & vbNewLine

Description of DataItem Object
Returns the name of the DataItem object.

13.3.12.2 NeedleColor Property

Description
Defines or returns the color of the pointer. LONG write-read access.

13.3.12.3 NormalColor Property

Description
Defines the color of the normal area of the scale. LONG write-read access.

264

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.12.4 NumberLines Property

Description
Defines or return the number of lines the text list object should contain. If the
amount of configured text is larger than this value, the selection list receives a
vertical scroll bar.

13.3.12.5 NumItems Property

Description
Returns the number of trends or column pairs (visible and invisible) in the window
which have been configured. Write/Read access.

13.3.13 O
13.3.13.1 Object Property

Description
If a non-WinCC control is used, it is possible that the properties provided by the
control have the same names as the general ScreenItem properties. In such cases,
the ScreenItem properties have priority. The " hidden " properties of an external
control supplier can be accessed using the additional " object " property.

Example
Address the properties of an external control supplier as follows:
Control.object.type
If the following form alone is used
Control.type
the properties of the ScreenItem object are used in the case of identical names.

Printout of the Online Help
Creating Procedures and Actions with VBS

265

VBS Reference

11.05

13.3.13.2 ObjectName Property

Description
Returns the object name.


In the case of graphic objects, the object name



In the case of pictures, the picture name

STRING (read only)

Example
The following example issues the names of all the objects contained in the picture
" NewPDL1 " :
'VBS80
Dim objScreen
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
lngAnswer = MsgBox( " Name of object " & lngIndex & " : " & strName, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next
Pictures
Establish the picture name directly from the " ObjectName " property:
'VBS81
MsgBox " Screenname: " & HMIRuntime.ActiveScreen.ObjectName

13.3.13.3 ObjectSizeDeclutteringEnable Property

Description
Activates/deactivates the ObjectSizeDecluttering property of a picture.
Upon activated ObjectSizeDecluttering, only objects within a set size range are
displayed.
You specify the upper and lower limits for the display range by using the properties
ObjectSizeDeclutteringMax and ObjectSizeDeclutteringMin, or in Graphics
Designer under " Tools & gt; Settings & gt; Show/Hide " .
BOOLEAN write-read access.

266

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Example:
Specifies the minimum and maximum object size and activates
ObjectSizeDecluttering for picture NewPDL1.
'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
objScreen.ObjectSizeDeclutteringMin = 20
objScreen.ObjectSizeDeclutteringMax = 100
objScreen.ObjectSizeDeclutteringEnable = 1

13.3.13.4 ObjectSizeDeclutteringMax Property

Description
Using ObjectSizeDeclutteringMax, the upper size range of a picture may be
specified or read.
Objects which are larger than the stated pixel size are no longer displayed when
ObjectSizeDecluttering is activated.
LONG write-read access.

Example:
Specifies the minimum and maximum object size and activates
ObjectSizeDecluttering for picture NewPDL1.
'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
objScreen.ObjectSizeDeclutteringMin = 20
objScreen.ObjectSizeDeclutteringMax = 100
objScreen.ObjectSizeDeclutteringEnable = 1

13.3.13.5 ObjectSizeDeclutteringMin Property

Description
Using ObjectSizeDeclutteringMin, the lower size range of a picture may be
specified or read..
Objects which are smaller than the stated pixel size are no longer displayed when
ObjectSizeDecluttering is activated.
LONG write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

267

VBS Reference

11.05

Example:
Specifies the minimum and maximum object size and activates
ObjectSizeDecluttering for picture NewPDL1.
'VBS157
Dim objScreen
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
objScreen.ObjectSizeDeclutteringMin = 20
objScreen.ObjectSizeDeclutteringMax = 100
objScreen.ObjectSizeDeclutteringEnable = 1

13.3.13.6 OffsetLeft Property

Description
Defines or returns the distance of the picture from the left edge of the picture
window.
The picture is displayed as a cutout of the picture window. The picture scroll bars
are located at the left and upper edge of the picture. If you wish to display the
picture in the picture window by using the horizontal and vertical positioning of the
picture scroll bars, use the properties " ScrollPositionX " and " ScrollPositionY " for
such positioning.

13.3.13.7 OffsetTop Property

Description
Defines or returns the distance of the picture from the top edge of the picture
window.
The picture is displayed as a cutout of the picture window. The picture scroll bars
are located at the left and upper edge of the picture. If you wish to display the
picture in the picture window by using the horizontal and vertical positioning of the
picture scroll bars, use the properties " ScrollPositionX " and " ScrollPositionY " for
such positioning.

268

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.13.8 Online Property

Description
Serves to start or stop updating.


0: The updating for the display is stopped. The values are buffered and entered
when the button is operated again.



-1: The updated display is resumed.

13.3.13.9 OnTop Property

Description
TRUE, when the object should remain in the foreground in runtime. Read only
access.

13.3.13.10 OperationMessage Property

Description
TRUE, if a message should be output upon successful operation. BOOLEAN writeread access.
The operation is sent to the message system, and is archived. Using the message
system, a message may be output in a message line.
Special features of I/O field, text list and slider
The reason for the operation may only be entered if the " OperationReport " property
has been set to TRUE.

Printout of the Online Help
Creating Procedures and Actions with VBS

269

VBS Reference

11.05

13.3.13.11 OperationReport Property

Description
TRUE, if the reason for an operation should be recorded. BOOLEAN write-read
access.
When an operation is subsequently initiated on the object in Runtime, a dialog
appears in which the user may enter the reason for the operation in text form. The
operation is sent to the message system, and is archived.

13.3.13.12 Orientation Property

Description
TRUE, when the text in the object should be displayed horizontally. BOOLEAN
write-read access.

Description of the " Connector " object type
Modifies the orientation of the connector. BOOLEAN write-read access.

13.3.13.13 OuterBevelStyle Property

Description
Defines the 3D effect for the outer bevel of the object.



1: The border is displayed depressed.



2: The border is displayed raised.



270

0: No border.

3: The border is displayed in one color without a 3D effect. The border color is
defined by the " BevelColorUp " property.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.13.14 OuterBevelWidth Property

Description
Defines the width of the outer bevel in pixels.

13.3.13.15 Outline Property

Description
TRUE, when the button should be given a black border in addition to the 3D
border. BOOLEAN write-read access.

13.3.13.16 OutputFormat Property

Description
Returns the value for the representation of the output value. The representation is
dependent on the data format. Read only access.

13.3.13.17 OutputValue Property

Description
Defines or returns presetting for the value to be displayed.
This value is used in runtime when the associated tag cannot be connected or
updated when a picture is started.

Printout of the Online Help
Creating Procedures and Actions with VBS

271

VBS Reference

11.05

13.3.14 P-Q
13.3.14.1 Parent Property

Description
Returns a reference to the superordinate object.
Objects within the VBS object model are accessed by hierarchy. You may descend
in the picture hierarchy using Screen and Screenitems. You may ascend in the
picture hierarchy by using the Parent property.

Usage
The Parent property can be used as often as required within an object hierarchy.
The following section provides a systematic description of how to access all the
elements in a hierarchy:

272

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

The Command
MsgBox MyCircle.Parent.Objectname
returns the name of " Picture2 " located one layer higher in the object hierarchy than
the original ScreenItem object " Circle1 " .
For example, if you wish to use " Parent " three times, ascend in the object hierarchy
by three layers:
MsgBox MyCircle.Parent.Parent.Parent.Objectname
returns the name of Picture1.
Reasoning:


Original reference is to ScreenItem " Circle1 "



" Circle1 " is within " Picture2 " (Layer 1)



" Picture2 " is within Picture Window2 " BF2 " (Layer 2)



" BF2 " is within " Picture 1 " (Layer 3)

Example
In the following example, the object name of the Parent object is displayed:
'VBS120
Dim objCircle
Set objCircle = HMIRuntime.Screens( " ScreenWindow1 " ).ScreenItems( " Circle1 " )
MsgBox objCircle.Parent.ObjectName

13.3.14.2 PasswordLevel Property

Description
Defines the authorization for operation (e.g. no input or no triggering actions) of the
object.

13.3.14.3 Path Property

Description
Returns the path of the current project (without file name). For a WinCC client
without its own path, the path is returned in UNC format, otherwise the local path is
returned.
STRING (read access only)

Printout of the Online Help
Creating Procedures and Actions with VBS

273

VBS Reference

11.05

Example
The following example returns the project path as Trace:
'VBS161
HMIRuntime.Trace " Path: " & HMIRuntime.ActiveProject.Path & vbNewLine

13.3.14.4 PersistentRT Property

Description
TRUE, when modified window settings should be retained following a change of
picture. Whether the information is evaluated is dependent on the value of the
" AllowPersistance " property.

13.3.14.5 PersistentRTCS Property

Description
TRUE, when modified settings should be retained following a change of picture
and applied in the configuration system. Whether the information is evaluated is
dependent on the value of the " AllowPersistance " property. BOOLEAN write-read
access.

13.3.14.6 PersistentRTCSPermission Property

Description
Defines the operator permission which is necessary in order to modify settings
related to persistence. The value to be entered corresponds to the number of
required permission in User Administrator. Whether or not the information is to be
analyzed depends on the value of the " AllowPersistence " property (does not apply
to WinCC Alarm Control).

274

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.14.7 PersistentRTPermission Property

Description
Defines the operator permission which is necessary in order to modify settings
related to the persistency in runtime. The value to be entered relates to the number
of the required permission in the User Administrator. Whether or not the
information is to be analyzed depends on the value of the " AllowPersistence "
property (does not apply to WinCC Alarm Control).

13.3.14.8 PicDeactReferenced Property

Description
TRUE, when the picture assigned for the " Disable " status should be saved in the
RoundButton object. Otherwise, only the associated object reference is saved.
Read only access.

13.3.14.9 PicDeactTransparent Property

Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the
" Disabled " status should be set to " transparent " . LONG write-read access.
The color is then only set to " transparent " when the " PicDeactUseTransColor "
property has the value TRUE.

13.3.14.10 PicDeactUseTransColor Property

Description
TRUE, when the transparent color defined by the " PicDeactTransparent " property
for the " Disable " status should be used. BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

275

VBS Reference

11.05

13.3.14.11 PicDownReferenced Property

Description
TRUE, when the picture assigned for the " On " status is to be saved. Otherwise,
only the associated object reference is saved. Read only access.

13.3.14.12 PicDownTransparent Property

Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the
" On " status should be set to " transparent " . LONG write-read access.
The color is then only set to " transparent " when the " PicDownUseTransColor "
property has the value TRUE.

13.3.14.13 PicDownUseTransColor Property

Description
TRUE, when the transparent color defined by the " PicDownTransparent " property
for the " On " status should be used. BOOLEAN write-read access.

13.3.14.14 PicReferenced Property

Description
TRUE, when the assigned picture is references the object and is not saved in it.
Read only access.

276

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.14.15 PicTransColor Property

Description
Defines or returns which color of the assigned bitmap object (.bmp, .dib) should be
set to " transparent " . LONG write-read access.
The color is then only set to " transparent " when the " PicUseTransColor " property
has the value TRUE.

13.3.14.16 Picture Property

Description
Returns the picture name of the background picture for the rectangular background
for both the analog and digital clocks. Read only access

13.3.14.17 PictureBack Property

Description
Returns the picture name of the picture for the object background. Read only
access.

13.3.14.18 PictureDeactivated Property

Description
Defines the picture to be displayed in the " Disable " status or returns the picture
name.
The picture (*.BMP or *.DIB) must be located in the " GraCS " directory of the
current project so that it can be integrated.

Printout of the Online Help
Creating Procedures and Actions with VBS

277

VBS Reference

11.05

13.3.14.19 PictureDown Property

Description
Defines the picture to be displayed in the " On " status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the " GraCS " directory of the
current project so that it can be integrated.

13.3.14.20 PictureUp Property

Description
Defines the picture to be displayed in the " Off " status or returns the picture name.
The picture (*.BMP or *.DIB) must be located in the " GraCS " directory of the
current project so that it can be integrated.

13.3.14.21 PictureName Property

Description
Defines the picture to be displayed in the graphic object in runtime or returns the
picture name.
The picture (*.BMP or *.DIB) must be located in the " GraCS " directory of the
current project so that it can be integrated.

13.3.14.22 PictureSelected Property

Description
Returns the picture name of the picture displayed in the " On " status. " AutoSize "
controls the adaptation of the size of picture and buttons. Read only access.

278

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.14.23 PictureThumb Property

Description
Returns the picture name of the background picture for the slider. Read only
access.

13.3.14.24 PictureUnselected Property

Description
Returns the picture name of the picture displayed in the " Off " status. " AutoSize "
controls the adaptation of the size of picture and buttons. Read only access.

13.3.14.25 PicUpReferenced Property

Description
TRUE, when the picture assigned for the " Off " status should be saved in the object.
Otherwise, only the associated object reference is saved. Read only access.

13.3.14.26 PicUpTransparent Property

Description
Defines or returns which color of the bitmap object (.bmp, .dib) assigned to the
" Off " status should be set to " transparent " . LONG write-read access.
The color is then only set to " transparent " when the " PicUpUseTransColor "
property has the value TRUE.

13.3.14.27 PicUpUseTransColor Property

Description
TRUE, when the transparent color defined by the " PicUpTransparent " property for
" Off " status should be used. BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

279

VBS Reference

11.05

13.3.14.28 PicUseTransColor Property

Description
TRUE, when the transparent color defined by the " PicDeactTransparent " property
for the " Disable " status should be used. BOOLEAN write-read access.

13.3.14.29 Position Property

Description
Defines the presetting for the position of the slider.
This value is used as the start value in runtime.
To operate the process value linked to this attribute, it is necessary that the
process value is also linked to the " Position " event. The " Position " event is located
on the " Event " tab control in the topic tree under SliderCtrl\PropertyTopics\Control
Properties\Value.

13.3.14.30 Precisions Property

Description
WinCC Online Table Control
The " Index " property references a pair of columns. " Precision " defines the number
of decimal places which should be shown in this value column. A maximum of 16
decimal places can be displayed.
WinCC Online Trend Control
Defines the number of decimal places with which the scale value is specified.

13.3.14.31 PrecisionX Property

Description
Defines or returns the number of decimal places with which the scale value for the
X-axis should be specified. Write/Read access.

280

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.14.32 PrecisionY Property

Description
Defines or returns the number of decimal places with which the scale value for the
Y-axis should be specified. Write/Read access.

13.3.14.33 PredefinedAngles Property

Description
Defines or returns the depth of the display of the 3DBarGraph object. Value range
from 0 to 3.
0 = cavalier
1 = isometric
2 = axionometric
3 = freely defined

13.3.14.34 Pressed Property

Description
TRUE, when the RoundButton object is pressed. BOOLEAN write-read access.

13.3.14.35 PrintJob Property

Description
Defines or reads out which print layout should be used for the printed output.

Printout of the Online Help
Creating Procedures and Actions with VBS

281

VBS Reference

11.05

13.3.14.36 Process Property

Description
Defines or returns presetting for the value to be displayed.
This value is used in runtime when the associated tag cannot be connected or
updated when a picture is started.

13.3.14.37 ProjectPath Property

Description
Contains the path and name of the associated project.

13.3.14.38 ProviderClsid Property

Description
The " Index " property references a trend. " ProviderClsid " defines whether an
archive tag or an internal or external tag should be displayed in this trend.


{416A09D2-8B5A-11D2-8B81-006097A45D48}: The trend is connected to an
archive tag.



{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: The trend is connected to an
internal or external tag.

13.3.14.39 ProviderType Property

Description
Defines the type of values to be displayed in a trend referenced by " Index " . In the
case of modification of " ProviderType " , impermissible combinations with other
attributes for data connection could be created. Therefore, before modifying
" ProviderType " , the immediate acceptance of the changes must be prevented
using " FreezeProviderConnections " .
0: Values are supplied via the API interface.
-1: Display of online or archive tags
-2: Displaying values from a user archive

282

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.14.40 PointCount Property
Description
Defines or returns the number of corner points. Each corner point has position
coordinates and is identified via an index.

13.3.14.41 QualityCode Property

Description
Defines a standard for the quality of a tag value after being read. The quality code
is provided as a 16-bit value for automatic evaluation. After a tag has been written,
the value is invalid.
SHORT (read only)
Note:
A summary of possible Quality Codes is provided in the WinCC Information
System under the heading " Communication " & gt; " Diagnostics " or " Communication "
& gt; " Quality Codes " .
Example
The following example indicates the quality of the read value when no errors have
occurred during the reading process:
'VBS83
Dim objTag
Dim lngLastErr
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Read
lngLastErr = objTag.LastError
If 0 = lngLastErr Then
MsgBox objTag.QualityCode
End If

Printout of the Online Help
Creating Procedures and Actions with VBS

283

VBS Reference

11.05

13.3.15 R
13.3.15.1 Radius Property

Description
Defines or returns the radius in pixels.

13.3.15.2 RadiusHeight Property

Description
Defines or returns the vertical radius in pixels (0 to 999).

13.3.15.3 RadiusWidth Property

Description
Defines or returns the horizontal radius in pixels (0 to 999).

13.3.15.4 RangeMax Property

Description
Defines the maximum absolute value for the value display.
If the " WithLabels " property has the value -1 (yes), this value is displayed on the
scale.

13.3.15.5 RangeMin Property

Description
Defines the minimum absolute value for the value display.
If the " WithLabels " property has the value -1 (yes), this value is displayed on the
scale.

284

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.15.6 Rectangular Property

Description
Defines or returns the side ratio of the rectangular background of the gauge.
BOOLEAN write-read access.
FALSE: The size of the gauge can be adjusted to any side ratio by dragging the
marking points with the mouse.
TRUE: The size of the gauge can only be adjusted by dragging the marking points
with the mouse. The side ratio of the background always remains 1:1.

13.3.15.7 ReferenceRotationLeft Property

Description
Defines or returns the X-coordinate of the reference point about which the object
should be rotated in runtime.
The value of the X-coordinate is relative to the object width. Enter the value in
percent starting from the left edge of the rectangle enclosing the object.

13.3.15.8 ReferenceRotationTop Property

Description
Defines or returns the Y-coordinate of the reference point about which the object
should be rotated in runtime.
The value of the Y-coordinate is relative to the object width. Enter the value in
percent starting from the top edge of the rectangle enclosing the object.

13.3.15.9 RelayCurves Property

Description
TRUE, when the trends should be displayed staggered. BOOLEAN write-read
access.

Printout of the Online Help
Creating Procedures and Actions with VBS

285

VBS Reference

11.05

13.3.15.10 Relevant Property

Description
TRUE, when the object will be taken into account when forming the group display.
BOOLEAN write-read access.

13.3.15.11 Replacement Property

Description
The " Index " property references a trend. Values, whose start value is unknown on
activating runtime or for which a substitute value is used, have an unstable status.
" Replacement " defines whether such values should be identified by the color
defined in " ReplacementColor " . BOOLEAN write-read access.

13.3.15.12 ReplacementColor Property

Description
The " Index " property references a trend. Values, whose start value is unknown on
activating runtime or for which a substitute value is used, have an unstable status.
" ReplacementColor " defines the color used to identify this value. The color is
defines as an RGB value. Whether the information is evaluated is dependent on
the value of the " Replacement " property.

13.3.15.13 RightComma Property

Description
Defines or returns the number of decimal places (0 to 20).

286

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.15.14 Rotation Property

Description
The icon can be rotated on its middle axis vertical to the character layer. The
attribute specifies the angle of rotation in degrees. The angle of rotation is
measured counterclockwise.


0: The angle of rotation is 0 degrees.



90: The angle of rotation is 90 degrees.



180: The angle of rotation is 180 degrees.



270: The angle of rotation is 270 degrees.

13.3.15.15 RotationAngle Property

Description
Defines or returns the rotation angle in degrees.
In runtime, the object (starting from the configured starting position) is rotated
clockwise the specified value about reference point.

13.3.15.16 RoundCornerHeight Property

Description
Defines or returns the corner radius.
Enter the value as a percentage of half the height of the object.

13.3.15.17 RoundCornerWidth Property

Description
Defines or returns the corner radius.
Enter the value as a percentage of half the width of the object.

Printout of the Online Help
Creating Procedures and Actions with VBS

287

VBS Reference

11.05

13.3.15.18 RulerPrecisions Property

Description
Defines the number of decimal places to which a measured value should be
displayed when it is determined using the " Display value at this position " function.

13.3.15.19 RulerPrecisionX Property

Description
Defines the number of decimal places used by the " Display value at this position "
to display the X-coordinate of a measured value. Whether the information is
evaluated is dependent on the value of the " TimeAxisX " attribute.

13.3.15.20 RulerPrecisionY Property

Description
Defines the number of decimal places used by the " Display value at this position "
to display the Y-coordinate of a measured value.

13.3.16 S
13.3.16.1 SameSize Property

Description
TRUE, when all four buttons of a Group Display object have the same size.
BOOLEAN write-read access.

288

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.2 ScaleColor Property

Description
Defines or returns the color of the scale. LONG write-read access.
The " Scaling " property must be set to TRUE for the color to be displayed.

13.3.16.3 ScaleTicks Property

Description
Defines the number of segments into which the bar will be subdivided by large tick
marks of the scale:
0-100: Object can be divided into a maximum of 100 segments
= 0: The optimum number of segments is set automatically.

13.3.16.4 Scaling Property

Description
TRUE, when a scale should also be used to represent a value. BOOLEAN writeread access.

13.3.16.5 ScalingType Property

Description of Bar Scaling
Defines or returns the type of bar scaling. Value range from 0 to 6.
0 = linear
1 = logarithmic
2 = negative logarithmic
3 = automatic (linear)
4 = tangent
5 = square
6 = cubic
The " Scaling " property must be set to TRUE for the color to be displayed.

Printout of the Online Help
Creating Procedures and Actions with VBS

289

VBS Reference

11.05

Description of Online Trend Control
Specifies or returns the type of scaling for a trend referenced by " Index " . Value
range from 0 to 2.
0 = linear
1 = logarithmic
2 = negative logarithmic

13.3.16.6 ScalingTypeX Property

Description
Defines the type of scaling of the X-axis of a trend referenced with " Index " .
Whether the information is evaluated is dependent on the value of the " TimeAxisX "
attribute.
0: Linear
-1: Logarithmically. This setting prevents the display of negative values.
-2: Logarithmically negated. This setting prevents the display of positive values.

13.3.16.7 ScalingTypeY Property

Description
Defines the type of scaling of the Y-axis of a trend referenced with " Index " .
0: Linear
-1: Logarithmically. This setting prevents the display of negative values.
-2: Logarithmically negated. This setting prevents the display of positive values.

13.3.16.8 Screen Property

Description
Returns the screen object to be displayed in the picture window.

290

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.9 ScreenName Property

Description
Defines the picture to be displayed in the picture window in runtime or returns the
picture name.
Note:
Always enter picture names without the extension " PDL " for reasons of
compatibility with future versions.

13.3.16.10 Screens Property

Description
Returns an object of type " Screens " .
Screens (read only)

Example
The following example accesses the picture " NewPDL1 " :
'VBS84
Dim objScreen
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )

13.3.16.11 ScreenItems Property

Description
Returns an object of type " ScreenItems " .
ScreenItems (read only)

Printout of the Online Help
Creating Procedures and Actions with VBS

291

VBS Reference

11.05

Example
The following example issues the number of all the objects contained in the picture
" NewPDL1 " :
'VBS85
Dim objScreen
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
Msgbox objScreen.ScreenItems.Count

13.3.16.12 Scrollable Property

Description
TRUE, when the display of the DXF picture in Runtime mode supports the scrolling
function. BOOLEAN write-read access.

13.3.16.13 ScrollBars Property

Description
TRUE, when the object is equipped with a scroll bar in runtime. Read only access.

13.3.16.14 ScrollPositionX Property

Description
Specifies the horizontal positioning of the scroll bar in a picture window with slider,
or returns its value.
The picture is displayed in the picture window by positioning the horizontal and
vertical scroll bars. If you wish to display the picture as a cutout where the scroll
bars are located at the left and upper edge of the picture, use the properties
" OffsetLeft " and " OffsetTop " as the origin of this cutout.

292

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.15 ScrollPositionY Property

Description
Specifies the vertical positioning of the scroll bar in a picture window with slider, or
returns its value.
The picture is displayed in the picture window by positioning the horizontal and
vertical scroll bars. If you wish to display the picture as a cutout where the scroll
bars are located at the left and upper edge of the picture, use the properties
" OffsetLeft " and " OffsetTop " as the origin of this cutout.

13.3.16.16 SecondNeedleHeight Property

Description
Defines or returns the length of the second hand for the analog clock. The
specification of the length is entered as a percentage value in relation to half the
length of the short side of the rectangular background. Write/Read access.
Example:
The short side of the rectangular background is 100 pixels long.
The second hand length is specified as 80.
Therefore, the length of the second hand is (100 pixel / 2) * 0.8 = 40 pixel.

13.3.16.17 SecondNeedleWidth Property

Description
Defines or returns the width of the second hand for the analog clock. The width is
specified as a percentage value related to double the length of the second hand.
Write/Read access.
Example:
The length of the second hand is 40 pixels.
The second hand width is specified as 2.
Therefore, the width of the second hand is 40 pixel * 2 * 0.02 = 2 pixels (rounded).

Printout of the Online Help
Creating Procedures and Actions with VBS

293

VBS Reference

11.05

13.3.16.18 SelBGColor Property

Description
Defines or returns the background color of the selected entry in a text list object.
LONG write-read access.

13.3.16.19 SelectionMode Property

Description
Defines whether and how a message line can be selected.


0 - NoSelection: Prevents the selection of a message. An acknowledgement
always relates to the oldest message queued.



1 - Cell: Enables the selection of fields in the message line. An
acknowledgement always relates to the selected message.



2 - Line: Enables the selection of a message line. An acknowledgement always
relates to the selected message.

13.3.16.20 SelectionRectColor Property

Description
Specifies the color of the rectangle in the message window if SelectionType equals
" 1 " .

13.3.16.21 SelectionRectWidth Property

Description
Specifies the line width of the rectangle in the message window if SelectionType
equals " 1 " .

294

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.22 SelectionType Property

Description
Specifies if the selected message in the message window should be optically
emphasized by color change or rectangle.


0 - Color change: selected message is optically emphasized by color change



1 - Rectangle: selected message is optically emphasized by a rectangle

13.3.16.23 SelTextColor Property

Description
Defines or returns the color of the text of the selected entry in the text list object.
LONG write-read access.

13.3.16.24 ServerData Property

Description
The attribute can only be modified using the " Properties of WinCC Online Trend
Control " dialog. Read only access.

13.3.16.25 ServerPrefix Property

Description
Defines the server containing the picture to be displayed in the picture window in
runtime or returns the server name.
Enter the server name followed by two colons: " & lt; Server name & gt; :: " . No check is
made as to whether the server actually exists.

Printout of the Online Help
Creating Procedures and Actions with VBS

295

VBS Reference

11.05

13.3.16.26 ServerNames Property

Description
Defines the server in a distributed system to which the data in the message
window should relate. The information appears in the following form:
NameServer1;NameServer2;NameServer3. Write/Read access.

13.3.16.27 ShowBar Property

Description
TRUE, when the bar should be displayed. BOOLEAN write-read access.

13.3.16.28 ShowDanger Property

Description
Controls the display of the " danger zone " on the instrument scale. BOOLEAN writeread access.
TRUE: The area is identified by the color defined in " DangerColor " .
FALSE: The color identification of the area is switched off.

13.3.16.29 ShowDecimalPoint Property

Description
TRUE, when the labeling of the scale section should be with decimal numbers
(decimal point and one decimal place).
FALSE, when the labeling of the scale section should be with whole numbers.
BOOLEAN write-read access.

296

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.30 ShowNormal Property

Description
Controls the display of the " normal zone " on the instrument scale. BOOLEAN writeread access.
TRUE: The area is identified by the color defined for normal color.
FALSE: The color identification of the area is switched off.

13.3.16.31 ShowPeak Property

Description
Defines the display of a slave pointer to display the maximum value. BOOLEAN
write-read access.
TRUE: The slave pointer is displayed.
FALSE: The slave pointer is hidden.

13.3.16.32 ShowPosition Property

Description
TRUE, when the slider position is to be displayed. BOOLEAN write-read access.

13.3.16.33 ShowRulerImmediately Property

Description
TRUE, when the ruler for determining the coordinate values should be displayed
when opening a picture. BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

297

VBS Reference

11.05

13.3.16.34 ShowThumb Property

Description
TRUE, when the slider is to be displayed. BOOLEAN write-read access.

13.3.16.35 ShowValuesExponentialX Property

Description
TRUE, when the X-coordinate of a measured value determined via the " Display
value at this position " function is displayed in exponential notation by a trend
referenced via " Index " . Whether the information is evaluated is dependent on the
value of the " TimeAxisX " property. BOOLEAN write-read access.

13.3.16.36 ShowValuesExponentialY Property

Description
TRUE, when the Y-coordinate of a measured value determined via the " Display
value at this position " function is displayed in exponential notation by a trend
referenced via " Index " . BOOLEAN write-read access.

13.3.16.37 ShowWarning Property

Description
Controls the display of the " warning zone " on the instrument scale. BOOLEAN
write-read access.
TRUE: The area is identified by the color defined by the warning color attribute.
FALSE: The color identification of the area is switched off.

298

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.38 SignificantMask Property

Description
Is required in runtime to display the active message class with the highest priority.
The value of the SignificantMask property represents an internal system output
value does not require any specific configuration by the user. Updating is initiated
in runtime by clicking on the object.

13.3.16.39 Sizeable Property

Description
TRUE, when it should be possible to change the size of the object in runtime.
BOOLEAN write-read access.
In the case of application window and picture window: Read only access

13.3.16.40 SmallChange Property

Description
Defines how many steps the controller can be moved with one mouse click or
returns the value.

13.3.16.41 SourceBeginTime Property

Description
In the case of online tags and archive tags ( " ProviderType " = -1), it defines the
starting time of the time range of a trend referenced via " Index " and to be displayed
in the trend window. In the case of modification of " SourceBeginTime " ,
impermissible combinations with other attributes for data connection could be
created. Therefore, before modifying " SourceBeginTime " , the immediate
acceptance of the changes must be prevented using " FreezeProviderConnections " .

Printout of the Online Help
Creating Procedures and Actions with VBS

299

VBS Reference

11.05

13.3.16.42 SourceEndTime Property

Description
In the case of online tags and archive tags ( " ProviderType " = -1), it defines the
stopping time of the time range of a trend referenced via " Index " and to be
displayed in the trend window. In the case of modification of " SourceEndTime " ,
impermissible combinations with other attributes for data connection could be
created. Therefore, before modifying " SourceEndTime " , the immediate acceptance
of the changes must be prevented using " FreezeProviderConnections " .

13.3.16.43 SourceNumberOfUAValues Property

Description
For values from the user archives ( " ProviderType " = -2) it defines the number of
values which should be loaded from the user archive for a trend referenced via
" Index " . In the case of modification of " SourceNumberOfUAValues " , impermissible
combinations with other attributes for data connection could be created. Therefore,
before modifying " SourceNumberOfUAValues " , the immediate acceptance of the
changes must be prevented using " FreezeProviderConnections " .

13.3.16.44 SourceNumberOfValues Property

Description
The " Index " property references a trend. In the case of online tags and archive tags
( " ProviderType " = -1), " SourceNumberOfValues " defines the number of values
which should be displayed in the trend window. Whether the information is
evaluated is dependent on the value of the " SourceTimeRange " property.
In the case of modification of " SourceNumberOfValues " , impermissible
combinations with other attributes for data connection could be created. Therefore,
before modifying " SourceNumberOfValues " , the immediate acceptance of the
changes must be prevented using " FreezeProviderConnections " .

300

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.45 SourceTagNameX Property

Description
The " Index " property references a trend. In the case of online tags and archive tags
( " ProviderType " = -1) " SourceTagNameX " defines the tag which should be
displayed along the X-axis. In the case of modification of " SourceTagNameX " ,
impermissible combinations with other attributes for data connection could be
created. Therefore, before modifying " SourceTagNameX " , the immediate
acceptance of the changes must be prevented using " FreezeProviderConnections " .

13.3.16.46 SourceTagNameY Property

Description
The " Index " property references a trend. In the case of online tags and archive tags
( " ProviderType " = -1) " SourceTagNameY " defines the tag which should be
displayed along the X-axis. In the case of modification of " SourceTagNameY " ,
impermissible combinations with other attributes for data connection could be
created. Therefore, before modifying " SourceTagNameY " , the immediate
acceptance of the changes must be prevented using " FreezeProviderConnections " .

13.3.16.47 SourceTagProviderDataX Property

Description
The attribute can only be modified using the " Properties of WinCC Function Trend
Control " dialog.

13.3.16.48 SourceTagProviderDataY Property

Description
The attribute can only be modified using the " Properties of WinCC Function Trend
Control " dialog.

Printout of the Online Help
Creating Procedures and Actions with VBS

301

VBS Reference

11.05

13.3.16.49 SourceTimeRange Property

Description
The " Index " property references a trend. In the case of online tags and archive tags
( " ProviderType " = -1) " SourceTimeRange " defines how the time range to be
displayed in the trend window is defined. In the case of modification of
" SourceTimeRange " , impermissible combinations with other attributes for data
connection could be created. Therefore, before modifying " SourceTimeRange " , the
immediate acceptance of the changes must be prevented using
" FreezeProviderConnections " .
0: The time range to be displayed is defined by the starting time
(SourceBeginTime) and the number of value pairs (SourceNumberOfValues).
-1: The time range to be displayed is defined by the starting time
(SourceBeginTime) and stopping time (SourceEndTime).

13.3.16.50 SourceUAArchive Property

Description
The " Index " property references a trend. In the case of values from the user
archives ( " ProviderType " = -2), " SourceUAArchive " defines the user archive from
which the values should be loaded. In the case of modification of
" SourceUAArchive " , impermissible combinations with other attributes for data
connection could be created. Therefore, before modifying " SourceUAArchive " the
immediate acceptance of the changes must be prevented using
" FreezeProviderConnections " .

13.3.16.51 SourceUAArchiveStartID Property

Description
The " Index " property references a trend. In the case of values from the user
archives ( " ProviderType " = -2), " SourceUAArchiveStartID " defines the data record
from which the values should be loaded from the user archive. In the case of
modification of " SourceUAArchiveStartID " , impermissible combinations with other
attributes for data connection could be created. Therefore, before modifying
" SourceUAArchiveStartID " , the immediate acceptance of the changes must be
prevented using " FreezeProviderConnections " .

302

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.16.52 SourceUAColumnX Property

Description
The " Index " property references a trend. In the case of values from the user
archives ( " ProviderType " = -2), " SourceUAColumnX " defines the column in the
user archive from which the values for the X-axis should be loaded. In the case of
modification of " SourceUAColumnX " , impermissible combinations with other
attributes for data connection could be created. Therefore, before modifying
" SourceUAColumnX " , the immediate acceptance of the changes must be
prevented using " FreezeProviderConnections " .

13.3.16.53 SourceUAColumnY Property

Description
The " Index " property references a trend. In the case of values from the user
archives ( " ProviderType " = -2), " SourceUAColumnY " defines the column in the
user archive from which the values for the Y-axis should be loaded. In the case of
modification of " SourceUAColumnY " , impermissible combinations with other
attributes for data connection could be created. Therefore, before modifying
" SourceUAColumnY " , the immediate acceptance of the changes must be
prevented using " FreezeProviderConnections " .

13.3.16.54 SquareExtent Property

Description
TRUE, when the size of the clock should be adjustable to any side ratio by
dragging the marking points with the mouse. BOOLEAN write-read access.

13.3.16.55 StartAngle Property

Description
Defines or returns the start of the object. The information is in counterclockwise
direction in degrees, beginning at the 12:00 clock position.

Printout of the Online Help
Creating Procedures and Actions with VBS

303

VBS Reference

11.05

13.3.16.56 Statusbar Property

Description
TRUE, when the status bar is to be displayed. BOOLEAN write-read access.

13.3.16.57 StatusbarPanes Property

Description
Defines the elements to be displayed in the status bar. Write/Read access.

13.3.16.58 Stretch Property

Description
Defines whether the side ratio is retained or adjustable on changing the icon size.
BOOLEAN write-read access.


FALSE: The side ratio is retained on changing the icon size.



TRUE: The side ratio of the icon can be adjusted parallel to changing the icon
size.

13.3.17 T
13.3.17.1 TagName Property

Description
The " Index " property references a trend. " TagName " defines the tag linked to this
trend. It is specified in the form " Archive Name\Tag Name " to display tags in a
process value archive or " TasgName " to display an internal or external tag which is
not stored in an archive.

304

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.2 TagPrefix Property

Description
Defines or returns the tag prefix which is prefixed to all tags contained in the
picture window object. In this way, a picture that is embedded in a picture window
retains access to its own tags while another accesses other tags.
Modification of the TagPrefix takes effect when a picture is reloaded. When a
picture is changed, this occurs automatically, otherwise the picture name must be
reassigned.
The tag prefix can be freely defined, but must match the name of the structure
tags. It must end with a stop, for example " Structure2. " .

13.3.17.3 Tags Property

Description
Returns an object of type " Tags " .
Tags (read only)

Example
The following example accesses the tag " Tag1 " :
'VBS86
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )

13.3.17.4 TagProviderClsid Property

Description
The " Index " property references a trend. " TagProviderClsid " defines whether this
trend should display an online tag or archived value. The data is only evaluated for
online tags and archive tags ( " ProviderType " = -1).
{A3F69593-8AB0-11D2-A440-00A0C9DBB64E}: Online tag.
{416A09D2-8B5A-11D2-8B81-006097A45D48}: Values are read from a process
value archive or a user archive.

Printout of the Online Help
Creating Procedures and Actions with VBS

305

VBS Reference

11.05

13.3.17.5 Template Property

Description
Returns the template for displaying the window content of the " Application Window "
object. Read only access.
The following templates are possible depending on the property value:
Window Contents = Global Script
" GSC Diagnostics "
The application window is supplied by Global Script applications. Results of the
diagnostics system are displayed.
" GSC Runtime "
The application window is supplied by Global Script applications. Analysis results
regarding Runtime characteristics are displayed.
Window Contents = Print Jobs
" All Jobs " :
The application window is supplied by the protocol system. Available reports are
displayed as a list.
" All Jobs - Context Menu " :
The application window is supplied by the protocol system. Available reports are
displayed as a list. A pop-up menu enables the selection of print options, display of
a print preview, as well as report printout.
" Job Detail View " :
The application window is supplied by the protocol system. Available reports are
displayed in a selection menu. Detailed information is displayed for the selected
protocol.
" Selected Jobs - Context Menu " :
The application window is supplied by the protocol system. Available reports are
displayed as a list. This list contains only those reports for which you activated the
option " Mark for print job list " in the " Print Job Properties " dialog. A pop-up menu
enables the selection of print options, display of a print preview as well as report
printout.

13.3.17.6 Text Property

Description
Defines or returns the labeling for an object.

306

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.7 ThumbBackColor Property

Description
Defines the color of the slider.

13.3.17.8 TicColor Property

Description
Defines the color of the scale tick marks. LONG write-read access.

13.3.17.9 TicFont Property

Description
Controls the display of the scale division labeling. Read only access.
The following properties can be set:
- Font
- Font Style
- Font Size
- " Strikethrough " effect
- " Underline " effect

13.3.17.10 TicOffset Property

Description
Defines the diameter of the imaginary circle on which the scale graduation is set.
The value is related to the smaller value of the geometric properties Width and
Height.
The ends of the main tick marks of the scale graduation point outwards onto this
circle.
Value range from 0 to 1.

Printout of the Online Help
Creating Procedures and Actions with VBS

307

VBS Reference

11.05

0: The scale division is in the middle of the graduated scale disk.
1: The diameter of the imaginary circle for the scale tick marks is the smaller value
of the geometric properties Width and Height.

13.3.17.11 TicTextColor Property

Description
Defines the color of the labeling of the scale tick marks.

13.3.17.12 TicTextOffset Property

Description
Defines the diameter of the imaginary circle on which the labeling of the scale tick
marks is set. The value is related to the smaller value of the geometric properties
Width and Height.
Value range from 0 to 1.
0: The label is in the middle of the graduated scale disk.
1: The diameter of the imaginary circle for the label is the smaller value of the
geometric properties Width and Height. As a result, part of the label can lie outside
the object limits and is, thus, invisible.

13.3.17.13 TicWidth Property

Description
Defines the length of the long tick marks for the scaling. The value is related to the
half the smaller value of the geometric properties Width and Height.
The length of the tick marks for fine scaling is 0.5*scale width.
Value range from 0 to end of scale.
0: No scale graduation is available. The division of the scale into ranges is not
visible.
Scaling distance: The scaling division ranges from the middle point of the
graduated scale disk to the value defined by the scaling distance.

308

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.14 Ticks Property

Description
TRUE, when the numbered face is displayed. BOOLEAN write-read access.

13.3.17.15 TicksColor Property

Description
Defines or returns the color of the hour markings on the face of the analog clock.
LONG write-read access.

13.3.17.16 TickStyle Property

Description
This attribute defines the appearance of the scale. Value range: 0 to 3.
As a result of the automatic scaling, it is possible that, occasionally, two scale tick
marks lie directly beside each other (apparently wide tick mark). This effect can be
corrected by minimally lengthening or shortening the slider object.
It is also possible to completely suppress display of the scaling ( " WithAxes " ).

13.3.17.17 TimeAxis Property

Description
Defines whether a common time axis should be used for all trends in the trend
window.

Printout of the Online Help
Creating Procedures and Actions with VBS

309

VBS Reference

11.05

13.3.17.18 TimeAxisFormat Property

Description
Defines the format of the information along the time axis.


0: The information is provided in hh:mm



-1: The information is provided in hh:mm:ss



-2: The information is provided in hh:mm:ss.ms



-3: The information is provided in hh:mm (full hours)



-4: The information is provided in hh:mm:ss (full minutes)



-5: The information is provided in hh:mm:ss.ms (full seconds)

13.3.17.19 TimeAxisX Property

Description
TRUE, when a common axis should be used for all trends in the trend window.
BOOLEAN write-read access.

13.3.17.20 TimeColumnAlignment Property

Description
The " Index " property references a pair of columns. " TimeColumnAlignment "
defines the alignment of the time column for this column pair.



1: Time values are entered centered.



310

0: Time values are entered aligned left.

2: Time values are entered aligned right.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.21 TimeFormat Property

Description
Defines the format of the time specification.


0: The information is provided in hh:mm



-1: The information is provided in hh:mm:ss



-2: The information is provided in hh:mm:ss.ms



-3: The information is provided in hh:mm (full hours)



-4: The information is provided in hh:mm:ss (full minutes)



-5: The information is provided in hh:mm:ss.ms (full seconds)

13.3.17.22 TimeJump Property

Description
WinCC Online Trend Control
The " Index " property references a trend. " TimeJump " defines whether the time
jumps in the archive should be identified by the color defined in " TimeJumpColor " .
WinCC Online Table Control
The value of this attribute cannot be changed. Read only access.

13.3.17.23 TimeJumpColor Property

Description
WinCC Online Trend Control
The " Index " property references a trend. " TimeJumpColor " defines the color
identifying the time jumps in the archive. Whether the information is evaluated is
dependent on the value of the " TimeJump " property. The color is defines as an
RGB value. LONG write-read access.
WinCC Online Table Control
The value of this property cannot be changed. Read only access.

Printout of the Online Help
Creating Procedures and Actions with VBS

311

VBS Reference

11.05

13.3.17.24 TimeOverlap Property

Description
WinCC Online Trend Control
The " Index " property references a trend. " TimeOverlap " defines whether the time
overlaps in the archive should be identified by the color defined in
" TimeOverlapColor " .
WinCC Online Table Control
The value of this property cannot be changed. Read only access.

13.3.17.25 TimeOverlapColor Property

Description
WinCC Online Trend Control
The " Index " property references a trend. " TimeOverlapColor " defines the color
identifying the time overlaps in the archive. Whether the information is evaluated is
dependent on the value of the " TimeOverlap " attribute. The color is defines as an
RGB value.
WinCC Online Table Control
The value of this property cannot be changed. Read only access.

13.3.17.26 TimeRange Property

Description
The " Index " property references a column pair or a trend. " TimeRange " defines
how the time range to be displayed should be defined.



312

0: The time range to be displayed is defined by a starting time ( " BeginTime " )
and stopping time ( " EndTime " ).
-1: The time range to be displayed is defined by a starting time ( " BeginTime " )
and a time range ( " TimeRangeBase " and " TimeRangeFactor " ).

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.27 TimeRangeBase Property

Description
The " Index " property references a column pair or a trend. The time range to be
displayed for this column pair/trend results from multiplying the values
" TimeRangeBase " and " TimeRangeFactor " , whereby the value " TimeRangeBase "
is interpreted in milliseconds.
The " TimeRangeBase " and " TimeRangeFactor " properties are only evaluated
when the " TimeRange " property is set, i.e. has the value " -1 " .

13.3.17.28 TimeRangeFactor Property

Description
The " Index " property references a column pair or a trend. The time range to be
displayed for this column pair/trend results from multiplying the values
" TimeRangeBase " and " TimeRangeFactor " , whereby the value " TimeRangeBase "
is interpreted in milliseconds.
The " TimeRangeBase " and " TimeRangeFactor " properties are only evaluated
when the " TimeRange " property is set, i.e. has the value " -1 " .

13.3.17.29 TimeStamp Property

Description
Reads the time stamp of the last read access of a tag. The time stamp is returned
in local time. DATE (read only)
The VBS standard function " FormatDateTime(Date[, NamedFormat]) " enables the
time stamp property to be output in plain text. The output is dependent on the
current language setting. The language setting can be set using the VBS standard
function SetLocale().
By implementing the second parameter of the FormatDate() function and further
VBS standard functions such as Year, WeekDay, Day, Hour, Minute, Second
enable the information, required by the user, to be split. Use the WeekdayName
function to receive the name of the weekday for WeekDay.
Example:
'VBS87
Dim objTag
Dim lngCount

Printout of the Online Help
Creating Procedures and Actions with VBS

313

VBS Reference

11.05

lngCount = 0
Set objTag = HMIRuntime.Tags( " Tag11 " )
objTag.Read
SetLocale( " en-gb " )
MsgBox FormatDateTime(objTag.TimeStamp) 'Output: e.g. 06/08/2002 9:07:50
MsgBox Year(objTag.TimeStamp) 'Output: e.g. 2002
MsgBox Month(objTag.TimeStamp) 'Output: e.g. 8
MsgBox Weekday(objTag.TimeStamp) 'Output: e.g. 3
MsgBox WeekdayName(Weekday(objTag.TimeStamp)) 'Output: e.g. Tuesday
MsgBox Day(objTag.TimeStamp) 'Output: e.g. 6
MsgBox Hour(objTag.TimeStamp) 'Output: e.g. 9
MsgBox Minute(objTag.TimeStamp) 'Output: e.g. 7
MsgBox Second(objTag.TimeStamp) 'Output: e.g. 50
For lngCount = 0 To 4
MsgBox FormatDateTime(objTag.TimeStamp, lngCount)
Next
'lngCount = 0: Output: e.g. 06/08/2002 9:07:50
'lngCount = 1: Output: e.g. 06 August 2002
'lngCount = 2: Output: e.g. 06/08/2002
'lngCount = 3: Output: e.g. 9:07:50
'lngCount = 4: Output: e.g. 9:07
Example
The following example issues the time stamp of the tag " Tag1 " :
'VBS88
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Read
MsgBox objTag.TimeStamp

13.3.17.30 TimeZone Property

Description
Defines the time zone used as a basis for displaying time values. Four settings are
possible:



Server's time zone



UTC (Universal Time Coordinated)



314

Local time zone

Apply project settings (= & gt; Use WinCC Explorer and access the computer's
properties page to define the time mode specifically for the computer. The
following are available for selection: WinCC V50 (Compatibility mode = & gt;
Display as was standard in the individual display sections to V5 ), local time
and UTC.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.31 TitleCut Property

Description
Defines whether the content of the fields of a title bar should be shortened if the
column width is too small. Write/Read access.

13.3.17.32 Titleline Property

Description
TRUE, when the control has a title bar and it can be moved in runtime. BOOLEAN
write-read access.

13.3.17.33 Toggle Property

Description
TRUE, when the round button should lock after being operated in runtime.
BOOLEAN write-read access.

13.3.17.34 ToleranceHigh Property

Description
Defines or returns the limit value for " Tolerance high " .
The type of the evaluation (in percent or absolute) is defined in the
TypeToleranceHigh property.
Monitoring of the limit value only takes effect when the CheckToleranceHigh
property is set to " True " .

Printout of the Online Help
Creating Procedures and Actions with VBS

315

VBS Reference

11.05

13.3.17.35 ToleranceLow Property

Description
Defines or returns the limit value for " Tolerance low " .
The type of the evaluation (in percent or absolute) is defined in the
TypeToleranceLow property.
Monitoring of the limit value only takes effect when the CheckToleranceLow
property is set to " True " .

13.3.17.36 ToolbarAlignment Property

Description
Defines or returns the position of the toolbar. Write/Read access.

13.3.17.37 ToolbarButtons Property

Description
Defines or returns the buttons contained in the toolbar by setting or resetting the
corresponding bits. Each button is assigned to a bit. There are no restrictions
concerning combination of the bits.
Bit Value (hex) ; Value (dec); Button:



1 - 0x00000002; 2; Short-term archive list



2 - 0x00000004; 4; Long-term archive list



3 - 0x00000008; 8; Acknowledge Central Signaling Device



4 - 0x00000010; 16; Single acknowledgment



5 - 0x00000020; 32; Group acknowledgment



6 - 0x00000040; 64; AutoScroll



7 - 0x00000080; 128; Selection Dialog



8 - 0x00000100; 256; Lock Dialog



9 - 0x00000200; 512; Print Message Report



11 - 0x00000800; 2048; Emergency Acknowledgment



316

0 - 0x00000001; 1; Message List

12 - 0x00001000; 4096; First Message

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference



13 - 0x00002000; 8192; Last Message



14 - 0x00004000; 16384; Next message



15- 0x00008000; 32768; Previous message



16 - 0x00010000; 65536; Info Text Dialog



17 -0x00020000; 131072; Comments Dialog



18 - 0x00040000; 262144; Loop in Alarm



20 - 0x00100000; 1048576; Print current view



21 - 0x00200000; 2097152; Lock List



22 - 0x00400000; 4194304; Lock/Release message



23 - 0x00800000; 8388608; Sort Dialog



24 - 0x01000000; 16777216; Time Base Dialog



25 - 0x02000000; 33554432; Hit List

In order to display more buttons, their values must be logically linked with OR.
Write/Read access.

13.3.17.38 Toolbar Property

Description
TRUE, when a toolbar is to be displayed. BOOLEAN write-read access.

13.3.17.39 ToolbarHotKeys Property

Description
Defines or returns hotkeys of the buttons in the toolbar. Write/Read access.

13.3.17.40 ToolTipText Property

Description
Defines or returns the text to be displayed as a tooltip when the mouse is
positioned over the object.
STRING (write-read access)

Printout of the Online Help
Creating Procedures and Actions with VBS

317

VBS Reference

11.05

Example
The following example assigns a tooltip text to every object in the picture
" NewPDL1 " : The picture " NewPDL1 " comprises only objects containing the
ToolTipText property:
'VBS89
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
'
'Assign tooltiptexts to the objects
objScrItem.ToolTipText = " Name of object is " & strName
Next

13.3.17.41 Top Property

Function
Defines or returns the Y-coordinate of an object (measured from the top left edge
of the picture) in pixels. The Y-coordinate relates to the top left corner of the
rectangle enclosing the object.
LONG (write-read access)

Example
The following example shifts all objects in the picture " NewPDL1 " 5 pixels upwards:
'VBS90
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Top = objScrItem.Top - 5
Next

318

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.42 TopConnectedConnectionPointIndex Property

Description
Specifies or sets the index number of the top connecting point.
LONG write-read access.

13.3.17.43 TopConnectedObjectName Property

Description
Specifies or sets the object name of the object which is docked on at the bottom
connecting point.
LONG write-read access.

13.3.17.44 Transparent Property

Description
TRUE, when the button appears completely filled in the color specified in
" BackColor " . BOOLEAN write-read access.

13.3.17.45 Trend Property

Description
TRUE, when the tendency (rising or falling) of the measuring value being
monitored should be displayed by a small arrow. BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

319

VBS Reference

11.05

13.3.17.46 TrendColor Property

Description
Defines or returns the color of the trend display.
The trend display indicates the tendency (rising or falling) of the measuring value
being monitored by a small arrow. In order to activate the trend display, the Trend
property must be set to " True " . LONG write-read access.

13.3.17.47 Type Property

Description
Reads out the object type, e.g. " Rectangle " , " Circle " or " Line " .
The object type is returned as a string. Read only
A special ID is returned as the type for all the graphic elements provided by
WinCC. It can be found under the topic " Type Identification in VBS in the individual
descriptions of the WinCC Object Types.

Special feature
In the case of non-WinCC controls and OLE objects, the version-independent
ProgID is returned as the type.
It is possible to determine the version-dependent ProgID or " User friendly Name "
from the ProgID: In the following example, " Control1 " is a control embedded in the
picture which already returns the version-independent ProgID as a result of the
Type property.
Note:
Since not every Control has a version-dependent ProgID, an error handling
measure should be integrated to query the version-dependent ProgID or
UserFriendlyName. If no error handling is used, the code is terminated
immediately without any result when no ProgID is found.
Determine the version-dependent ProgID as follows:
'VBS91
Dim objControl
Dim strCurrentVersion
Set objControl = ScreenItems( " Control1 " )
strCurrentVersion = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \CurVer\ " )
MsgBox strCurrentVersion

320

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Note:
In order that example above works, a multimedia control should be inserted in the
picture.
Determine the User Friendly Name as follows:
'VBS92
Dim objControl
Dim strFriendlyName
Set objControl = ScreenItems( " Control1 " )
strFriendlyName = CreateObject( " WScript.Shell " ).RegRead( " HKCR\ " &
objControl.Type & " \ " )
MsgBox strFriendlyName
Note:
In order that example above works, a multimedia control should be inserted in the
picture.
Example
The following example displays the type for all objects in the picture " NewPDL1 " :
'VBS93
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(objScrItem.Type, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

13.3.17.48 TypeAlarmHigh Property

Description
TRUE, when the upper limit value, at which an alarm is triggered, should be
evaluated as a percentage. FALSE, when the evaluation should be as an absolute
value. BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

321

VBS Reference

11.05

13.3.17.49 TypeAlarmLow Property

Description
TRUE, when the lower limit value, at which an alarm is triggered, should be
evaluated as a percentage. FALSE, when the evaluation should be as an absolute
value. BOOLEAN write-read access.

13.3.17.50 TypeLimitHigh4 Property

Description
TRUE, when the " Reserve 4 " upper limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

13.3.17.51 TypeLimitHigh5 Property

Description
TRUE, when the " Reserve 5 " upper limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

13.3.17.52 TypeLimitLow4 Property

Description
TRUE, when the " Reserve 4 " lower limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

322

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.17.53 TypeLimitLow5 Property

Description
TRUE, when the " Reserve 5 " lower limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

13.3.17.54 TypeToleranceHigh Property

Description
TRUE, when the " Tolerance high " lower limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

13.3.17.55 TypeToleranceLow Property

Description
TRUE, when the " Tolerance low " lower limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

13.3.17.56 TypeWarningHigh Property

Description
TRUE, when the " Warning high " lower limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

323

VBS Reference

11.05

13.3.17.57 TypeWarningLow Property

Description
TRUE, when the " Warning low " lower limit value should be evaluated as a
percentage. FALSE, when the evaluation should be as an absolute value.
BOOLEAN write-read access.

13.3.18 U
13.3.18.1 UnitColor Property

Description
Defines the text color for the names of the unit of measurement. LONG write-read
access.

13.3.18.2 UnitFont Property

Description
Controls the display of the labeling for the unit of measurement. Read only access.
The following properties can be set:
- Font
- Font Style
- Font Size
- " Strikethrough " effect
- " Underline " effect

324

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.18.3 UnitOffset Property

Description
This attribute defines the distance of the text for the unit of measurement in relation
to the top edge of the object. The text can only be positioned along the vertical
diameter of the graduated scale disk. The value of the property is related to the
height of the object and is measured from the top edge of the object to the base of
the text.
The value range is 0 is 1.
0: The base of the text is at the top limit of the object. The text is no longer visible
because it is outside the object.
1: The base of the text is at the bottom limit of the object.

13.3.18.4 UnitText Property

Description
Defines the text for the unit of measurement. Write/Read access.

13.3.18.5 UnselBGColor Property

Description
Defines or returns the background color of entries in the text list object which are
not selected. LONG write-read access.

13.3.18.6 UnselTextColor Property

Description
Defines or returns the color of the text for entries in the text list object which are not
selected. LONG write-read access.

Printout of the Online Help
Creating Procedures and Actions with VBS

325

VBS Reference

11.05

13.3.18.7 UserValue1 Property

Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither
evaluated nor displayed in runtime.

13.3.18.8 UserValue2 Property

Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither
evaluated nor displayed in runtime.

13.3.18.9 UserValue3 Property

Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither
evaluated nor displayed in runtime.

13.3.18.10 UserValue4 Property

Description
Defines or returns a value.
The value can be evaluated by a script, for example. This value is neither
evaluated nor displayed in runtime.

326

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.18.11 UpdateCycle Property

Description
Returns the type and frequency of updating the picture window in runtime. Read
only access.

13.3.18.12 UpperLimit Property

Description
TRUE, when the " UpperLimitColor " specification is to be used in order to identify
the tag values (from a trend referenced via " Index " ) which lie above the value
defined in " UpperLimitValue " . BOOLEAN write-read access.

13.3.18.13 UpperLimitColor Property

Description
Defines the color to be used in order to identify the tag values (from a trend
referenced via " Index " ) which lie above the value defined in " UpperLimitValue " .
Whether the information is evaluated is dependent on the value of the " UpperLimit "
property. The color is defines as an RGB value. LONG write-read access.

13.3.18.14 UpperLimitValue Property

Description
Tag values (from a trend referenced via " Index " ) which lie above the value defined
by " UpperLimitValue " are identified by the color specified in " UpperLimitColor " .
Whether the information is evaluated is dependent on the value of the " UpperLimit "
property.

Printout of the Online Help
Creating Procedures and Actions with VBS

327

VBS Reference

11.05

13.3.19 V-Z
13.3.19.1 ValueColumnAlignment Property

Description
The " Index " property references a pair of columns. " ValueColumnAlignment "
defines the alignment of the tag value for this column pair.


0: Tag values are entered aligned left.



1: Tag values are entered centered.



2: Tag values are entered aligned right.

13.3.19.2 Value Property

Description of Tag Object
Displays the value of the tags at the last read access or the value written or to be
written. Value represents the value of a tag. After calling in the " Read " method, the
tag value read is returned. Before writing, the new tag value required can be
assigned to the property. After calling in the " Write " method, the property contains
the value last written.
VARIANT (write-read access)

Example
The following example writes a new value in the " Tag1 " tag:
'VBS94
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Value = 50
objTag.Write
Description of WinCC Gauge Control
Defines the value to which the pointer points. Value range: " ValueMin " to
" ValueMax " .

328

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description of DataItem Object
Returns a value copy or object reference. Furthermore, an already added value
can be changed using the Value property.
'VBS198
HMIRuntime.DataSet.Add " motor1 " , 23
HMIRuntime.Trace " motor1: " &
HMIRuntime.DataSet( " motor1 " ).Value & vbNewLine
HMIRuntime.DataSet( " motor1 " ).Value = 55
HMIRuntime.Trace " motor1: " &
HMIRuntime.DataSet( " motor1 " ).Value & vbNewLine
HMIRuntime.DataSet.Remove( " motor1 " )
Note:
For object references it must be ascertained that objects are multiread-enabled.

13.3.19.3 ValueMax Property

Description
Defines the value at the end of the scale. Write/Read access.

13.3.19.4 ValueMin Property

Description
Defines the value at the start of the scale. Write/Read access.

13.3.19.5 Variable Property

Description
The " Index " property references a pair of columns. " Tag " defines the name of the
tag which should be connected to this column pair.

13.3.19.6 Visible Property

Printout of the Online Help
Creating Procedures and Actions with VBS

329

VBS Reference

11.05

Description
witches an object visible or invisible or issues a corresponding value:


TRUE: Object is visible



FALSE: Object is invisible

VARIANT_BOOL (write-read access)

Example
The following example sets all the objects in the picture " NewPDL1 " to invisible:
'VBS95
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
strName = objScreen.ScreenItems(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
objScrItem.Visible = False
Next

13.3.19.7 Warning Property

Description
Defines the start of the " Warning zone " as a scale value. Write/Read access.

13.3.19.8 WarningColor Property

Description
Defines the color of the " Warning zone " o the scale. LONG write-read access.

13.3.19.9 WarningHigh Property

330

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Description
Defines or returns the upper limit value for " Warning High " .
In order that the limit value is monitored, the " CheckWarningHigh " property must
be set to TRUE.
The display on reaching the limit value and the type of evaluation are defined by
means of the " ColorWarningHigh " and " TypeWarningHigh " properties.

13.3.19.10 WarningLow Property

Description
Defines or returns the lower limit value for " Warning Low " .
In order that the limit value is monitored, the " CheckWarningLow " property must
be set to TRUE.
The display on reaching the limit value and the type of evaluation are defined by
means of the " ColorWarningLow " and " TypeWarningLow " properties.

13.3.19.11 Width Property

Description
Sets or outputs the width of an object in pixels.
LONG

Example
The following example doubles the width of all objects in the pictures " NewPDL1 "
whose name begins with " Button " :
'VBS96
Dim objScreen
Dim cmdButton
Dim lngIndex
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'Get all " Buttons "
strName = objScreen.ScreenItems(lngIndex).ObjectName
If " Button " = Left(strName, 6) Then

Printout of the Online Help
Creating Procedures and Actions with VBS

331

VBS Reference

11.05

Set cmdButton = objScreen.ScreenItems(strName)
cmdButton.Width = cmdButton.Width * 2
End If
Next

13.3.19.12 WindowBorder Property

Description
TRUE, when the window is displayed with borders in runtime. Read only access.

13.3.19.13 WindowsStyle Property

Description
TRUE, when the object complies with the general Windows style (e.g. gray buttons
without borders). BOOLEAN write-read access. Note:


When this property is set to " True " , the properties which do not comply with the
Windows style are ignored (e.g. " BorderWidth " ).



On the other hand, the definition of a " BorderWidth " or a background color
other than gray causes " WindowsStyle " to receive the value " False " .



Exceptions here are the flash attributes: The definition of flash attributes does
not automatically lead to the deactivation of the " WindowsStyle " attribute.

13.3.19.14 WindowType Property

Description
Defines the use of the message window.



1 - Short-term archive list: To display the archived messages.



2 - Long-term archive list: To display the archived messages.



3 - Lock list: To display the currently locked messages.



332

0 - Message list: To display the currently pending message.

4 - Hit list: To display the statistical information of messages.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.3.19.15 WithAxes Property

Description
TRUE, when the scale should be displayed. BOOLEAN write-read access.

13.3.19.16 WithLabels Property

Description
TRUE, when the scale labels should be displayed. BOOLEAN write-read access.

13.3.19.17 ZeroPoint Property

Description
Defines or returns the position of the zero point of the bar graph.
Specify the value as a %age of the total bar height. The zero point can also be
outside of the range represented.
The " ScalingType " property must be set to " 2 " and " Scaling " to TRUE.

13.3.19.18 ZeroPointValue Property

Description
Defines the value of the zero point of the scale indicator.
Defines or returns the absolute value for the zero point.

Printout of the Online Help
Creating Procedures and Actions with VBS

333

VBS Reference

11.05

13.3.19.19 Zoom Property

Description
Sets or reads the zoom factor of a picture or a picture window.
If the specified zoom factor is below the minimum value, the zoom factor is
automatically set to the minimum value. If the specified zoom factor exceeds the
maximum value, the zoom factor is automatically set to the maximum value.
The minimum value for the zoom factor is 2 percent, the maximum value is 800
percent.
For screen objects, the zoom factor is entered as a numerical value and for picture
window objects in percent.

Example
The following example doubles the zoom level of the current picture:
'VBS97
HMIRuntime.ActiveScreen.Zoom = HMIRuntime.ActiveScreen.Zoom * 2

13.3.19.20 Zoomable Property

Description
TRUE, when the display of the DXF picture in Runtime mode supports the zooming
function. BOOLEAN write-read access.

334

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.4 Methods

Overview
Methods, which are applied to individual objects, can be used to read out tag
values for further processing or displaying diagnostics messages in runtime.

13.4.1 Activate Method

Function
Activates the specified picture and picture element, respectively.
Note:
Focus assignments should not be configured during a ButtonDown event. Since
the focus is specifically requested during the ButtonDown event, invalid states
may occur.
Syntax
Expression.Activate
Expression
Necessary. An expression which returns an object of type " Screen " or
" ScreenItem " .

Parameter
--

Examples
The following example shows the use for type " Screen " :
'VBS98
Dim objScreen
MsgBox HMIRuntime.ActiveScreen.ObjectName 'Output of active screen
Set objScreen = HMIRuntime.Screens( " ScreenWindow1 " )
objScreen.Activate 'Activate " ScreenWindow1 "
MsgBox HMIRuntime.ActiveScreen.ObjectName 'New output of active screen

Printout of the Online Help
Creating Procedures and Actions with VBS

335

VBS Reference

11.05

The following example shows the use for type " ScreenItem " :
'VBS158
MsgBox HMIRuntime.ActiveScreen.ActiveScreenItem.ObjectName 'Output of
active screen item
HMIRuntime.ActiveScreen.ScreenItems( " IOField1 " ).Activate
MsgBox HMIRuntime.ActiveScreen.ActiveScreenItem.ObjectName 'New output of
active screen item

13.4.2 Add Method

Description of the Data Set Object
Adds a tag to the list. A tag may be added to the tag object by using name or
reference.

Syntax
Expression.Add [Tag]
Expression
Necessary. An expression which returns an object of type " TagSet " .

Parameter
VARIANT
Parameter

Description

Tag

Name of a WinCC tag or reference to a tag
object to be added to the list.

Example
In the following example, a TagSet object is generated and a tag is added.
'VBS170
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Motor1 "
Tag objects may also be added as follows.
'VBS171
Dim Tag
Set Tag = HMIRuntime.Tags( " Motor2 " )

336

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Dim group2
Set group2 = HMIRuntime.Tags.CreateTagSet
group2.Add Tag

Description of DataSet Object
Adds a value or object reference to the list.
Note:
The DataSet object does not support any classes.
Objects of type Screen, Screens, ScreenItem, ScreenItems, Tag and TagSet
cannot be included in the DataSet list.
For object references it must be ascertained that objects are multiread-enabled.
Syntax
Expression.Add [vtName], [vtUserData]
Expression
Necessary. An expression which returns an object of type " DataSet " .

Parameter
VARIANT
Parameter

Description

vtName

Name by which value or tag are
to be added to list.

vtUserData

Value to be added to list.

Example
In this example, a value is included in the DataSet list.
'VBS172
HMIRuntime.DataSet.Add " Motor1 " ,23

Printout of the Online Help
Creating Procedures and Actions with VBS

337

VBS Reference

11.05

13.4.3 CreateTagSet Method

Function
Creates a new TagSet object. This object may be used for optimized multi-tag
access.

Syntax
Expression.CreateTagSet()
Expression
Necessary. An expression which returns an object of type " TagSet " .

Parameter
VARIANT

Example
The following example shows how to create a TagSet object.
'VBS168
'Build a Reference to the TagSet Object
Dim group
Set group = HMIRuntime.Tags.CreateTagSet

13.4.4 Item Method

Function
Retrieves an object from a collection and enables access to it via Index.

Description of DataItem Object
Access uses the name under which the value was added to the list. Single access
using an index is not recommended since the index changes during adding or
deleting of values.

338

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Syntax
Expression.Item()
Expression
Necessary. An expression which returns an object of the type " Screens " , " Layers "
(or " Tags " ).
Caution
In the case of " Tags " , restricted functional scope! The standard methods
get_Count and get_NewEnum are missing so that access via Index nor the
counting of all tags is possible.
Parameter
VARIANT

Example
The following example issues the names of all objects contained in the picture
" NewPDL1 " :
'VBS99
Dim objScreen
Dim objScrItem
Dim lngIndex
Dim lngAnswer
Dim strName
lngIndex = 1
Set objScreen = HMIRuntime.Screens( " NewPDL1 " )
For lngIndex = 1 To objScreen.ScreenItems.Count
'
'The objects will be indicate by Item()
strName = objScreen.ScreenItems.Item(lngIndex).ObjectName
Set objScrItem = objScreen.ScreenItems(strName)
lngAnswer = MsgBox(objScrItem.ObjectName, vbOKCancel)
If vbCancel = lngAnswer Then Exit For
Next

13.4.5 Read Method

Description of Tag Object
Reads out the stats of a tag (tag object) shortly after the moment it was called. At
the same time, the tag object is provided with the values read. Upon reading a tag,
its value, quality code and time stamp are determined. The " LastError " property
can be used to determine whether the call was successful.

Printout of the Online Help
Creating Procedures and Actions with VBS

339

VBS Reference

11.05

The " Name " , " ServerPrefix " and " TagPrefix " properties are not changed as a result.
If the value of the tag is read successfully, the properties of the tag object are
assigned the following values:
Value

Tag values

Name

Tag name (unchanged)

QualityCode

Quality level

TimeStamp

Current tag time stamp

LastError

0

ErrorDescription

" "

If the value of the tag is not read successfully, the properties of the tag object are
assigned the following values:
Value

VT_Empty

Name

Tag name (unchanged)

QualityCode

BAD Out of Service

TimeStamp

0

LastError

Read operation error codes

ErrorDescription

Error description on LastError

Note:
A summary of possible Quality Codes may be found in WinCC Information System
under key word " Communication " & gt; " Diagnostics " or " Communication " & gt; " Quality
Codes " .
Syntax
Expression.Read([Readmode])
Expression
Necessary. An expression which returns a tags object. The return value of the
Read method is the value of the tag read out.
Parameter
The optional " Readmode " parameter enables the distinction between two types of
reading:
Parameter

Description

0

The tag value is read from the process image (cache). 0 is the
default value.

1

The value of a tag is read directly from AS or channel (direct).

If the " Readmode " parameter is omitted, the value is read from the process image
by default. The return value of the Read method is the tag value read out as
VARIANT.

340

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Reading From the Process Image
When reading from the process image, the tag is logged on and, from that
moment, polled cyclically from the PLC. The login cycle is dependent on the
configured trigger. The value is read by WinCC from the tag image. On closing the
picture, the tags are logged off again. The call is characterized by the following:


The value is read by WinCC from the tag image.



The call is faster in comparison to direct reading (except with the first call: The
first call basically takes longer because the value from the PLC must be read
out and logged on.)



The duration of the call is not dependent on the bus load or AS.

Behavior in actions with a tag trigger
All the tags contained in the tag trigger are already known on opening a picture and
are logged in with the specified monitoring interval. Since all tags can be requested
in one operation, the best possible optimization can be achieved by the channel. If
a tag, contained in the trigger, is requested with Read during an action, the value
already exists and is transferred directly to the call. If a tag is requested which is
not contained in the trigger, the behavior is the same as with a standard trigger.
Behavior in actions with a cyclic trigger
When called for the first time, the tag is logged on with half the cycle time. The
value is then available for each subsequent call.
Behavior in event-driven actions
When called for the first time, the tag is logged on in " Upon Change " mode.
Process tags, logged on in " Upon Change " mode, correspond to a cyclic read job
with a cycle time of 1s.
If an event (e.g. mouse click) requests a value asynchronously, the tag is
transferred to the tag image. From this moment, the tag is polled cyclically from the
AS, thus increasing the basic load. To bypass this increase in the basic load, the
value can also be read synchronously. The synchronous call causes a one-off
increase in the communication load but the tag is not transferred to the tag image.

Direct reading
In the case of direct reading, the current value is returned. The tag is not logged on
cyclically but the value is requested once from the AS. Direct reading has the
following properties:


The value is read explicitly from the AS.



The call takes longer compared to reading from the process image.



The duration of the call is dependent on the bus load and AS, amongst other
things.

Printout of the Online Help
Creating Procedures and Actions with VBS

341

VBS Reference

11.05

Example
Reading a tag directly from AS or channel
'VBS100
Dim objTag
Dim vntValue
Set objTag = HMIRuntime.Tags( " Tagname " )
vntValue = objTag.Read(1) 'Read direct
MsgBox vntValue
Reading a tag from the process image
'VBS101
Dim objTag
Dim vntValue
Set objTag = HMIRuntime.Tags( " Tagname " )
vntValue = objTag.Read 'Read from cache
MsgBox vntValue

Description of TagSet Object
The TagSet object offers the option of reading several tags in one call.
Functionality here is mostly identical with that of a tag object. In the following, only
deviations thereof are described.
Expression
Necessary. An expression which returns an object of type " TagSet " .

Reading From the Process Image
The TagSet object offers the advantage of requesting several tags in one read
command. The tags are registered in the process image as a group, improving
performance in the process.

Direct reading
Since one call may process several read commands, performance is enhanced in
comparison to single calls.

342

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Example
The following example shows how tags are included in the TagSet list, how tag
values are set and subsequently written.
'VBS174
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Motor1 "
group.Add " Motor2 "
group.Read
HMIRuntime.Trace " Motor1: " & group( " Motor1 " ).Value & vbNewLine
HMIRuntime.Trace " Motor2: " & group( " Motor2 " ).Value & vbNewLine
If the optional parameter " Readmode " is set to 1, the process tags are not
registered but read directly from AS or channel.
group.Read 1

13.4.6 Refresh Method

Function
Drawing all visible pictures again.
Syntax
Expression.Refresh
Expression
Necessary. An expression which returns a " Screens " or " Screen " type object.
Parameter
-Examples
The first example forces all visible pictures to be drawn again:
'VBS149
HMIRuntime.Screens.Refresh
The second example forces the basic picture to be immediately redrawn:
'VBS150
HMIRuntime.Screens(1).Refresh

Printout of the Online Help
Creating Procedures and Actions with VBS

343

VBS Reference

11.05

13.4.7 Remove Method

Description of the DataSet Object
Removes a tag from the TagSet list. The tag may be removed by name or
reference to a tag object.

Syntax
Expression.Remove [Tag]
Expression
Necessary. An expression which returns an object of type " TagSet " .

Parameter
VARIANT
Parameter

Description

Tag

Name of a WinCC tag or reference to a tag
object to be removed from the list.

Example
The following example shows how several tags are included in the TagSet list, and
how to remove a tag again.
'VBS175
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Motor1 "
group.Add " Motor2 "
group.Remove " Motor1 "

Description of DataSet Object
Deletes the element specified in parameter " Name " from a list.

344

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Syntax
Expression.Remove [Name]
Expression
Necessary. An expression which returns an object of type " DataSet " .

Parameter
VARIANT
Parameter

Description

Name

Name of the object to be
removed from the list.

Example
The example shows how to remove the object " motor1 " from the list.
'VBS166
HMIRuntime.DataSet.Remove( " motor1 " )

Description of objects Logging, AlarmLogs, DataLogs
The method deletes a previously swapped archive segment from the Runtime
project.
Archive segments deleted with the " Remove " method are removed from the
common archiving directory of the project.
The call may require a somewhat longer time period, depending on archive data.
This may block the processing of subsequent scripts. Blockage of actions within
the picture may be avoided if you start the call in a Global Scripting action, such as
starting the action through a triggering tag.
The archive separation and deletion creates a CPU load. This will affect
performance.
Note:
Calling up the " Remove " method is presently only possible at the server. There is
an example, however, which shows how the method may be started by the client
from a server.
For redundancy, the following applies: Re-swapped archives are deleted with the
" Remove " method only on the computer from which the method was initiated.

Printout of the Online Help
Creating Procedures and Actions with VBS

345

VBS Reference

11.05

Syntax
Objects Logging, AlarmLogs
Expression.Remove [TimeFrom] [TimeTo] [TimeOut] [ServerPrefix]
Expression
Necessary. An expression which returns an object of type " Logging " or
" AlarmLogs " .

Object DataLogs
Expression.Remove [TimeFrom] [TimeTo] [TimeOut] [Type] [ServerPrefix]
Expression
Necessary. An expression which returns an object of type " DataLogs " .

Parameter
TimeFrom
Time from which an archive is to be deleted.
For the statement of time format, a short form is possible as well, as described in
" Time Format " .

TimeTo
Time up to which archive segments are to be deleted.
For the statement of time format, a short form is possible as well, as described in
" Time Format " .
Timeout
Timeout in milliseconds.
If you enter a value of " -1 " , the wait will be forever (infinite). If you enter a value of
" 0 " , there will be no wait.
Type
Type of the archive.
This parameter may (optionally) be used only for deletion of archive segments of
Tag Logging.
The following values may be entered:
Assigned Value

Type

Description

0

hmiDataLogFast

Tag Logging Fast data

1

hmiDataLogSlow

Tag Logging Slow data

2

hmiDataLogAll

Tag Logging Fast and
Slow data

ServerPrefix
Reserved for future versions.

346

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Return value
If an error occurred during deletion of the archive segments, the method will return
an error message. Additional information may be found under the subject heading
" Error Messages from Database Area " .

Time Format
Time format is defined as follows: YYYY-MM-DD hh:mm:ss, where YYYY
represents the year, MM the month, DD the day, hh the hour, mm the minute and
ss the second. For example, the time of 2 minutes and one second past 11 o'clock
on July 26, 2004 is displayed as follows: 2004-07-26 11:02:01.
For parameters " TimeFrom " and " TimeTo " the statement of data and time is also
possible in short form. Not all format fields must be filled in this case. The short
form means that the information on date and time may be lacking one or several
parameters, beginning with the value for seconds. For example, the statement may
be in the form of " YYYY-MM " or " YYYY-MM-DD hh " . Using the statement
" TimeFrom " = " 2004-09 " and " TimeTo " = " 2004-10-04 " all archive segments
between September 2004 up to and including October 4 are swapped.

Example
In the following example, archive segments re-swapped after the fact for a
specified time period may be removed and the return value may be output as
Trace.
'VBS182
HMIRuntime.Trace " Ret: " & HMIRuntime.Logging.Remove( " 2004-08-22 " , " 200409-22 " ,-1) & vbNewLine
In the following example, all archive segments re-swapped after the fact may be
removed and the return value may be output as Trace.
'VBS183
HMIRuntime.Trace " Ret: " & HMIRuntime.Logging.Remove( " " , " " ,-1) & vbNewLine

13.4.8 RemoveAll Method

Description of TagSet Object
Deletes all tags from a TagSet list.

Syntax
Expression.RemoveAll
Expression
Necessary. An expression which returns an object of type " TagSet " .

Printout of the Online Help
Creating Procedures and Actions with VBS

347

VBS Reference

11.05

Parameter
--

Example
The following example shows how several tags are included in the TagSet list, and
how to remove all tags again.
'VBS176
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Motor1 "
group.Add " Motor2 "
group.RemoveAll

Description of DataSet Object
Deletes all values or object references from a DataSet list.

Syntax
Expression.RemoveAll
Expression
Necessary. An expression which returns an object of type " DataSet " .

Parameter
--

Example
The example shows how all objects are removed from the list.
'VBS167
HMIRuntime.DataSet.RemoveAll

348

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.4.9 Restore Method

Description of objects Logging, AlarmLogs, DataLogs
The method adds swapped archive segments to the Runtime project.
Upon swapping, the archive segments are copied to the common archiving
directory of the project. Therefore the appropriate storage capacity must be
available.
The call may require a somewhat longer time period, depending on archive data.
This may block the processing of subsequent scripts. Blockage of actions within
the picture may be avoided if you start the call in a Global Scripting action, such as
starting the action through a triggering tag.
Linking / copying of the archives generates a CPU load because the SQL server
experiences additional load because of turned-on signature checking in particular.
Copying of archive segments will slow down hard disk access.
With turned-on signature checking, an error message is returned if an unsigned or
modified archive is to be swapped. There is always only one error message
returned, even if several errors occurred during the swap process. Additionally, a
WinCC system message is created for each archive segment. In the Windows
Event Viewer an entry is added under " Application " . This makes it possible to
check which archive segments cause the error.


In case of an unsigned archive the value " 0x8004720F " is returned. In the
Event Viewer the entry " Validation of database & lt; db_name & gt; failed ! No
signature found ! " is added.
The archive is swapped.



In case of a changed archive the value " 0x80047207 " is returned. In the Event
Viewer the entry " Validation of database & lt; db_name & gt; failed ! " is added.
The archive is not swapped.

Note:
Calling up the " Restore " method is presently only possible at the server. There is
an example, however, which shows how the method may be started by the client
from a server.
For redundancy, the following applies: Upon re-swapping of archives with the
" Restore " method, only archive segments are added to the Runtime project on the
computer from which the method was called.
Syntax
Objects Logging, AlarmLogs
Expression.Restore [SourcePath] [TimeFrom] [TimeTo] [TimeOut] [ServerPrefix]
Expression
Necessary. An expression which returns an object of type " Logging " or
" AlarmLogs " .

Printout of the Online Help
Creating Procedures and Actions with VBS

349

VBS Reference

11.05

Object DataLogs
Expression.Restore [SourcePath] [TimeFrom] [TimeTo] [TimeOut] [Type]
[ServerPrefix]
Expression
Necessary. An expression which returns an object of type " DataLogs " .

Parameter
SourcePath
Path to archive data.
TimeFrom
Time from which archives are to be swapped.
For the statement of time format, a short form is possible as well, as described in
" Time Format " .
TimeTo
Time up to which archive segments are to be swapped.
For the statement of time format, a short form is possible as well, as described in
" Time Format " .

Timeout
Timeout in milliseconds.
If you enter a value of " -1 " , the wait will be forever (infinite). If you enter a value of
" 0 " , there will be no wait.
Type
Type of the archive.
This parameter may (optionally) be used only for swapping of archive segments of
Tag Logging.
The following values may be entered:
Assigned Value

Type

Description

0

hmiDataLogFast

Tag Logging Fast data

1

hmiDataLogSlow

Tag Logging Slow data

2

hmiDataLogAll

Tag Logging Fast and
Slow data

ServerPrefix
Reserved for future versions.

Return value
If an error occurred during swapping of archive segments, the method will return an
error message. Additional information may be found under the subject heading
" Error Messages from Database Area " .

350

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Time Format
Time format is defined as follows: YYYY-MM-DD hh:mm:ss, where YYYY
represents the year, MM the month, DD the day, hh the hour, mm the minute and
ss the second. For example, the time of 2 minutes and one second past 11 o'clock
on July 26, 2004 is displayed as follows: 2004-07-26 11:02:01.
For parameters " TimeFrom " and " TimeTo " the statement of data and time is also
possible in short form. Not all format fields must be filled in this case. The short
form means that the information on date and time may be lacking one or several
parameters, beginning with the value for seconds. For example, the statement may
be in the form of " YYYY-MM " or " YYYY-MM-DD hh " . Using the statement
" TimeFrom " = " 2004-09 " and " TimeTo " = " 2004-10-04 " all archive segments
between September 2004 up to and including October 4 are swapped.

Example
In the following example, all archive segments since the specified time period are
re-swapped, and the return value is output as Trace.
'VBS184
HMIRuntime.Trace " Ret: " & HMIRuntime.Logging.Restore( " D:\Folder " , " 2004-0914 " , " " ,-1) & vbNewLine
In the following example, all Tag Logging Slow archive segments since the
specified time period are re-swapped, and the return value is output as Trace.
'VBS185
HMIRuntime.Trace " Ret: " &
HMIRuntime.Logging.DataLogs.Restore( " D:\Folder " , " 2004-09-14 12:30:05 " , " 200409-20 18:30 " ,-1,2) & vbNewLine
In the following example, all Alarm Logging archive segments up to the specified
time period are re-swapped, and the return value is output as Trace.
'VBS186
HMIRuntime.Trace " Ret: " & HMIRuntime.Logging.AlarmLogs.Remove( " " , " 200409-20 " ,-1) & vbNewLine

Printout of the Online Help
Creating Procedures and Actions with VBS

351

VBS Reference

11.05

13.4.10 Stop Method

Function
Terminates WinCC Runtime.

Syntax
HMIRuntime.Stop
Parameter
---

Example
The following example terminates WinCC runtime:
'VBS124
HMIRuntime.Stop

13.4.11 Trace Method

Description
Displays messages in the diagnostics window.

Syntax
HMIRuntime.Trace
Parameter
STRING

Example
The following example writes a text in the diagnostics window:
'VBS103
HMIRuntime.Trace " Customized error message "

352

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

13.4.12 Write Method

Description of Tag Object
Writes a value synchronously or asynchronously in a tag. The " LastError " property
can be used to determine whether the call was successful.
If the value of the tag is set successfully, the properties of the tag object are
assigned the following values:
Value

Tag values set by the user
(unchanged)

Name

Tag name (unchanged)

QualityCode

BAD Out of Service

TimeStamp

0

LastError

0

ErrorDescription

" "

If the value of the tag is not set successfully, the properties of the tag object are
assigned the following values:
Value

Tag values set by the user
(unchanged)

Name

Tag name (unchanged)

QualityCode

BAD Out of Service

TimeStamp

0

LastError

Write operation error codes

ErrorDescription

Error description on LastError

Syntax
Expression.Write [Value],[Writemode]
Expression
Necessary. An expression which returns a tag object.

Parameter
The value to be written can be transferred directly to the method as a parameter. If
the parameter is not specified, the value in the " Value " property is used. The
" Writemode " option parameter can be used to select whether the tag value should
be written synchronously or asynchronously. If the " Writemode " parameter is not
used, writing is performed asynchronously as its default value.
During the writing process, no information is supplied on the status of the tags.

Printout of the Online Help
Creating Procedures and Actions with VBS

353

VBS Reference

11.05

The " Value " property contains the value which was set before or during the writing
operation, therefore is may not correspond to the real current value of the tag. If
the data on the tag should be updated, use the Read method.
Parameter

Description

Value (optional)

The tag value is specified. The
specified value overwrites the
value in the " Value " property in
the tag object.
The tag value is not specified.
The tag receives the current
value from the " Value " property
of the tag object.

Writemode (optional)

0 or empty: The tag value is
written asynchronously. 0 is the
default value.
1: The tag value is written
synchronously.

On asynchronous writing, it is written immediately into the tag image. The user
does not receive any feedback if the value has been written in the programmable
controller, too.
In the case of synchronous writing (direct to the PLC), the writing operation actually
occurs when the PLC is ready to operate. The use receives a check-back message
if the writing operation was not successful.

Example
Asynchronous writing
'VBS104
Dim objTag
Set objTag = HMIRuntime.Tags( " Var1 " )
objTag.Value = 5
objTag.Write
MsgBox objTag.Value
or
'VBS105
Dim objTag
Set objTag = HMIRuntime.Tags( " Var1 " )
objTag.Write 5
MsgBox objTag.Value
Synchronous writing
'VBS106
Dim objTag

354

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

Set objTag = HMIRuntime.Tags( " Var1 " )
objTag.Value = 5
objTag.Write ,1
MsgBox objTag.Value
or
'VBS107
Dim objTag
Set objTag = HMIRuntime.Tags( " Var1 " )
objTag.Write 5, 1
MsgBox objTag.Value

Description of TagSet Object
The TagSet object offers the option of writing several tags in one call.
Functionality here is mostly identical with that of a tag object. In the following, only
deviations thereof are described.
Expression
Necessary. An expression which returns an object of type " TagSet " .

Parameter
In order to write different values, the " Value " property of individual tag objects must
be set, and write must be called thereafter without the " Value " parameter. Since the
write commands are grouped into one call, it results in improved performance
compared to single calls.
For the TagSet object, it is not possible to forward a value along with the " Write "
method. Individual values must be set using the " Value " property of the individual
tag objects.
Example
The following example shows how tags are included in the TagSet list, how tag
values are set and subsequently written.
'VBS173
Dim group
Set group = HMIRuntime.Tags.CreateTagSet
group.Add " Wert1 "
group.Add " Wert2 "
group( " Wert1 " ).Value = 3
group( " Wert2 " ).Value = 9
group.Write
If you set the optional parameter " Writemode " equal to 1, the process tags are
written synchronously (directly to PLC).
group.Write 1

Printout of the Online Help
Creating Procedures and Actions with VBS

355

VBS Reference

11.05

13.5 Appendix

Introduction
In this chapter you'll find additional information on VBScript.

13.5.1 Error Messages from Database Area

Introduction
Upon access to databases, a value is returned upon execution. Values in the range
" 0x8... " represent an error message. Values not equal to " 0x8... " represent a status
message.
Status Messages
The following status messages are defined:
0x0

OK

0x1

Function did not find any errors in parameter supply and did not find any
internal errors. The following causes may result in this value.
Upon connection to databases:
- No archives were found in the specified time window.
- Archives were found in the specified time window but they were
already attached.
Upon disconnection from databases:
- No attached archives were found in the specified time window. No
checks are performed on whether or not archives are attached at all.

Error Messages
The following error messages are defined (n in English only):
0x80047200

WinCC is not activated

0x80047201

Invalid archive type

0x80047202

Invalid upper boundary

0x80047204

Path 'CommonArchiving' could not be created in the project path

0x80047205

Timeout, please retry

0x80047206

WinCC was deactivated

0x80047207

356

Invalid lower boundary

0x80047203

Wrong signification
At least one database had an invalid signature and has not
been attached.

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

VBS Reference

0x80047208

Database could not be attached

0x80047209

Copy to 'CommonArchiving' is not possible.

0x8004720A

Invalid syntax for database filename.

0x8004720B

No list of databases.

0x8004720C

Database already detached.

0x8004720D

Database could not be detached.

0x8004720F

Unsigned database attached.
At least one database without signature has been attached.

0x80047210

Path error :
- Path invalid,
- no *.MDF files found in specified path or
- no permission to specified path.

Printout of the Online Help
Creating Procedures and Actions with VBS

357

VBS Reference

358

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14 Examples of VBScript
Introduction
The following section contains application examples of VBS in WinCC. The
" Examples in WinCC " section contains examples of codes with which the WinCC
runtime environment can be made dynamic. These examples have been conceived
so that they can be assumed 1:1 in the configuration.
The " General Examples " section contains examples with which to influence the
Microsoft environment. There is no guarantee nor support for the running capability
of these examples.

14.1 Examples in WinCC

Introduction
This section contains examples of using VBScript in WinCC with regard to the
following topics:

14.1.1 Example: Accessing objects in Graphics Designer

Introduction
Access can be made to all Graphic Designer objects using VBS WinCC in order to
make the graphic runtime environment dynamic. Graphic objects can be made
dynamic on operation (e.g. clicking the mouse on a button), depending on a tag or
cyclically (e.g. flashing).
The following examples illustrate how to change a graphic object following a
mouse click.
Procedure
In the following example, the radius of a circle is set to 20 in runtime per mouse
click:
'VBS121
Dim objCircle
Set objCircle = ScreenItems( " Circle1 " )
objCircle.Radius = 20
Note:
The expression used in the example only applies to Graphics Designer. In the
case of analog actions in Global Script, address the objects using the HMIRuntime
object.

Printout of the Online Help
Creating Procedures and Actions with VBS

359

Examples of VBScript

11.05

14.1.2 Example: Defining the color of objects

Introduction
The colors of graphic objects are defined via RGB values (Red/Green/Blue). The
color values for graphic objects can be set or read out.

Procedure
The following example defines the fill color for " ScreenWindow1 " to blue:
'VBS122
Dim objScreen
Set objScreen = HMIRuntime.Screens( " ScreenWindow1 " )
objScreen.FillStyle = 131075
objScreen.FillColor = RGB(0, 0, 255)

14.1.3 Example: Configuring language changes

Introduction
The runtime language of WinCC can be changed using VBS. The most typical use
is buttons with the corresponding language codes which are placed on the start
page of a project.
The runtime language is specified in VBS by means of a language code, e.g. 1031
for German - Germany, 1033 for English - United States etc. An overview of all
language codes is provided in the principles of VBScript under the topic " Locale ID
(LCID) Chart " .

Procedure
Use the " Mouse click " event on a button to create a VBS action and enter the
following action code to switch the runtime language to German:
'VBS123
HMIRuntime.Language = 1031

360

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.1.4 Example: Deactivating runtime

Introduction
It is possible to terminate WinCC runtime with VBS, e.g. via a mouse click or on tag
values or other events, such as multiple faulty input of a password when starting
runtime.

Procedure
The following example terminates WinCC runtime:
'VBS124
HMIRuntime.Stop

14.1.5 Example: Configuring change picture globally

Introduction
VBS can be used to initiate a global picture change and thus, for example, display
a picture from a server on a client in a distributed system. To do this, server's
server prefix must precede the target picture.

Procedure
Configure the following code for a picture change to a button, for example:
'VBS125
HMIRuntime.BaseScreenName = " Serverprefix::New screen "

14.1.6 Example: Configuring Change Picture Via Property

Introduction
If partitioned pictures are used in the configuration, e.g. in a basic picture title and
operating bar for the user interface and an embedded picture window for the actual
picture display, configure a picture change using the properties of the picture
window.
The property of the " ScreenName " picture window must be changed in order for
the other picture to appear. The action and picture window must be configured in
the same picture.

Printout of the Online Help
Creating Procedures and Actions with VBS

361

Examples of VBScript

11.05

Procedure
In the following example, the " test.pdl " picture is displayed in the " ScreenWindow "
picture window when executing the action:
'VBS126
Dim objScrWindow
Set objScrWindow = ScreenItems( " ScreenWindow " )
objScrWindow.ScreenName = " test "

14.1.7 Example: Configuring diagnostic output via Trace

Introduction
If a GSC diagnostics window has been inserted in the picture, diagnostic output
can be displayed in the diagnostics window in runtime using the Trace command.
GSC Diagnostics issues the Trace methods contained in the actions in the
chronological sequence they are called. This also applies to Trace instructions in
procedures which are called in actions. The targeted implementation of Trace
instructions, e.g. for the output of tag values, enables the progress of actions and
the procedures called in them to be traced. The Trace instructions are entered in
the form " HMIRuntime.Trace( & lt; output & gt; ) " .
The GSC Diagnostics displays trace output from C and VBS.

Procedure
The following example writes a text in the diagnostics window:
'VBS127
HMIRuntime.Trace " Customized error message "

362

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.1.8 Example: Writing tag values

Introduction
Using VBS, it is possible to write a tag value to the PLC, e.g. by clicking the mouse
on a button to specify setpoint values, or to set internal tag values to trigger other
actions.
Various write variations are mentioned and explained below.

Simple writing
In the following example, a value is written to the " Tag1 " tag:
'VBS128
HMIRuntime.Tags( " Tag1 " ).Write 6
This is the simplest form of writing since no object reference is generated.

Writing with object reference
In the following example, a local copy of the tag object is created and a value
written to " Tag1 " :
'VBS129
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Write 7
Referencing offers the advantage of being able to work with the tag object before
writing. The tag value can be read, calculations executed and written again:
'VBS130
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Read
objTag.Value = objTag.Value + 1
objTag.Write
Synchronous writing
Normally, the value to be written is transferred to the tag management and
processing of the action resumed. In some cases, however, it must be ensured that
the value has actually been written before processing of the action can be
resumed.
This type of writing is realized by specifying the value 1 for the additional, optional
parameters:
'VBS131
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Write 8,1
or

Printout of the Online Help
Creating Procedures and Actions with VBS

363

Examples of VBScript

11.05

'VBS132
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Value = 8
objTag.Write ,1
Note:
Please note that the call takes longer in comparison to the standard call. The
duration is also dependent on the channel and AS, amongst other things.
The type of writing complies to the SetTagXXXWait() call in C scripting.
Writing with status handling
In order to ensure that a value has been written successfully, it is necessary to
execute an error check or determine the status of the tag, after the writing process.
This is done by checking the value of the " LastError " property after writing. When
the test proves successful, i.e. the job has been placed successfully, the tag status
is checked.
In the case of a write job, the current status from the process is not determined. To
establish this, it is necessary to read the tag. The value specified in the Quality
Code property after the read process provides an indication of the tag status and, if
necessary, makes reference to a failed AS connection.
In the following example, the " Tag1 " tag is written. If an error occurs during writing,
the error value and error description appear in the Global Script diagnostics
window. Finally, the Quality Code is checked. If the Quality Code is OK (0x80), it is
displayed in the diagnostics window.
'VBS133
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Write 9
If 0 & lt; & gt; objTag.LastError Then
HMIRuntime.Trace " Error: " & objTag.LastError & vbCrLf & " ErrorDescription: " &
objTag.ErrorDescription & vbCrLf
Else
objTag.Read
If & H80 & lt; & gt; objTag.QualityCode Then
HMIRuntime.Trace " QualityCode: 0x " & Hex(objTag.QualityCode) & vbCrLf
End If
End If
Note:
After writing a tag, the QualityCode property of the local tag object from BAD Out
of Service is set because it is not known which Quality Code manages the tag in
the process.
The Quality Code cannot be written from VBS.

364

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.1.9 Example: How to Read Tag Values

Introduction
VBS can be used to read and further process a tag value. This makes it possible,
for example, to click the mouse on a button to obtain information on the system
status or to execute a calculation.
Various read variations are mentioned and explained below.

Simple reading
In the following example, the value of " Tag1 " is read and displayed in the Global
Script diagnostics window:
'VBS134
HMIRuntime.Trace " Value: " & HMIRuntime.Tags( " Tag1 " ).Read & vbCrLf
This is the simplest form of reading since no object reference is generated.

Reading with object reference
In the following example, a local copy of the tag object is created, the tag value
read and displayed in the Global Script diagnostics window:
'VBS135
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
HMIRuntime.Trace " Value: " & objTag.Read & vbCrLf
Referencing offers the advantage of being able to work with the tag object. The tag
value can be read, calculations executed and written again:
'VBS136
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Read
objTag.Value = objTag.Value + 1
objTag.Write
Using the Read method, process tags which have been read are added to the
image, from this moment on they cyclically requested from the AS. If the tag is
already in the image, the value contained in it is returned.
On closing the picture, the tags are logged off again.
Note:
If a tag is requested in a Global Script action, it remains logged on for the entire
WinCC runtime period.

Printout of the Online Help
Creating Procedures and Actions with VBS

365

Examples of VBScript

11.05

Direct reading
Normally, the tag values are read from the tag image. In certain situations,
however, it may be necessary to read the value direct from the AS, e.g. to
synchronize fast processes.
If the optional parameter is set to 1 for the read process, the tag is not logged in
cyclically but the value is requested once from the AS.
'VBS137
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
HMIRuntime.Trace " Value: " & objTag.Read(1) & vbCrLf
Note:
Please note that the call takes longer in comparison to the standard call. The
duration is also dependent on the channel and AS, amongst other things.
This type of call must be avoided in the case of cyclic C actions because this is the
main reason for performance problems.
This type of read process corresponds to GetTagXXXWait() call from C scripting.
Reading with status handling
In order to ensure that a value is valid, a check should be made following reading.
This occurs by the fact that the Quality Code is controlled.
In the following example, the " myWord " tag is read and the QualityCode then
checked. When the Quality Code does not correspond to OK (0x80) the LastError,
ErrorDescription and QualityCode properties are displayed in the Global Script
diagnostics window.
'VBS138
Dim objTag
Set objTag = HMIRuntime.Tags( " Tag1 " )
objTag.Read
If & H80 & lt; & gt; objTag.QualityCode Then
HMIRuntime.Trace " Error: " & objTag.LastError & vbCrLf & " ErrorDescription: " &
objTag.ErrorDescription & vbCrLf & " QualityCode: 0x " & Hex(objTag.QualityCode)
& vbCrLf
Else
HMIRuntime.Trace " Value: " & objTag.Value & vbCrLf
End If
Note:
If an error occurs during reading, QualityCode is set to BAD out of Service.
Therefore, it is sufficient to check the QualityCode following reading.

366

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.1.10 Example: Writing Object Properties

Introduction
VBS enables access to the properties of all Graphics Designer picture objects.
Properties can be read out to be modified or changed during runtime.
The following examples illustrate various forms of access.

Simple setting of a property
In the following example, the background color of the " Rectangle1 " object
contained in the picture is set to red:
'VBS139
ScreenItems( " Rectangle1 " ).BackColor = RGB(255,0,0)
This is the simplest form of writing since no object reference is generated.
Note:
If the work is completed without an object reference, only the standard properties
are provided in Intellisense.
Note:
The form of expression used in the example only applies to Graphics Designer. In
the case of analog actions in Global Script, address the objects using the
HMIRuntime object.
Setting a property with object reference
In the following example, a reference is created to the " Rectangle1 " object
contained in the picture and the background is set to red using the VBS standard
function RGB():
'VBS140
Dim objRectangle
Set objRectangle = ScreenItems( " Rectangle1 " )
objRectangle.BackColor = RGB(255,0,0)
Referencing is useful when several object properties must be changed. When
using Intellisense, this process then lists all the object properties.
Note:
The form of expression used in the example only applies to Graphics Designer. In
the case of analog actions in Global Script, address the objects using the
HMIRuntime object.

Printout of the Online Help
Creating Procedures and Actions with VBS

367

Examples of VBScript

11.05

Setting Properties via the Picture Window
VBS in Graphics Designer offers two options for cross-picture addressing:


using the screen object of a picture window with " ScreenItems "



starting from the basic picture with " HMIRuntime.Screens "

Referencing the picture window
In the following example, the color of a rectangle is changed in the underlying
picture window. The script is executed in the " BaseScreen " picture which contains
the picture window " ScreenWindow1 " . The picture window displays a picture which
contains an object of type " Rectangle " with the name " Rectangle1 " .
'VBS199
Sub OnLButtonUp(ByVal Item, ByVal Flags, ByVal x, ByVal y)
Dim objRectangle
Set objRectangle =
ScreenItems( " ScreenWindow1 " ).Screen.ScreenItems( " Rectangle1 " )
objRectangle.BackColor = RGB(255,0,0)
End Sub
Referencing from the basic picture
You may also reference the picture with the object to be changed through
HMIRuntime.Screens. The specification of the picture is defined relative to the
basic picture via the following access code:
[ & lt; Basic picture name & gt; .] & lt; Picture window name & gt; [: & lt; Picture name & gt; ]... . & lt; Picture
window name & gt; [: & lt; Picture name & gt; ]
In the following example, a reference is created to the " Rectangle1 " object
contained in the " Picture2 " picture and the background color is set to red.
The picture " Screen2 " , in this case, is in " Screen1 " . " Picture1 " is displayed in the
basic picture " BaseScreen " .
'VBS141
Dim objRectangle
Set objRectangle =
HMIRuntime.Screens( " BaseScreen.ScreenWindow1:Screen1.ScreenWindow1:Scr
een2 " ).ScreenItems( " Rectangle1 " )
objRectangle.BackColor = RGB(255,0,0)
It is not necessary to specify the picture name. It is possible to address a picture
uniquely using the picture window name. Therefore, it is sufficient to specify the
name of the picture window, as in the following example:
'VBS142
Dim objRectangle
Set objRectangle =
HMIRuntime.Screens( " ScreenWindow1.ScreenWindow1 " ).ScreenItems( " Rectangl
e1 " )
objRectangle.BackColor = RGB(255,0,0)
This type of addressing enables objects in picture windows to be addressed in
different pictures. This is a particularly interesting aspect in respect of the picture
module technique.

368

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

Make the property dynamic using the return value
Actions on properties cannot only be triggered by events or cyclically but properties
can also be made dynamic directly via an action.
In the following example, the background color of an object is made dynamic via a
return value. The value transferred can come from the evaluation of events in the
PLC, for example and used for the graphic display of an operating status:
'VBS146
Function BackColor_Trigger(ByVal Item)
BackColor_Trigger = RGB(125,0,0)
End Function
Caution
If you make an object property dynamic with a VBS action via the return value of a
script, the value of the object property is written only if it has changed in relation to
the last script run. It is not considered if the value had been changed from another
location.
Therefore it is illegal to change properties which have been made dynamic by VBS
action via the return value from another location (e.g., other C scripts or VBS
scripts).
if you do not observe this, wrong values can be the results.

Printout of the Online Help
Creating Procedures and Actions with VBS

369

Examples of VBScript

11.05

14.2 General examples for VBScript

Introduction

Note:
All objects supplied with the Windows Script Host (WSH) from Microsoft can be
integrated in their environment using the standard VBS method CreateObject.
However, there is no direct access to the WSH object itself using VBS from
WinCC.
Example 1: " FileSystemObject " object for working with the file system
Dim fso, MyFile
Set fso = CreateObject( " Scripting.FileSystemObject " )
Set MyFile = fso.CreateTextFile( " c:\testfile.txt " , True)
MyFile.WriteLine( " This is a test. " )
MyFile.Close
Example 2: " WScript.Shell " object for working with the Windows environment

370

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.2.1 Example: Configuring a Database Connection with VBS

Introduction
The following examples describe the configuration of an Access database link via
an ODBC driver.


Example 1 writes a tag value from WinCC in an Access database.



Example 2 reads a value from the database and writes it in a WinCC tag.

The examples do not contain any handling faults.

Procedure, Example 1
1. Create the Access database with the WINCC_DATA table and columns (ID,
TagValue) with the ID as the Auto Value.
2. Set up the ODBC data source with the name " SampleDSN " , reference to the
above Access database.
3. Programming.

Example 1
'VBS108
Dim objConnection
Dim strConnectionString
Dim lngValue
Dim strSQL
Dim objCommand
strConnectionString = " Provider=MSDASQL;DSN=SampleDSN;UID=;PWD=; "
lngValue = HMIRuntime.Tags( " Tag1 " ).Read
strSQL = " INSERT INTO WINCC_DATA (TagValue) VALUES ( " & lngValue & " ); "
Set objConnection = CreateObject( " ADODB.Connection " )
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objCommand = CreateObject( " ADODB.Command " )
With objCommand
.ActiveConnection = objConnection
.CommandText = strSQL
End With
objCommand.Execute
Set objCommand = Nothing
objConnection.Close
Set objConnection = Nothing

Printout of the Online Help
Creating Procedures and Actions with VBS

371

Examples of VBScript

11.05

Procedure, Example 2
1. Create the WinCC tag with the name dbValue.
2. Create Access database with WINCC_DATA table and ID, TagValue columns:
(ID as Auto Value).
3. Set up the ODBC data source with the name " SampleDSN " , reference to the
above Access database.
4. Programming.
Example 2
'VBS108a
Dim objConnection
Dim objCommand
Dim objRecordset
Dim strConnectionString
Dim strSQL
Dim lngValue
Dim lngCount
strConnectionString = " Provider=MSDASQL;DSN=SampleDSN;UID=;PWD=; "
strSQL = " select TagValue from WINCC_DATA where ID = 1 "
Set objConnection = CreateObject( " ADODB.Connection " )
objConnection.ConnectionString = strConnectionString
objConnection.Open
Set objRecordset = CreateObject( " ADODB.Recordset " )
Set objCommand = CreateObject( " ADODB.Command " )
objCommand.ActiveConnection = objConnection
objCommand.CommandText = strSQL
Set objRecordset = objCommand.Execute
lngCount = objRecordset.Fields.Count
If (lngCount & gt; 0) Then
objRecordset.movefirst
lngValue = objRecordset.Fields(0).Value
HMIRuntime.Tags( " dbValue " ).Write lngValue
Else
HMIRuntime.Trace " Selection returned no fields " & vbNewLine
End If
Set objCommand = Nothing
objConnection.Close
Set objRecordset = Nothing
Set objConnection = Nothing

There are several ways in which to define the ConnectionString for the connection
depending on the provider used:
Microsoft OLE DB provider for ODBC
Enables connections to any ODBC data source. The corresponding syntax is:
" [Provider=MSDASQL;]{DSN=name|FileDSN=filename};
[DATABASE=database;]UID=user; PWD=password "
Other Microsoft OLE DB Provider (e.g. MS Jet, MS SQL Server)
It is possible to work without DSN. The corresponding syntax is:
" [Provider=provider;]DRIVER=driver; SERVER=server;
DATABASE=database; UID=user; PWD=password "

372

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.2.2 Example: CCalling Methods of an ActiveX Control

Introduction
The following examples illustrate how to call methods and properties of an ActiveX
control which is embedded in a WinCC picture.

Example 1: MS Form 2.0 Combobox
This example fills a combobox with the name " ComboBox1 " from any point in the
picture.
'VBS109
Dim cboComboBox
Set cboComboBox = ScreenItems( " ComboBox1 " )
cboCombobox.AddItem " 1_ComboBox_Field "
cboComboBox.AddItem " 2_ComboBox_Field "
cboComboBox.AddItem " 3_ComboBox_Field "
cboComboBox.FontBold = True
cboComboBox.FontItalic = True
cboComboBox.ListIndex = 2
Example 2: MS Form 2.0 Listbox
This example fills a list box with the name " ListBox1 " from any point in the picture.
'VBS110
Dim lstListBox
Set lstListBox = ScreenItems( " ListBox1 " )
lstListBox.AddItem " 1_ListBox_Field "
lstListBox.AddItem " 2_ListBox_Field "
lstListBox.AddItem " 3_ListBox_Field "
lstListBox.FontBold = True
Example 3: WinCC Function Trend Control
This example fills the trend control function named " Control1 " with the values which
describe a parabola.
'VBS111
Dim lngFactor
Dim dblAxisX
Dim dblAxisY
Dim objTrendControl
Set objTrendControl = ScreenItems( " Control1 " )
For lngFactor = -100 To 100
dblAxisX = CDbl(lngFactor * 0.02)
dblAxisY = CDbl(dblAxisX * dblAxisX + 2 * dblAxisX + 1)
objTrendControl.DataX = dblAxisX
objTrendControl.DataY = dblAxisY

Printout of the Online Help
Creating Procedures and Actions with VBS

373

Examples of VBScript

11.05

objTrendControl.InsertData = True
Next
Example 4: WinCC Function Trend Control with Values Supplied Via Arrays
In this example, a Function Trend Control called " Control1 " is supplied with 100
value pairs. In order that the value pair can be transferred correctly, the transfer
e.g. in " dblAxisXY " must not occur directly but via an intermediate tag, e.g.
" varTemp " .
'VBS152
Dim lngIndex
Dim dblXY(1)
Dim dblAxisXY(100)
Dim varTemp
Dim objTrendControl
Set objTrendControl = ScreenItems( " Control1 " )
For lngIndex = 0 To 100
dblXY(0) = CDbl(lngIndex * 0.8)
dblXY(1) = CDbl(lngIndex)
dblAxisXY(lngIndex) = dblXY
Next
varTemp = (dblAxisXY)
objTrendControl.DataXY = varTemp
objTrendControl.InsertData = True
Example 5: Microsoft Web Browser
This example controls MS Web Browser.
'VBS112
Dim objWebBrowser
Set objWebBrowser = ScreenItems( " WebControl " )
objWebBrowser.Navigate " http://www.siemens.de "
...
objWebBrowser.GoBack
...
objWebBrowser.GoForward
...
objWebBrowser.Refresh
...
objWebBrowser.GoHome
...
objWebBrowser.GoSearch
...
objWebBrowser.Stop
...
Note:
Insert the instructions, separated by stops, in self-defined procedures. Declaration
and assignments must always precede them.

374

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.2.3 Example: Using the MS Automation interface

Introduction
The following three examples illustrate how to use the MS Automation interface.

Example 1: MS Excel
In this example, an output value from an input field is written in an Excel table.
'VBS113
Dim objExcelApp
Set objExcelApp = CreateObject( " Excel.Application " )
objExcelApp.Visible = True
'
'ExcelExample.xls is to create before executing this procedure.
'Replace & lt; path & gt; with the real path of the file ExcelExample.xls.
objExcelApp.Workbooks.Open " & lt; path & gt; \ExcelExample.xls "
objExcelApp.Cells(4, 3).Value = ScreenItems( " IOField1 " ).OutputValue
objExcelApp.ActiveWorkbook.Save
objExcelApp.Workbooks.Close
objExcelApp.Quit
Set objExcelApp = Nothing
Example 2: MS Access
This example opens a report from MS Access.
'VBS114
Dim objAccessApp
Set objAccessApp = CreateObject( " Access.Application " )
objAccessApp.Visible = True
'
'DbSample.mdb and RPT_WINCC_DATA have to create before executing
'this procedure.
'Replace & lt; path & gt; with the real path of the database DbSample.mdb.
objAccessApp.OpenCurrentDatabase " & lt; path & gt; \DbSample.mdb " , False
objAccessApp.DoCmd.OpenReport " RPT_WINCC_DATA " , 2
objAccessApp.CloseCurrentDatabase
Set objAccessApp = Nothing
Example 3: MS Internet Explorer
This example opens the MS IE.
'VBS115
Dim objIE
Set objIE = CreateObject( " InternetExplorer.Application " )
objIE.Navigate " http://www.siemens.de "
Do

Printout of the Online Help
Creating Procedures and Actions with VBS

375

Examples of VBScript

11.05

Loop While objIE.Busy
objIE.Resizable = True
objIE.Width = 500
objIE.Height = 500
objIE.Left = 0
objIE.Top = 0
objIE.Visible = True

14.2.4 Example: Starting an external application

Introduction
The following two examples illustrate how to start an external application.

Example
'VBS117
Dim objWshShell
Set objWshShell = CreateObject( " Wscript.Shell " )
objWshShell.Run " Notepad Example.txt " , 1

376

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Examples of VBScript

14.2.5 Example: How to Start an Action on the Server (Logging Object)

Introduction
In multi-user projects, the Logging object presently functions on the server only.
The following example shows how to start an action on the server from the client,
and how to swap and delete archive segments on client accordingly.
The example shows a global action started with a control tag. The contents of the
control tag determine whether the " Restore " method or the " Remove " method is
called. At the end of the action, the control tag is set to " 0 " .
A query prevents the action from being started on client computers.
Path and time period are passed on by internal tags.
The path information may also contain a network release. Archive segments to be
swapped must therefore not be stored locally at the server. It must be warranted,
though, that the server may directly access the path.
Note:
The example shows a delete suggestion and may be adjusted as needed.
Procedure
1. In WinCC Explorer, create the following internal tags with project-wide updates:
- StartLogging (Unsigned 8-bit value) - SourcePath (Text tag 8-bit character
set) - TimeFrom (Text tag 8-bit character set) - TimeTo (Text tag 8-bit
character set) - RetVal (Signed 32-bit value)
2. Create a global VBS action and enter the tag StartLogging as tag trigger with
cycle " Upon Change " .
3. Copy the following script into the action
'VBS180
Dim StartLogging
Dim SourcePath
Dim TimeFrom
Dim TimeTo
Dim RetVal
'Exit when running on client
If (Left(HMIRuntime.ActiveProject.Path, 1) = " \ " ) Then
Exit Function
End If
'read parameters
StartLogging = HMIRuntime.Tags( " StartLogging " ).Read
SourcePath = HMIRuntime.Tags( " SourcePath " ).Read(1)
TimeFrom = HMIRuntime.Tags( " TimeFrom " ).Read(1)
TimeTo = HMIRuntime.Tags( " TimeTo " ).Read(1)
'restore or remove depends on the parameter
If (StartLogging = 1) Then
RetVal = HMIRuntime.Logging.Restore(SourcePath, TimeFrom, TimeTo, -1)

Printout of the Online Help
Creating Procedures and Actions with VBS

377

Examples of VBScript

11.05

HMIRuntime.Tags( " RetVal " ).Write RetVal, 1
HMIRuntime.Tags( " StartLogging " ).Write 0,1
Elseif (StartLogging = 2) Then
RetVal = HMIRuntime.Logging.Remove(TimeFrom, TimeTo, -1)
HMIRuntime.Tags( " RetVal " ).Write RetVal, 1
HMIRuntime.Tags( " StartLogging " ).Write 0,1
End If
The action may be started on a client with the following action, for example. Please
note that parameters must be written prior to setting the control tag.
'VBS181
'set parameters
HMIRuntime.Tags( " SourcePath " ).Write " \\client_pc\temp " ,1
HMIRuntime.Tags( " TimeFrom " ).Write " 2004 " ,1
HMIRuntime.Tags( " TimeTo " ).Write " 2004 " ,1
'start action
HMIRuntime.Tags( " StartLogging " ).Write 1,1

Note:
Tags are predominantly written and read in " direct " mode. This will synchronize
the sequences. Since this deals with internal tags, this mode may be used without
any further concerns.

378

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Basic Principles of VBScript

15 Basic Principles of VBScript
Introduction
The most important topics of the Microsoft VBScript Reference are provided below:


VBScript Language Directory



VBScript Tutorium with the most important basic principles



Scripting runtime reference

If a full version of the VBScript Reference is required, it is available under
http://msdn.microsoft.com/library/default.asp?url=/library/enus/script56/html/vtoriVBScript.asp

Printout of the Online Help
Creating Procedures and Actions with VBS

379

Basic Principles of VBScript

380

11.05

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Index

Index

A
Action
" Info " dialog
adding information
clearing errors
configure tag type trigger
configure timer trigger type
create
create new
Crossreference
deleting
edit
Editing
multiple use
protecting with a password
renaming
saving
storage location in WinCC
trigger
Triggering
Activating
global actions in runtime
AlarmLogs
Attributes
GSC diagnosis
GSC Runtime

9, 45
53, 55
53
56
63
61
45
49
45
28
45
50
11
55
69
56
11
57
9
71
71
102
75, 79
75
79

B
Basic principles
VBS
Bookmarks
Deleting in debugger
Setting in Debugger
Skipping to
Breakpoint
delete
set in debugger

379
379
93
93
93
93
92
93
92

C
Change
trigger
Clearing errors
Code
Of a Procedure
printing

66
66
56
34, 50, 97
34
97

Printout of the Online Help
Creating Procedures and Actions with VBS

Code templates for VBS
Computer Properties
runtime tab control
Controls
WinCC Alarm Control
WinCC Digital Analog Clock
Create
action
procedure
Creating
procedures
CrossReference

34
81
81
155
157
157
32, 45, 49
45, 49
32
29
29
13

D
DataLogs
Debugger
activating in WinCC
Automatic Opening
Call Stack
change picture with debug
Command Window
components
delete breakpoints
Deleting Bookmarks
Determining Property Values
Determining Tag Values
executing script commands
Modifying Property Values
Modifying Tag Values
Names of Actions in Script File
Opening Upon Error Message
principles
processing scripts step-by-step
Running Documents
select running script
set breakpoints
Setting Bookmarks
Skipping to Bookmarks
Starting for Global Script
Starting for Graphics Runtime
Structure of Script Files
Declaration
Declaration area
Of an Action
Delete
trigger
Deleting
actions and procedures
Diagnosis
debugger

104
80, 81
81
81
85
83
85
85
93
93
94
94
95
94
94
88
81
83, 91
91
85
90
92
93
93
81
81
86
50
50
28
67
28
80

Index-1

Index

GSC Runtime
76
GSC Runtime attributes
79
inserting GSC Diagnosis window in a
picture
74
inserting GSC Runtime window in a
picture
78
window
74, 76
Diagnostics
73
GSC Diagnostics
74
GSC Diagnostics attributes
75
VBS
73
Digital Analog Clock
157
Digital Clock
157
DXF Control
158

E
Edit
45
Editing
29, 50
Action
50
procedures
29
Editor
17, 22
Global Script
17, 19
toolbars
25
VBS editor in Graphics Designer
17
Editor window
color coding
22
Global Script
22
Error
356
syntax
56
Error types
83
logical error
83
runtime error
83
syntax error
83
Errors
56
Examples in WinCC
359
accessing objects in
Graphics Designer
359
configuring change picture globally 361
configuring change picture
via property
361
configuring diagnostic output
via Trace
362
configuring language changes
360
deactivating runtime
361
defining the color of objects
360
reading tag values
365
Starting Action on the
Server (Logging Object)
377
VBS in WinCC
359
writing object properties
367
writing tag values
363
Examples of VBS
359

Index-2

11.05

F
Function Trend Control

158

G
GCS Runtime
76
attributes
79
General examples
370
calling methods of an
ActiveX control
373
calling the MS Automation interface 375
configuring a database connection
with VBS
371
starting an external application
376
Global Script
17, 19
call
19
deleting actions and procedures
28
structure
19
toolbars
25
working in an editor window
22
Global tags
15
use in VBS
15
Graphic object
property
125
types in VBS
125
WinCC Gauge Control
159
Graphic objects
125
GSC Diagnosis
74
attributes
75
inserting in a picture
74
toolbar
75
GSC Runtime
78
inserting in a picture
78

H
Highlight
HMI Symbol Library 1.3

34, 50
165

I
Information
add to procedure
adding module
adding to action
Insert
GSC Diagnosis
GSC Runtime
Inserting
Intellisense
Item object

38, 53
38
38
53
74
78
74, 78
34, 50
107

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Index

L
Layer object
Lists
DataSet
layers
Logging
Logical error

108
100
105
109
110
83

Objects
AlarmLogs
DataItem
DataLogs
HMIRuntime
Item
layer
Logging
Online Table Control
Online Trend Control

100
102
103
104
106
107
108
110
160
160

M
Methods
Refresh
stop
Microsoft Script Debugger
components
Module
" Info " dialog
adding information
create
editing
name
protect with a password
rename
save

343
352
80
85
5, 29, 32, 43
38, 40
38
32
29
29
40
43
41

N
Names
of actions in VBScript files
New
action
procedure

88
88
32, 49
49
32

O
Object
Object model
lists

methods
objects
properties
Object names
Determining in Runtime
Object types
Controls
customized object
group
ScreenItem
smart objects
standard objects
Windows objects

88
99
100
335, 356
100
167

Printout of the Online Help
Creating Procedures and Actions with VBS

88
125
155
165
166
125
137
125
149

P
Password
assign for action
for a module
for a procedure
Printing
VBScript
Procedure
" Info " dialog
adding information
create new
creating
deleting
editing
Modifying
multiple use
name
project procedure
rename
save
standard procedure
storage location WinCC
writing codes
Procedures
protect with a password
Project
Project procedure
use
Properties in VBS
AccessPath
activate
Actualize
ActualPointLeft
ActualPointTop
AdaptPicture
AdaptSize
AlarmHigh
AlarmLow
alignment
AlignmentTop
AllowPersistence
AllServer

40, 55
55
40
40
97
97
5
38, 40
38
32
29
28
29
34
11
29
37
43
41
37
11
34
40
119
37
37
167
167
168
169
170
170
170
171
171
172
172
172
173, 190
173

Index-3

Index

Analog
AngleAlpha
AngleBeta
AngleMax
AngleMin
application
archive
assignments
AssumeOnFull
AutoRange
AutoRangeX
AutoRangeY
AutoScroll
AutoSize
average
axe
AxisSection
BackBorderWidth
BackColor
BackColor2
BackColor3
BackColorBottom
BackColorTop
BackFlashColorOff
BackFlashColorOn
Background
BackgroundPicture
BackStyle
BarBackColor
BarDepth
BarFillColor
BarHeight
BarWidth
BasePicReferenced
BasePicTransColor
BasePicture
BasePicUseTransColor
BaseScreenName
BaseX
BaseY
BeginTime
BeginValue
BeginX
BeginY
BevelColorDown
BevelColorUp
BevelInner
BevelOuter
BevelWidth
BitNumber
BlinkColor
BlinkMode
BlinkSpeed
BorderBackColor
BorderColor

Index-4

11.05

173
173
173
174
174
174
174
175
175
175
176
176
176
177
177
177
177
178
178
179
179
179
179
179
180
180
180
180
181
181
182
182
182
182
182
183
183
183
184
184
184
184
185
185
185
185
186
186
186
187
187
187
187
188
188

BorderColorBottom
BorderColorTop
BorderEndStyle
BorderFlashColorOff
BorderFlashColorOn
BorderStyle
BorderWidth
BottomConnectedConnection
PointIndex
BottomConnectedObjectName
BoxAlignment
BoxType
Button1Width
Button2Width
Button3Width
Button4Width
ButtonColor
Caption
CaptionColor
CaptionFont
CaptionOffset
CaptionText
CellCut
CenterColor
CenterScale
CheckAlarmHigh
CheckAlarmLow
CheckLimitHigh4
CheckLimitHigh5
CheckLimitLow4
CheckLimitLow5
CheckToleranceHigh
CheckToleranceLow
CheckWarningHigh
CheckWarningLow
ClearOnError
ClearOnNew
Closeable
CloseButton
CoarseGrid
CoarseGridValue
CoarseGridValueX
CoarseGridValueY
CoarseGridX
CoarseGridY
CollectValue
ColMove
Color
ColorAlarmHigh
ColorAlarmLow
ColorBottom
ColorChangeType
ColorLimitHigh4
ColorLimitHigh5
ColorLimitLow4

188
188
188
189
189
189
189
190
190
190
191
192
192
192
193
191
193
193
193
194
194
194
194
195
195
195
195
196
196
196
196
197
197
197
197
198
198
198
198
199
199
199
198
199
200
200
200
200
200
201
201
201
201
202

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Index

ColorLimitLow5
202
ColorToleranceHigh
202
ColorToleranceLow
202
ColorTop
203
ColorWarningHigh
203
ColorWarningLow
203
ColTitle
203
ColWidth
204
Command
204
CommonTime
204
CommonX
204
CommonY
205
ContinousChange
205
CurrentContext
206
Cursor
206
CursorControl
206
CurveForm
207
Danger
207
DangerColor
207
DataFormat
208
DataIndex
208
DataX
208
DataXY
209
DataY
209
DeleteData
209
Delta
210
DesiredCurveColor
210
DesiredCurveCurveForm
210
DesiredCurveNumberOfUAValues 210
DesiredCurveSourceUAArchive
211
DesiredCurveSourceUAArchiveStartID
211
DesiredCurveSourceUAColumnX
211
DesiredCurveSourceUAColumnY
211
DesiredCurveVisible
212
Direction
212
DXFFilename
212
Edit
213
Editable
213
Enabled
213
EndAngle
214
EndTime
214
EndValue
214
EndX
215
EndY
215
ErrorDescription
215
Exponent
216
ExtendedOperation
216
FillColor
217
Filling
218
FillingIndex
218
FillStyle
218
FillStyle2
219
FineGrid
219
FineGridValue
219

Printout of the Online Help
Creating Procedures and Actions with VBS

FineGridValueX
FineGridValueY
FineGridX
FineGridY
FlashBackColor
FlashBorderColor
FlashFlashPicture
FlashForeColor
FlashPicReferenced
FlashPicTransColor
FlashPicture
FlashPicUseTransColor
FlashRate
FlashRateBackColor
FlashRateBorderColor
FlashRateFlashPic
FlashRateForeColor
Flip
FocusColor
FocusRect
FocusWidth
Font
FontBold
FontItalic
FontName
FontPosition
FontSize
FontStrikeThru
FontUnderline
ForeColor
ForeFlashColorOff
ForeFlashColorOn
FrameColor
FrameColorDown
FrameColorUp
FramePicture
FrameScale
FrameWidth
FreezeProviderConnections
GraphDirection
GridLineHorz
GridLines
GridLinesValueX
GridLinesValueY
GridLinesX
GridLinesY
GridLineValue
GridLineVert
HandFillColor
Handtype
Height
HiddenInput
Hotkey
HourNeedleHeight
HourNeedleWidth

220
220
220
220
220
221
221
221
221
221
222
222
222
222
223
223
223
224
224
224
224
225
225
225
226
226
226
226
226
227
227
227
227
227
228
228
228
228
229
229
229
230
230
230
231
231
230
230
231
231
232
232
233
233
233

Index-5

Index

Hysteresis
HysteresisRange
Index
InnerBevelOffset
InnerBevelStyle
InnerBevelWidth
InsertData
ItemBorderBackColor
ItemBorderColor
ItemBorderStyle
ItemBorderWidth
ItemVisible
Label
LabelColor
LabelX
LabelY
Language
LanguageSwitch
LastError
Layer
Layer00Checked
Layer00Color
Layer00Value
Layer01Checked
Layer01Color
Layer01Value
Layer02Checked
Layer02Color
Layer02Value
Layer03Checked
Layer03Color
Layer03Value
Layer04Checked
Layer04Color
Layer04Value
Layer05Checked
Layer05Color
Layer05Value
Layer06Checked
Layer06Color
Layer06Value
Layer07Checked
Layer07Color
Layer07Value
Layer08Checked
Layer08Color
Layer08Value
Layer09Checked
Layer09Color
Layer09Value
Layer10Checked
Layer10Color
Layer10Value
Left
LeftComma

Index-6

11.05

233
234
234
234
235
235
235
235
236
236
236
236
237
237
237
237
238
238
238
240
241
243
246
241
244
246
241
244
247
241
244
247
242
244
247
242
245
247
242
245
248
242
245
248
243
245
248
243
246
248
243
246
249
250
250

LightEffect
LimitHigh4
LimitHigh5
LimitLow4
LimitLow5
LimitMax
LimitMin
LineFont
LineTitle
ListType
LoadDataImmediately
LocaleID
LockBackColor
LockStatus
LockText
LockTextColor
LongStrokesBold
LongStrokesOnly
LongStrokesSize
LongStrokesTextEach
LowerLimit
LowerLimitColor
LowerLimitValue
Marker
Max
MaximizeButton
MCGUBackColorOff
MCGUBackColorOn
MCGUBackFlash
MCGUTextColorOff
MCGUTextColorOn
MCGUTextFlash
MCKOBackColorOff
MCKOBackColorOn
MCKOBackFlash
MCKOTextColorOff
MCKOTextColorOn
MCKOTextFlash
MCKQBackColorOff
MCKQBackColorOn
MCKQBackFlash
MCKQTextColorOff
MCKQTextColorOn
MCKQTextFlash
MCText
MeasurePoints
MessageClass
Min
MinuteNeedleHeight
MinuteNeedleWidth
Movable
MsgCtrlFlags
MsgFilterSQL
NeedleColor
NormalColor

250
251
251
251
251
252
252
252
253
253
253
254
254
254
254
255
255
255
255
256
256
256
257
257
257
257
258
258
258
258
258
259
259
259
259
259
260
260
260
260
260
261
261
261
261
261
262
262
262
262
263
263
263
264
264

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Index

NumberLines
NumItems
Object
ObjectName
Online
OnTop
Orientation
OuterBevelStyle
OuterBevelWidth
Outline
OutputFormat
OutputValue
PasswordLevel
PersistentRT
PersistentRTCS
PicDeactReferenced
PicDeactTransparent
PicDeactUseTransColor
PicDownReferenced
PicDownTransparent
PicDownUseTransColor
PicReferenced
PicTransColor
Picture
PictureBack
PictureDeactivated
PictureDown
PictureName
PictureSelected
PictureThumb
PictureUnselected
PictureUp
PicUpReferenced
PicUpTransparent
PicUpUseTransColor
PicUseTransColor
PointCount
Position
Precisions
PrecisionX
PrecisionY
PredefinedAngles
Pressed
PrintJob
Process
ProjectPath
ProviderClsID
ProviderType
Radius
RadiusHeigth
RadiusWidth
RangeMax
RangeMin
Rectangular
ReferenceRotationLeft

Printout of the Online Help
Creating Procedures and Actions with VBS

265
265
265
266
269
269
270
270
271
271
271
271
273
274
274
275
275
275
276
276
276
276
277
277
277
277
278
278
278
279
279
278
279
279
279
280
283
280
280
280
281
281
281
281
282
282
282
282
284
284
284
284
284
285
285

ReferenceRotationTop
RelayCurves
Relevant
Replacement
ReplacementColor
RightComma
Rotation
RotationAngle
RoundCornerHeight
RoundCornerWidth
RulerPrecisions
RulerPrecisionX
RulerPrecisionY
SameSize
ScaleColor
ScaleTicks
Scaling
ScalingTypeX
ScalingTypeY
Screen
ScreenName
Scrollable
ScrollBars
SecondNeedleHeight
SecondNeedleWidth
SelBGColor
SelectionMode
SelTextColor
ServerData
ServerNames
ServerPrefix
ShowBar
ShowDanger
ShowDecimalPoint
ShowNormal
ShowPeak
ShowPosition
ShowRulerImmediately
ShowThumb
ShowValuesExponentialX
ShowValuesExponentialY
ShowWarning
SignificantMask
Sizeable
SmallChange
SourceBeginTime
SourceEndTime
SourceNumberOfUAValues
SourceNumberOfValues
SourceTagNameX
SourceTagNameY
SourceTagProviderDataX
SourceTagProviderDataY
SourceTimeRange
SourceUAArchive

285
285
286
286
286
286
287
287
287
287
288
288
288
288
289
289
289
290
290
290
291
292
292
293
293
294
294
295
295
296
295
296
296
296
297
297
297
297
298
298
298
298
299
299
299
299
300
300
300
301
301
301
301
302
302

Index-7

Index

SourceUAArchiveStartID
302
SourceUAColumnX
303
SourceUAColumnY
303
SquareExtent
303
StartAngle
303
Statusbar
304
StatusbarPanes
304
StatusbarStretch
304
TagName
304
TagPrefix
305
TagProviderClsid
305
Text
306
ThumbBackColor
307
TicColor
307
TicFont
307
Ticks
309
TicksColor
309
TickStyle
309
TicOffset
307
TicTextColor
308
TicTextOffset
308
TicWidth
308
TimeAxis
309
TimeAxisFormat
310
TimeAxisX
310
TimeColumnAlignment
310
TimeFormat
311
TimeJump
311
TimeJumpColor
311
TimeOverlap
312
TimeOverlapColor
312
TimeRange
312
TimeRangeBase
313
TimeRangeFactor
313
TimeStamp
313
TimeZone
314
TitleCut
315
Titleline
315
Toggle
315
ToleranceHigh
315
ToleranceLow
316
Toolbar
317
ToolbarAlignment
316
ToolbarHotKeys
317
ToolTipText
317
Top
318
TopConnectedConnectionPointIndex 319
TopConnectedObjectName
319
Transparent
319
Trend
319
TrendColor
320
Type
320
TypeAlarmHigh
321
TypeAlarmLow
322
TypeLimitHigh4
322

Index-8

11.05

TypeLimitHigh5
TypeLimitLow4
TypeLimitLow5
TypeToleranceHigh
TypeToleranceLow
TypeWarningHigh
TypeWarningLow
UnitColor
UnitFont
UnitOffset
UnitText
UnselBGColor
UnselTextColor
UpdateCycle
UpperLimit
UpperLimitColor
UpperLimitValue
UserValue1
UserValue2
UserValue3
UserValue4
ValueColumnAlignment
ValueMax
ValueMin
Variable
Visible
Warning
WarningColor
WarningHigh
WarningLow
Width
WindowBorder
WindowsStyle
WithAxes
WithLabels
ZeroPoint
ZeroPointValue
Zoom
Zoomable
Properties VBS
AdaptBorder
Prperties in VBS
AlignmentLeft
Push Button Control

322
322
323
323
323
323
324
324
324
325
325
325
325
327
327
327
327
326
326
326
326
328
329
329
329
330
330
330
331
331
331
332
332
333
333
333
333
334
334
170
172
161

R
Rename
action
module
procedure
Runtime
activating global actions
Runtime error

43, 69
69
43
43
71
71
83

Printout of the Online Help
Creating Procedures and Actions with VBS

11.05

Index

S
Save
41, 56
action
56
module
41
procedure
41
Screen
115
ScreenItem
111
3D bar
137
application window
139
bar
139
Button
149
check box
150
circle
127
circular arc
127
connector
135
Control
141
customized object
165
Ellipse
125
ellipse arc
126
ellipse segment
126
graphic object
144
group
166
group display
147
HMI Symbol Library 1.3
165
I/O field
144
line
129
object types
125, 137, 149, 155
OLE object
145
Option Group
151
picture window
141
pie segment
128
Polygon
129
Polygon Line
130
rectangle
131
round button
152
Rounded Rectangle
133
WinCC Alarm Control
157
WinCC Digital Analog Clock
157
WinCC DXF Control
158
WinCC Function Trend Control
158
WinCC Gauge Control
159
WinCC Online Table Control
160
WinCC Online Trend Control
160
WinCC Push Button Control
161
WinCC Slider Control
163
ScreenItems Object (List)
114
Screens Object (List)
117
Script
86
Script file
names of actions
88
open in debugger
90
permitted action name lengths
88
Setting Bookmarks
93
Script file of VBScripts
86

Printout of the Online Help
Creating Procedures and Actions with VBS

Slider
Slider Control
Smart objects
3D bar
application window
bar
control
graphic object
group display
I/O field
OLE object
picture window
status display
text list
Standard objects
circle
circular arc
connector
ellipse
ellipse arc
ellipse segment
line
pie segment
polygon
Polygon Line
rectangle
Rounded Rectangle
static text
Standard procedure
use
Static text
Status
Symbol Library
Syntax
check
error
Syntax error

152
163
137
137
139
139
141
144
147
144
145
141
148
147
125
127
127
135
125
126
126
129
128
129
130
131
133
134
37
37
134
148
165
56
56
56
83

T
Tag
15, 63, 120
configure trigger for an action
63
Tags
global in VBS
15
Tags Object (List)
122, 124
Testing
80
with debugger
80
Text
147
Timer
61
configure trigger for an action
61
Toolbar
75
GSC Diagnosis
75
Toolbars
25
Trigger
57

Index-9

Index

add tag type trigger
add timer type
change
Crossreference
cyclic
delete
event-driven
linking
tag
Timer

11.05

63
61
66
57
57
67
57
57
57
57

WinCC Gauge Control
WinCC Online Table Control
WinCC Online Trend Control
WinCC Push Button Control
WinCC Slider Control
Windows objects
button
check box
Option Group
round button
slider

159
160
160
161
163
149
149
150
151
152
152

V
VBS
action
basic principles
CrossReference
diagnostic
editors
examples
Global Script
lists

1, 5
9
379
13
73
17
359
19
100

methods
335, 356
module
5
object model
99
object types
125
objects
100
procedure
5
properties
167
reference
99
standard functions
34
target group of the documentation
1
user scenarios
1
using global tags
15
VBScript
71, 86
activate in runtime
71
debug
80
open in debugger
90
printing
97
VBScript files
structure
86
Visual Basic Script in WinCC
1
W
WinCC
graphic object types
script languages
Visual Basic Script
WinCC Alarm Control
WinCC Digital Analog Clock
WinCC DXF Control
WinCC Function Trend Control

Index-10

1
125
1
1
157
157
158
158

Printout of the Online Help
Creating Procedures and Actions with VBS