Назад
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-09-14","2004-09-20",-1) & vbNewLine
See also
Error Messages from Database Area (Page 732)
DataLogs Object (Page 121)
AlarmLogs Object (Page 118)
Restore Method (Page 708)
Remove Method (Page 703)
DataLogs Property (Page 351)
AlarmLogs Property (Page 283)
1.14.2.13 ProcessValue Object
Description
The ProcessValue object is used to access the ProcessValues object list.
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
131
Note
Only the 10 predefined ProcessValues are supported.
See also
ProcessValues Object (List) (Page 132)
1.14.2.14 ProcessValues Object (List)
Description
Usage
Using the "ProcessValues" list, you can:
Edit a ProcessValue from the list ("Item" method)
Display or edit all the objects in the list (_NewEnum attribute)
Count all ProcessValues contained in the list (Count property)
Read or set the values of the ProcessValue object (Value property)
The properties represent default properties and methods of a list and are not described in detail
in the WinCC documentation.
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
132
System Manual, 11/2008,
See also
Alarms object (list) (Page 116)
ProcessValue Object (Page 131)
Count Property (Page 346)
Value Property (Page 610)
Item Method (Page 687)
1.14.2.15 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).
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
133
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
See also
ActiveProject Property (Page 278)
Name Property (Page 452)
Path Property (Page 473)
1.14.2.16 ScreenItem Object
Description
The ScreenItem object returns the result of access to the ScreenItem list.
Parent Object
Picture containing the picture element.
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
134
System Manual, 11/2008,
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 and define a layer in which a graphic object is located ("Layer" property).
Read 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
Tube objects Controls Others
Ellipse 3D bar Button Double T-
piece
Siemens HMI
Symbol Library
Customized
object
Ellipse arc Application
window
Check box Polygon
tube
WinCC
AlarmControl
Group
Ellipse
segment
Bar Radio box Tube bend WinCC digital/
analog clock
control
Circle Picture
window
Round button T-piece WinCC
FunctionTrendCon
trol
Circular arc Control Slider WinCC gauge
control
Pie segment I/O field WinCC
OnlineTrendContr
ol
Line Faceplate
Instance
WinCC
OnlineTableContr
ol
Polygon Graphic
object
WinCC push
button control
Polyline Combo box WinCC
RulerControl
Rectangle List box WinCC slider
control
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
135
Standard
objects
Smart objects Windows
objects
Tube objects Controls Others
Rounded
rectangle
Multiple row
text
WinCC
UserArchiveContr
ol
Connector OLE object
Group display
Text list
Status display
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:
When a specific object type is addressed, certain further properties are added to the standard
properties:
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
136
System Manual, 11/2008,
The additional properties are indicated in the descriptions of the individual object types.
Example
In the following example, the radius of a circle is set to 2 in Runtime per mouse click:
Sub OnClick(ByVal Item)
'VBS5
Dim objCircle
Set objCircle= ScreenItems("Circle1")
objCircle.Radius = 2
End Sub
See also
Width Property (Page 626)
Visible Property (Page 624)
Type Property (Page 596)
Top Property (Page 575)
Parent Property (Page 471)
Left Property (Page 423)
Layer Property (Page 408)
Height Property (Page 391)
Enabled Property (Page 360)
Activate Method (Page 639)
Example: How to Read Tag Values (Page 741)
Example: Writing tag values (Page 739)
Properties (Page 276)
Objects and Lists (Page 113)
Object Types of the ScreenItem Object (Page 152)
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
137
1.14.2.17 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.
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
138
System Manual, 11/2008,
Example:
'Control1 is an embedded ActiveX-Control with property "type"
'VBS196
Dim Control
Set Control=ScreenItems("Control1")
Control.object.type
'Control1 is a WinCC-Control
'VBS197
Dim Control
Set Control=ScreenItems("Control1")
Control.type
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
See also
Count Property (Page 346)
Example: How to Read Tag Values (Page 741)
Example: Writing tag values (Page 739)
ScreenItem Object (Page 134)
Parent Property (Page 471)
Item Method (Page 687)
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
System Manual, 11/2008,
139
1.14.2.18 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.
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).
VBS for Creating Procedures and Actions
1.14 VBS Reference
MDM - WinCC: Scripting (VBS, ANSI-C, VBA)
140
System Manual, 11/2008,