Script working in sim. but not IRL - Wincc Flex 2008 RT

rQx

Lifetime Supporting Member
Join Date
Oct 2010
Location
Trelleborg
Posts
1,051
Hi!

I'm a little lost here. I have made a script in VB that run perfect when I simulate it on my programming machine (Windows 8.1)

But when I run the system on the actual computer (windows 7) it won't work. How do I debug this? There is absolutely no life of the script. I have one more complicated script and one that just copy 8 smarttags to 8 internal tags.

Anyone has this kind of problem? And how do i debug this?

/Tim
 
You can install a script debugger that will attach upon error but a simple and quick method that i sometimes use is the function system alarm to output debug messages to the screen.

Do you have somewhere to show system alarms?

If not add an alarm window to the template make sure alarm class system and pending alarm is ticked. The time that system alarm popup is shown can be increased in alarm settings --> display duration.

All errors in scripts are output as a system alarm so if you might suspect script errors it is important that you have somewhere to show the system alarms from system alarm class.

But you can also use function ShowSystemAlarm("MY TEXT") to output your own system alarms that can contain values from tags for debug or just to make sure that a certain line is reached. If you have ShowSystemAlarm("TEST") in the first line and have an alarmwindow with system alarm you will get a popup showing TEST whenever the scripts executes.
 
Thanks I will try that and see if the script tries to run at all. It seems like it wont even start.

One script is just:

Smarttag1=smarttag2

But it dont execute

Will be intresting to see what the problem is
 
Dou you have the error handling code in your VB script ?

In the start
ON ERROR RESUME NEXT

After each coed section that could have potential problems (anything with i/o):
IF ERR.number <> 0 then
ShowSystemAlarm ERR.number & ": " & ERR.description
ERR.Clear
end if
 
System alarms are triggered in case of script error even without that piece of code

Your piece of code will allow the script to continue even if there is an error and output the error in a more controlled and elegant manner.
 
Last edited:
System alarms are triggered in case of script error even without that piece of code

Your piece of code will allow the script to continue even if there is an error and output the error in a more controlled and elegant manner.
Not all VBS errors will trigger a system alarm.

Also, you can place several of the lines with IF ERR.number <> 0 then ShowSystemAlarm ERR.number & ": " & ERR.description.
That can give you more detailed info about where in the code the problem is.
 
Thanks alot for all your help! I think I have now solved the problem.

I had made some debug I/O fields in one screen to see that the HMI actually got the correct values to it.

The script only worked on that screen.

I made a quick google and it appears that all tags are in acqusition mode "cyclic on use" and I have to set it to "cyclic continous" for it to detect my "change value" event that I use to trigger the script.

I haven't tested this yet but it seems that this could be the solution.

/Tim
 

Similar Topics

Hello Experts I am working on a project with WinCC Unified v16 PC system and want to create an option on the screen to export logs to the...
Replies
0
Views
24
Hello, I am learning to create shapes and VB Scripts in HMIWeb Display Builder. I wanted to change color of my rounded rectangle by script. I...
Replies
0
Views
112
Hello, I have a quick question. I have been using scripts to change the color of buttons. The reason, I am usually using multiple hmiruntime.tags...
Replies
1
Views
105
Hi All, I'm keep getting double quotes in between selections rather than the beginning and the end. Here's the script and please help to find...
Replies
7
Views
802
Dear guys, I am not a programmer but I can do simple things myself. I'm stuck with the following. if I want to extract a value from my rx3i...
Replies
46
Views
4,782
Back
Top Bottom