Help With Simple VBS Script

Jack Schit

Member
Join Date
Oct 2009
Location
England
Posts
35
Hi All,

I'm new to VBS scripting and I'm trying to write a simple script that will invert the state of a tag i.e FALSE to TRUE or TRUE TO FALSE when the script is run.

The scipt is running win WinCC V7.0.

I've created the following script but nothing seems to happen!

If HMIRuntime.Tags("hrly_log").FALSE Then
HMIRuntime.Tags("hrly_log").Write 1
Else
HMIRuntime.Tags("hrly_log").Write 0
End if
End Sub

Could anybody body give me some advice of what i'm doing wrong!

Thanks

Jack
 
I dont know WinCC but in WinCC Flexible this works

'WinCC Flexible Invert the tag called MyTag
SmartTags("MyTag") = NOT SmartTags("MyTag")

Try
HMIRuntime.Tags("hrly_log") = NOT HMIRuntime.Tags("hrly_log")
 
Code:
If HMIRuntime.Tags("hrly_log").Read = 0 Then
HMIRuntime.Tags("hrly_log").Write 1 
Else
HMIRuntime.Tags("hrly_log").Write 0
End if
End Sub

Never forget to .read a tag before using it.
 

Similar Topics

Hello, We are beginning to use the View Designer software for the newer Panelview 5500 and 5300 HMIs. I one we are starting with is the 5300 10"...
Replies
1
Views
1,247
I need help answering a problem regarding the design a ladder diagram for a security light control. The question states when a sensor is...
Replies
8
Views
2,092
Question 1: I am still new to this - I also might be asking for too much. - but i need help using Ladder Logic to run (rod style actuator motor)...
Replies
6
Views
1,722
Could someone help me write a simple program for my Click PLC (I am only new to PLC's) I have 2 switches and two lights that will time 2 separate...
Replies
52
Views
10,412
Hello. After doing a couple quick searches I couldn't find anything concrete on what I should use for a simple ladder drawing program. Since all...
Replies
3
Views
1,808
Back
Top Bottom