VB Script/Siemens panel help

DLMUK

Member
Join Date
Jun 2013
Location
Southampton
Posts
311
Hi,

I have never written a bit of VB script before, what I want to do is toggle a value (bool or int) on a Siemens TP HMI button.

I have found the following
https://support.industry.siemens.co...g-vbs-(visual-basic-scripting)?dti=0&lc=en-WW

But when I try and copy the examples I get error messages saying "Tags: is not declared" is undefined on example one.

and

On the second:

"A VB_Script or HMI_Tag object named ScreenItems was not found"

Can anyone point me in the right direction?

Cheers,
 
Hello,

Your first issue is that you are confusing WinCC with WinCCFlexible (I think). The TP HMI stations are usually configured with WinCCFlexible or TIA Portal whereas WinCC is a full blown SCADA system. While the names are similar, the products are not. I assume that we are talking about WinCCFlexible here.

If you create a new script in WinCCFlexible then there is some very useful help placed as comments at the start of the file:

Code:
'NOTE: To start scripting please press <Ctrl><Space> and see the wide variety of functions.
'Write scripts by using system functions or the WinCC flexible object model. You can easily access to the
'system through the HMI runtime object. For a convenient picking of an object reference
'you can press <Alt><Right Arrow>. Design complex scripts by employing the basic features
'of the programming language VBScript and access tags directly by name e.g. tag = 5.

Then you can start to play with scripts.

Code:
Dim strTemp

strTemp = SmartTags("UserName")

If strTemp ="Optima" Then
	SmartTags("bOptima") = True
Else
	SmartTags("bOptima") = False
End If

'Set Initialised
SmartTags("bInitialised")= True

Happy scripting,

Nick
 

Similar Topics

Hi, Siemens TP900 Comfort: VBscript logging vs datalog I have a request from a customer. He needs to log around 10 real value's. The interval...
Replies
0
Views
2,229
Hi, I am trying to create a sequence of screens on my HMI, the user needs to input certain information into a IO field in order to be able to...
Replies
1
Views
2,036
Hi all I have some problems in exporting recipes data set on a USB memory stick in CSV format(Siemens MP277). The goal is backup the recipe...
Replies
1
Views
3,599
Hi, I have to convert my csv file to an excel sheet in Wincc Flexible 2008 for which I have written the following code snippet: 'Alarm_Log.csv'...
Replies
0
Views
5,264
hi everybody I'm trying to create a Textfile in a USB pendrive connected to SIEMENS MP277, using a script in winCCflexible 2008. In the...
Replies
5
Views
5,078
Back
Top Bottom