<!-- Softwell WinCC VBScript 20-Part Tutorial · Blog 08 · updated 2026-08-29 --> WinCC Global Script VBS Actions & Triggers | Softwell
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

Learning Foundation: Runtime Execution Architecture

This page has one defined job in the WinCC VBScript learning path. Master this foundation before using the same concept inside larger SCADA, SQL Server and reporting scripts.

IntermediateWinCC Explorer / Classic WinCCSQF Running Project
Prerequisite

Read/write tags and reusable functions should be understood before periodic/global execution.

Core concept

Global Script determines when reusable VBS actions run. Trigger choice controls load, response time and data freshness.

SQF practical connection

Run event logging or status processing only on meaningful tag/event/cyclic triggers rather than unnecessary fast polling.

Expected competency

Choose event, tag and cyclic triggers and design Global Script actions with predictable execution and Runtime load.

Configure WinCC Global Script VBS Actions and Triggers — ArchitectureCode-rendered HTML/CSS architecture; no image file required
Runtime Change

Tag/event/cycle condition occurs

Trigger
Trigger

Starts the configured action

Tag / Cyclic
Global Action

Central reusable VBS code

Action
Tag / SQL Work

Read, validate, log

HMIRuntime / ADODB
Trace

Confirm execution timing

HMIRuntime.Trace

Complete WinCC VBScript Learning Path

Use Previous/Next for the recommended practical order, or open any topic below as a reference.

WinCC VB Scripting Training →
Easy Testing Method: Every main code example on this page is followed by a copy-ready InputBox + MsgBox test. Use the dialog version first to understand the result, then move to the original WinCC/SQL code. Database writes and equipment commands are previewed or simulated unless the original example is already intended as a lab action.

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

Easy TestEasy Test 1 — InputBox + MsgBox

Offline tag simulation: useful before connecting the participant PC to WinCC Runtime.

Dim TestValue, ResultText
ResultText = ""
TestValue = InputBox("Enter simulated value for Demo_Trigger", "Easy Test 1 — InputBox + MsgBox", "TEST")
ResultText = ResultText & "Demo_Trigger = " & TestValue & vbCrLf
MsgBox ResultText & vbCrLf & "Now compare these values with the original HMIRuntime .Read example.", vbInformation, "Tag Read Quick Test"

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.

SQF Running Project Lab · Blog 08

Trigger the SQF logging action

Sub SaveSQFEvent()
    'Read SQF tags
    'Validate values
    'Insert one event row
End Sub

'Call SaveSQFEvent from the approved WinCC action/trigger.

Easy TestEasy Test 2 — InputBox + MsgBox

Self-contained procedure test; no PLC or SQL Server is required.

Sub ShowSQFValue(ByVal NameText, ByVal ValueText)
    MsgBox NameText & " = " & ValueText, vbInformation, "Sub Quick Test"
End Sub

Dim TempAct
TempAct = InputBox("Enter Temp_Act", "Easy Test 2 — InputBox + MsgBox", "825.5")
Call ShowSQFValue("Temp_Act", TempAct)
Use a trigger that matches the requirement. Event/state-change logging is usually preferable to unnecessary fast cyclic database writes.

Build reliable WinCC VBScript projects

Join practical online, classroom or corporate training.

Request Course Details
WinCC VBScript Learning Path 4 of 10

Actions, triggers and execution design: engineering guide

Choose event, tag or cyclic triggers based on response time, system load and operational ownership.

Implementation and commissioning checklist

Practical completion outcome

A Global Script action with a justified trigger, measurable execution behavior and a documented recovery path.

Safety boundary: Validate scripts on a backed-up WinCC training or staging project. PLC safety functions, permissives and interlocks must remain independent of HMI scripting.

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