Problem Overview
In a Siemens WinCC V7.5 picture (PDL) that contains a Static Text object, configuring a dynamic tooltip that reads the configured documentation comment of a process tag fails with the following diagnostic output in the Global Script diagnostic window (GDI):
Microsoft VBScript runtime error
Picture : BOILER7.pdl_Triggers
Function : Function StaticX0020Text59_ToolTipText_Trigger(ByVal Item)
Line : 6
Error : Object doesn't support this property or method: 'HMIRuntime'
Two distinct authoring patterns raise the same error:
- A picture-level
ToolTipText_Triggerfunction that addresses the static object throughHMIRuntime.ActiveScreen.ScreenItems.Item("Static Text58"). - A per-object property trigger auto-generated by WinCC (named
StaticX0020Text59_ToolTipText_Trigger) where the developer has pasted picture-level code without removing theHMIRuntime.ActiveScreen.ScreenItems.Item(...)indirection.
Both patterns fail because the script engine resolves the bare identifier HMIRuntime against the wrong scope. This article documents the WinCC V7.5 SP2 VBScript object model that governs the two patterns, the exact corrected code for each, and the engineering checklist that prevents the error from recurring across large picture libraries.
Root Cause: Trigger Function Scoping
WinCC V7.5 generates per-object trigger functions under two naming conventions, and the rules for addressing runtime objects differ between them.
-
Picture-level trigger — a function named
PictureName_Triggersthat you author yourself. It receives no implicit object reference. Inside the function you must address the runtime object model through the globalHMIRuntimeroot. -
Object-level property or event trigger — a function named
ObjectName_PropertyName_Trigger(for example,StaticX0020Text59_ToolTipText_Trigger) that the runtime calls on every value change of the bound property. TheItemparameter is the HMI runtime object instance of the triggering object itself.
The error is reproducible when code written for a picture-level trigger is copied into an object-level trigger without removing the HMIRuntime.ActiveScreen.ScreenItems.Item(...) indirection. Inside the per-object callback, line 6 dereferences the HMIRuntime identifier, but the VBScript engine has already bound the Item reference to the current object. The dot-member access pattern that Visual Basic mandates for every member lookup is described in the Microsoft Learn reference on Objects and Classes in Visual Basic; the Microsoft Learn reference on Determining Object Type documents the TypeName() and TypeOf ... Is operators that should be used to confirm the type of a runtime variable before its members are dereferenced.
| Pattern | Result at Runtime | Cause |
|---|---|---|
HMIRuntime.Tags("B7_AirFlow") in a picture-level trigger |
Works |
HMIRuntime is the global runtime root and is bound |
HMIRuntime.ActiveScreen.ScreenItems.Item("Static Text58") in an object-level trigger |
"Object doesn't support this property or method: 'HMIRuntime'" | Global root not in scope; Item is the bound object |
HMIRuntime("B7_AirFlow").Comment |
Silent failure or unexpected value | No default property exposed on HMIRuntime; use the .Tags() collection explicitly |
Item.TooltipText = HMIRuntime.Tags("B7_AirFlow").Comment |
Works |
Item is the bound object; .Tags() is the explicit tag collection |
Corrected Code: Per-Object ToolTipText Trigger
For an object-level property trigger on a Static Text object named "Static Text59" in picture BOILER7.pdl, the auto-generated function name is StaticX0020Text59_ToolTipText_Trigger. The Item parameter already references the object instance, so the body is a single line:
Function StaticX0020Text59_ToolTipText_Trigger(ByVal Item)
Item.TooltipText = HMIRuntime.Tags("B7_AirFlow").Comment
End Function
Engineering notes for this implementation:
-
Itemis of typeIHMIStaticText, the WinCC runtime wrapper for a static text. AllHMIObjectbase-class members are reachable, includingTooltipText,BackColor,ForeColor,FontName,Layer,Left,Top,Width, andHeight. -
HMIRuntime.Tags("B7_AirFlow")returns anIHMITagobject. Reading the.Commentproperty returns the multi-language comment string configured in the tag's Properties > Comment field. -
TooltipTextaccepts a Variant containing a String. For a multi-line tooltip, embedvbCrLfin the comment field or assemble the string withChr(13) & Chr(10)in the trigger body. - VBScript is case-insensitive for identifiers, but the canonical WinCC casing
TooltipText,Comment, andHMIRuntimeis used throughout the Siemens V7.5 SP2 reference. - The trigger fires according to the configured trigger of the ToolTipText property (default "On Change"). Avoid setting the trigger to a 250 ms cyclic cycle unless the tooltip is genuinely time-varying.
WinCC VBScript Object Name Encoding
WinCC generates per-object trigger function names by replacing every character in the picture-designer object name that is illegal in a VBScript identifier with its four-digit hexadecimal Unicode escape preceded by X. The space character (U+0020) is encoded as X0020. The most common encodings encountered in stock WinCC pictures are:
| Designer Name | VBScript Function Suffix | Notes |
|---|---|---|
| Static Text58 | StaticX0020Text58 | Standard HMI Static Text |
| I/O Field1 | IOX0020Field1 | Forward slash and space both encoded |
| Bar Graph1 | BarX0020Graph1 | Space encoded |
| Status Display1 | StatusX0020Display1 | Space encoded |
| Button1 | Button1 | Single token, no encoding required |
| Group1.Sub2 | Group1.Sub2 | Dot is valid in VBScript identifiers |
| Combo Box1 | ComboX0020Box1 | Space encoded |
| Text List1 | TextX0020List1 | Space encoded |
The escape sequence is always uppercase and always four hex digits, matching the VBScript ChrW() semantics. The complete runtime mapping is the responsibility of the WinCC Graphics Designer; the application developer does not encode names manually but must know the encoding to address per-object triggers.
The HMIRuntime Object Model
Inside a WinCC V7.5 picture trigger (picture-level or object-level) the following runtime objects are reachable from the global HMIRuntime root:
| Path | Type | Returns |
|---|---|---|
| HMIRuntime | IHMIApplication | Runtime root, lives in the Global scope of the picture |
| HMIRuntime.Tags("Name") | IHMITags collection | Tag object addressed by name (String) or by 1-based index (Long) |
| HMIRuntime.ActiveScreen | IHMIScreen | The currently displayed picture |
| HMIRuntime.ActiveScreen.ScreenItems | IHMIScreenItems | Collection of every HMI object in the active picture |
| HMIRuntime.ActiveScreen.ScreenItems.Item("Name") | IHMIObject | Named object; concrete type depends on the underlying control |
| HMIRuntime.BaseScreenName | String (read-only) | Base picture name (without the navigation suffix) |
| HMIRuntime.ProjectName | String (read-only) | WinCC project file name (read-only) |
| HMIRuntime.RuntimeMode | Boolean | True while the runtime is active; useful for gating test code |
Standard property assignment uses the VBScript Set statement for object references and direct assignment for value types. The dot-member access rule is the same pattern that the Microsoft Learn reference on Objects and Classes in Visual Basic documents. TypeName(Item) (from the Determining Object Type reference) is the safest way to confirm the runtime type of a variable before member access.
Reading the Tag Comment Property
Every WinCC tag exposes the configured documentation string through the IHMITag.Comment property. The string is set in the tag editor under Properties > Comment and is one of the values exported by the project documentation tool. The supported read pattern is:
Dim sComment
sComment = HMIRuntime.Tags("B7_AirFlow")
' sComment is a Variant containing the String value of the comment
Performance characteristics of reading Comment in a high-frequency trigger:
-
.Commentis a static configuration string (not a polled value). It is read once per trigger evaluation and is not subject to the WinCC acquisition cycle. - Trigger frequency is governed by the configured trigger of the bound property. For a ToolTipText trigger the default trigger is "On Change"; the body is evaluated only when the underlying trigger fires (typically on tag value change for connected objects, or on picture open for the ToolTipText itself).
- Do not place a heavy loop in the trigger body. VBScript triggers in WinCC are single-threaded; a slow body will delay the runtime scheduler and freeze the picture.
- Reading
Commentdoes not register a subscription, does not increment the tag's update counter, and does not appear in the tag logging statistics.
If the comment string contains placeholders such as %s or {VALUE}, perform the substitution with the VBScript Replace() function before assigning the result to Item.TooltipText:
Dim sTpl, sValue
sTpl = HMIRuntime.Tags("B7_AirFlow")
sValue = CStr(HMIRuntime.Tags("B7_AirFlow").Read)
Item.TooltipText = Replace(sTpl, "{VALUE}", sValue)
Alternatives: Picture-Level Trigger
When the same tooltip must be assigned to many objects, write a picture-level trigger instead of a per-object trigger. The function name is PictureName_Triggers (for the BOILER7 picture: BOILER7_Triggers), and the body uses the HMIRuntime.ActiveScreen.ScreenItems collection directly:
Function BOILER7_Triggers(ByVal Item)
Dim objText, tagComment
Set objText = HMIRuntime.ActiveScreen.ScreenItems.Item("Static Text58")
tagComment = HMIRuntime.Tags("B7_AirFlow")
objText.TooltipText = tagComment
End Function
This pattern works because HMIRuntime is a globally available identifier inside the picture-level trigger scope, and the Item parameter is the trigger-callback handle (it can be ignored). The picture-level trigger fires on the configured trigger condition of the picture; configure it to "On Change" of the source tag for the lowest CPU cost.
Generating Triggers Programmatically
For large pictures with dozens of Static Text objects that should each reflect a tag comment, manual per-object triggers do not scale. A common pattern is a single picture-level trigger that iterates ScreenItems by name prefix and assigns the tooltip by a naming convention such as Tag_<index>:
Sub AssignTagCommentsAsTooltips()
Dim objItem, sName
For Each objItem In HMIRuntime.ActiveScreen.ScreenItems
sName = objItem.ObjectName
If Left(sName, 11) = "Static Text" Then
objItem.TooltipText = _
HMIRuntime.Tags("Tag_" & Mid(sName, 12)).Comment
End If
Next
End Sub
Call the routine once on picture open by binding it to the picture's OpenPicture event trigger. The ObjectName property returns the designer-time name; use it as the lookup key, not the Name property (which is the internal alias and can differ). For runtime type checking, gate the assignment with the TypeName() function as recommended by the VB object-type determination reference:
For Each objItem In HMIRuntime.ActiveScreen.ScreenItems
If TypeName(objItem) = "HMIStaticText" Then
objItem.TooltipText = HMIRuntime.Tags("B7_AirFlow")
End If
Next
Note: TypeOf objItem Is IHMIStaticText is not directly available in WinCC VBScript because the COM type library does not expose runtime type identifiers in the query-able form. Use the TypeName() string comparison or the object name prefix instead.
Verification Procedure
- In the WinCC Explorer, open Graphics Designer and load
BOILER7.pdl. - Select the Static Text object ("Static Text59") and open Properties > Events > ToolTipText.
- Confirm the trigger function name is
StaticX0020Text59_ToolTipText_Triggerand the body contains onlyItem.TooltipText = HMIRuntime.Tags("B7_AirFlow").Comment. - Save the picture, then save and rebuild the project. The runtime loads the updated PDL on the next picture change.
- Activate the runtime. Open Global Script > Diagnostics (GDI window) and confirm no runtime error is logged for the function.
- Hover the mouse over the Static Text. The configured tag comment should appear in the tooltip after the configured tooltip delay (default 400 ms in WinCC V7.5 SP2; configurable per object under Properties > Miscellaneous > ToolTipDelay).
- If the tooltip is blank, check the tag's Properties > Comment field in Tag Management — the field must be non-empty. A blank comment produces a blank tooltip without raising an error.
- If the tooltip shows a literal string such as "B7_AirFlow", the trigger is reading the tag name rather than the comment. Inspect the property:
HMIRuntime.Tags("B7_AirFlow").Commentin a one-shot test action to confirm the comment is populated.
Troubleshooting Matrix
| Symptom | Likely Cause | Fix |
|---|---|---|
| "Object doesn't support this property or method: 'HMIRuntime'" on line 6 | Per-object trigger uses HMIRuntime.ActiveScreen.ScreenItems path that is not bound in this scope |
Use the Item parameter directly: Item.TooltipText = HMIRuntime.Tags("...")
|
| Tooltip is empty at runtime | Tag has no configured Comment string | Open Tag Management, set Properties > Comment to the desired text |
| Tooltip shows the literal string "B7_AirFlow" | Comment field has the wrong property; .Comment not being read |
Inspect the property in GDI diagnostics; ensure the trigger references .Comment not .Name
|
| "Object required: 'Item'" | Object-level trigger called without the Item argument signature |
Always declare ByVal Item as the first parameter; do not call the trigger manually from user code |
| Function name not auto-generated | Object renamed after trigger was first created | Re-author the trigger; WinCC re-creates the function name on the next event binding |
"Subscript out of range" on ScreenItems.Item("Static Text58")
|
Object name in code does not match the designer name (case-sensitive) | Match the name exactly; for a designer name with a space, use the literal space "Static Text58"
|
| Trigger fires but tooltip flickers on every tag update | Trigger configured to a 250 ms cyclic cycle of the value tag, not "On Change" of ToolTipText | Bind the trigger to ToolTipText directly with a default "On Change" trigger; the value tag's acquisition cycle should not drive the tooltip |
| "Wrong number of arguments" on Item.TooltipText |
TooltipText is treated as a parameterized read instead of a property |
Use direct property assignment syntax (no parentheses around the right-hand side) |
Performance and Engineering Notes
- The
Itemparameter in a per-object trigger is the same runtime object that Graphics Designer instantiates. Reusing it (rather than callingScreenItems.Item(...)again) is the documented hot-path pattern in the WinCC V7.5 SP2 VBScript reference; it saves a dictionary lookup per trigger evaluation. - For very large pictures (more than 200 screen items) avoid iterating
ScreenItemsin a trigger that fires frequently. Cache the lookup in a project module-level dictionary if you must address many objects by name. - Tooltip update latency in WinCC V7.5 SP2 is governed by the mouse-hover delay (default 400 ms, configurable per object) plus one VBScript scheduling tick. This is acceptable for human-in-the-loop HMI use cases; do not rely on it for control-loop feedback.
- When the comment string contains characters outside the Windows-1252 range, the WinCC runtime reads
Commentas a Unicode string. The tooltip rendering supports Unicode out of the box; no codepage conversion is required. - If a tag name is renamed, every per-object trigger that referenced that tag will fail to find the tag at runtime. WinCC does not automatically re-link; perform a project-wide search for the old tag name in Global Script before renaming.
- For multi-language projects,
Commentreturns the string in the currently active runtime language. No additional translation API is required; the runtime switches the comment based on the configured user language. - The WinCC V7.5 SP2 VBScript model is identical in WinCC V7.0, V7.3, V7.4, V7.4 SP1, V7.5, and V7.5 SP2. WinCC V8 (TIA-based WinCC Unified) replaces the VBScript model with a JavaScript runtime and exposes a different browser-style event API; the patterns in this article do not apply directly to Unified.
Diagnostic Window: Reading the Stack Trace
The Global Script diagnostics window (GDI) is the only place where the runtime error is logged. The trace line indicates the picture, the function name, the line offset, and the message. When the function name is encoded, the trace also shows the encoded form (for example, StaticX0020Text59_ToolTipText_Trigger), which makes it possible to map the error back to the designer object name. The GDI window retains the last 200 messages; older messages roll off the buffer. To preserve a trace for post-mortem analysis, enable the WinCC Diagnostic Server (Start > Programs > Siemens Automation > WinCC > Tools > WinCC Diagnostic Server) and export the trace to CSV.
Migrating from V7.5 to WinCC Unified (V8)
The VBScript model documented above does not apply to WinCC Unified (TIA Portal V17/V18+). Unified exposes a JavaScript runtime with the following equivalents:
| WinCC V7.5 SP2 (VBScript) | WinCC Unified (JavaScript) |
|---|---|
| HMIRuntime | HMIRuntime (identical name, different COM type library) |
| HMIRuntime.Tags("B7_AirFlow") | Tags("B7_AirFlow") |
| Item.TooltipText | Item.TooltipText (identical name) |
| Function StaticX0020Text59_ToolTipText_Trigger(ByVal Item) | export function Static_Text59_ToolTipText_Trigger(item) { } |
| Object name encoding X0020 | No encoding; underscores are part of the object name |
When porting a V7.5 picture to Unified, search the project for the X0020 pattern and replace it with the literal character (typically a space or underscore) in the new event handler. Confirm with the WinCC Unified engineering manual before deployment.
FAQ
Why does my per-object tooltip trigger fail with "Object doesn't support this property or method: 'HMIRuntime'"?
The per-object trigger is auto-generated with the Item parameter already bound to the runtime object. Inside that callback the correct pattern is Item.TooltipText = HMIRuntime.Tags("TagName").Comment — drop the HMIRuntime.ActiveScreen.ScreenItems.Item(...) indirection entirely. The picture-level path is not bound in the per-object scope, which is what the runtime reports on line 6.
How does WinCC encode spaces in per-object trigger function names?
Every VBScript-unsafe character in the designer object name is replaced with X followed by its four-digit hex Unicode code. A space (U+0020) becomes X0020, so "Static Text58" maps to StaticX0020Text58_ToolTipText_Trigger. The encoding is case-insensitive in execution but always uppercase in the function name as written by WinCC.
Can I read the comment of a tag without triggering an acquisition?
Yes. The .Comment property is a static configuration string, not a polled value. Reading it does not register a subscription, does not increment the tag's update count, and does not appear in the tag logging statistics. Use it freely in trigger bodies without affecting runtime performance or data archiving.
What is the difference between the picture-level and per-object trigger patterns?
The picture-level PictureName_Triggers function runs once per picture event and must address objects through HMIRuntime.ActiveScreen.ScreenItems.Item("Name"). The per-object ObjectName_PropertyName_Trigger function runs once per property event on that specific object and receives the object as the Item parameter, so the picture-level addressing path is unnecessary and unsupported in that scope.
Which WinCC versions support the Item parameter in property triggers?
The Item parameter in per-object VBScript property triggers has been part of the WinCC VBScript model since WinCC V7.0 and is unchanged in V7.3, V7.4, V7.4 SP1, V7.5, and V7.5 SP2. WinCC V8 (TIA-based WinCC Unified) replaces the VBScript model with a JavaScript runtime and exposes a different browser-style event API; the patterns in this article do not apply directly to Unified.