Wincc Vbscript Examples Practical Code Snippets For Rapid Development

Bobby Jul 13, 2026

VBScript, or Visual Basic Scripting Edition, is a scripting language developed by Microsoft that is typically used for spectacle control, system configuration, and automation in Windows environments. One of the powerful aspects of VBScript is its ability to interact with COM objects, making it a formidable tool for Windows administrators and developers. Today, we're going to delve into the world of VBScript with a focus on WinCC, a powerful industrial software suite from Siemens. Specifically, we'll provide detailed examples of how to interact with and automate functions within WinCC using VBScript.

willowscript punctuation and numbers
willowscript punctuation and numbers

Before we begin, it's important to note that VBScript is case-insensitive, which means 'MsgBox' and 'msgbox' are treated as the same function. It's also crucial to clear the screen in WinCC before running your VBScript with the 'Clear' command to avoid conflicts with existing objects and controls.

a black and white photo with some words on it
a black and white photo with some words on it

Creating and Managing WinCC Objects

WinCC is rich in objects that can be controlled and manipulated using VBScript. Let's start by creating and managing some simple objects.

Willow script punctuation
Willow script punctuation

Creating a New WinCC Project

To create a new WinCC project using VBScript, you can use the following script:

Willow script.
Willow script.

Set WinCCApp = CreateObject("WinCC.Application") WinCCApp.CreateProject "MyNewProject"

Opening and Saving WinCC Projects

You can open and save WinCC projects with these VBScript commands:

I Dug Through Windscribe’s Privacy Policy, Audit Reports, and Legal Cases – Here’s What Logs It A...
I Dug Through Windscribe’s Privacy Policy, Audit Reports, and Legal Cases – Here’s What Logs It A...

WinCCApp.OpenProject "C:\MyPath\MyProject.owl" WinCCApp.SaveProject

Working with WinCC Controls

WinCC projects consist of control elements like buttons, switches, and numeric input fields. Let's look at how to manipulate these controls using VBScript.

Willow Script Punctuations
Willow Script Punctuations

Setting Control Values

The following script sets the value of a numeric input field named 'myNumericField' in the active page of your WinCC project:

WPF vs WinForms - Making the Right Decision in 2026 - NDepend Blog
WPF vs WinForms - Making the Right Decision in 2026 - NDepend Blog
【VISUAL VB NET】Print
【VISUAL VB NET】Print
an iphone screen with the text editor on it, which is highlighted in black and white
an iphone screen with the text editor on it, which is highlighted in black and white
two words that are in different languages, one is very confusing and the other has an interesting
two words that are in different languages, one is very confusing and the other has an interesting
a notebook page with two computers on top of each other and the words tcp vs udp above them
a notebook page with two computers on top of each other and the words tcp vs udp above them
Scripting
Scripting
You can run VxWorks too! | Virtually Fun
You can run VxWorks too! | Virtually Fun
an open notebook with instructions on how to program a ved in red and blue
an open notebook with instructions on how to program a ved in red and blue
Client Challenge
Client Challenge
For the writers ;)
For the writers ;)
TikTok · The Alchemy Book
TikTok · The Alchemy Book
55K views · 1.1K reactions | English vocabulary: advanced vs. basic: 75 💐💡🏅💯 #virals #fblifestyle #education #community | Tim Tim TV | Facebook
55K views · 1.1K reactions | English vocabulary: advanced vs. basic: 75 💐💡🏅💯 #virals #fblifestyle #education #community | Tim Tim TV | Facebook
the text description is shown in blue and white, with an arrow pointing to it
the text description is shown in blue and white, with an arrow pointing to it
two texts are shown with the same person's face and one is talking to each other
two texts are shown with the same person's face and one is talking to each other
WxWidgets C++ Getting Started with Visual Studio 2019
WxWidgets C++ Getting Started with Visual Studio 2019
The Best VPN Services for 2026
The Best VPN Services for 2026
Windscribe Pro VPN Review, 76% Discount / Free Promo Code
Windscribe Pro VPN Review, 76% Discount / Free Promo Code
the words are written in different languages
the words are written in different languages
an image of a computer screen with text on it
an image of a computer screen with text on it
a purple background with the words basic outline to a script pause if needed on it
a purple background with the words basic outline to a script pause if needed on it

Set myNumericField = WinCCApp.ActivePage.Controls("myNumericField") myNumericField.Value = 123

Controlling Button Behavior

Here's how you can handle a button click event and display a message box using VBScript in WinCC:

Private Sub myButton_Click() MsgBox "Button clicked!" End Sub

Automating WinCC Functions

WinCC offers a vast array of functions that can be automated using VBScript. Let's explore two common tasks: running a simulation and executing a recipe.

Running a Simulation

This script starts a simulation with 'mySimulation' as the simulation name:

WinCCApp.ActivePage.Simulations("mySimulation").StartSimulation

Executing a Recipe

To execute a recipe, use the following VBScript command:

WinCCApp.ActivePage.Data("MyDataSet").ExecuteRecipe "MyRecipe"

In conclusion, VBScript provides an incredibly powerful means to interact with and automate functions within WinCC. Whether you're creating and managing objects, working with controls, or automating complex tasks, VBScript offers a wealth of possibilities. Embrace this scripting language and unlock a new level of efficiency and control in your WinCC projects. Happy scripting!