Configure WinCC Global Script VBS Actions and Triggers
This lab targets wincc global script vbs trigger with copy-ready examples, expected results and diagnostic guidance.
1. Global Script VBS Actions Explained
A Global Script action is project-level VBS logic executed by Global Script Runtime. It is separate from a Graphics Designer object-event action. Confirm that Global Script Runtime is included in the computer startup configuration before testing.
2. Choose the Correct Trigger
| Trigger | Use | Risk |
|---|---|---|
| Tag trigger | Respond when a selected process tag changes | Noise or rapid changes may call the action frequently |
| Cyclic trigger | Periodic housekeeping or sampling | Short cycles can overload script Runtime |
| Event action | Explicit operator or picture event | Depends on the picture/object lifecycle |
3. Create a Small Traceable Global Action
Function action
Dim triggerTag
Set triggerTag = HMIRuntime.Tags("Demo_Trigger")
triggerTag.Read
HMIRuntime.Trace "Global action called, trigger=" & CStr(triggerTag.Value)
Set triggerTag = Nothing
action = 0
End FunctionThe action signature is supplied by the editor. Keep declarations in the editor area and place only executable logic inside the generated action body.
4. Understand Separate Runtime Contexts
Global Script and Graphics Designer actions are processed independently. Do not assume an in-memory global variable written in one context is immediately shared with another. Use approved internal WinCC tags or the WinCC DataSet mechanism when state must cross contexts.
5. Trigger Performance Rules
- Use the slowest cycle that meets the real requirement.
- Do not automate Excel, query SQL or process large files in a fast cyclic action.
- Prevent overlapping work with a controlled busy-state tag where necessary.
- Trace entry, exit and errors during commissioning, then control trace volume.
Hands-On Verification Lab
Hands-onPrepare a controlled test
Create only the internal tags, folders or disposable database rows required by this tutorial.
Run the smallest example
Execute one operation and inspect WinCC diagnostics before expanding the script.
Test a failure path
Use a safe backup copy to test an invalid tag, path or disposable input.
Frequently Asked Questions
Should this WinCC VBScript be tested in production?
No. Use a backed-up training or staging project and follow the plant change-control process.
Which WinCC versions does the example target?
The examples target classic WinCC Explorer V7.x/V8.x. Verify object properties, action signatures and providers in the installed WinCC help.
How should Runtime failures be diagnosed?
Use scoped Err checks, WinCC object diagnostics and HMIRuntime.Trace while recording the exact station, trigger, tag and Runtime identity.
