Siemens touch screen uses WinCC for screen design, some advanced products (such as smart series panels) support VBScript script programming in the WinCC environment, which can achieve some advanced functions, such as: screen management, data storage and management, alarm management, animation demonstration, etc. Using scripts and PLC data can achieve the purpose of monitoring different devices with the same touch screen program. I previously wrote “How to make a custom popup on a touch screen?” on the application example of VBScript. In order to facilitate the system learning, I plan to write a series of tutorials on VBScript in Siemens touch screen applications, this article will first make a simple introduction, including the following two topics:

(1) What is VBScript?

(2) WinCC’s VBScript object model;

1. What is VBScript?

VBScript, abbreviated as VBS, is a scripting language based on Visual Basic introduced by Microsoft. VBS was used more in early web programming, but with the development of technology, many more popular scripting languages appeared, resulting in VBS is rarely used in the field of computer programming. However, due to its simple and easy to learn, many touch screen manufacturers’ products began to support the use of VBScript script programming to achieve some advanced functions, which makes VBScript useful in the field of industrial control. Since there are many VBScript syntax tutorials on the Internet, we will not introduce too much in this regard, and will focus more on the professional application of VBScript in touch screen programming. This tutorial hardware uses Siemens Smart series panels, and the programming software is Wincc Professional Edition of Botu platform.

2. WinCC’s VBScript object model

Wincc provides a VBScript object model that contains many objects (such as screens, variables, alarms, records, etc.) for easy access to all objects of the touch screen graphics system. The structure of the object model is shown in the following figure:

HMIRuntime is the topmost object, through which it can be passed

Read or set the language of the current system;

Access variables;

Read or set the initial screen of the screen;

End of system operation, etc.;

Like what:

The following code sets “MainScreen” as the initial screen of the graphics system

Change to Screen “MainScreen”

HmiRuntime.BaseScreenName = “MainScreen”

The Screens object can access the specified screen and set its properties, such as the following code to set the background color of the root screen to green:

HmiRuntime.Screens (“root screens”). BackColor=vbGreen

SmartTags can access variables of the system, such as the following code that sets the value of the variable “myTag1” to 100:


The Alarms object can access and set system alarms, and the DataSet object can access data, which we will cover in more detail later.

Well, Part 1 on VBScript programming for Wincc is introduced here.

Welcome to my column:

You might also enjoy: