WinCC Explorer · VBScript · Practical Tutorial

Configure WinCC Global Script VBS Actions and Triggers

Create WinCC Global Script VBS actions using event, tag and cyclic triggers, with Runtime activation, testing and performance guidance.

Lab Overview

WinCC VBS Lab 2Estimated time: 60 minutesDifficulty: Intermediate

Prerequisites / What You’ll Need

  • Backed-up WinCC Explorer test project
  • Graphics Designer and Global Script VBS access
  • Internal test tags and Runtime diagnostics

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.

Safety: Test on internal tags or an approved simulation system. Do not bypass PLC permissives, interlocks, user authorization or plant change control.

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

TriggerUseRisk
Tag triggerRespond when a selected process tag changesNoise or rapid changes may call the action frequently
Cyclic triggerPeriodic housekeeping or samplingShort cycles can overload script Runtime
Event actionExplicit operator or picture eventDepends 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 Function

The 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.
Expected result: One controlled tag change produces one understandable trace entry without repeated or overlapping execution.

Hands-On Verification Lab

Hands-on
1

Prepare a controlled test

Create only the internal tags, folders or disposable database rows required by this tutorial.

The test scope is isolated and documented.
2

Run the smallest example

Execute one operation and inspect WinCC diagnostics before expanding the script.

The expected value, file, object or database result appears once.
3

Test a failure path

Use a safe backup copy to test an invalid tag, path or disposable input.

The script records a useful error and cleans up without an uncontrolled action.

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.

Get the WinCC VB Scripting syllabus

Share your details and a Softwell advisor will contact you with training options.

Build reliable WinCC VBScript projects

Join practical online, classroom or corporate training.

Request Course Details
Verified learning pathway

Discuss WinCC VB Scripting Training

Explore practical WinCC VBS, SCADA, SQL reporting and industrial automation training options.

Content reviewed: 4 August 2026

☎ Call WhatsApp ✉ Email Enquire Now