WinCC - Script problem in the picture window

It is pretty straightforward as on Siemens example.

First you need to give certain name or different numbers to every script which is printed to output window.
(If you use error number on scripts, give for every script different error number, so it is easier to look which script makes error.)

I maded two different buttons, another is with C and other with VBS.

C-code:

#include "apdefap.h"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y)
{

printf("\r\n");
printf("This is a my script (Button1, C-code");
printf("\r\n");


SetTagBit("test_bit",1); //Return-Type :BOOL


}


and VBS-code


Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)

HMIRuntime.Trace vbNewLine
HMIRuntime.Trace "this is my script (Button2, VBS-code)"
HMIRuntime.Trace vbNewLine


HMIRuntime.Tags("test_bit").Write 0

End Sub


Then start WinCC runtime.

On WinCC installation folder should be folder name uTools and inside folder apdiag.exe

When runtime have started, open apdiag.exe
On apdiag.exe select output window, there should open grey box which prints all errors etc. fron WinCC's active page.

If you now open page or picture window on WinCC, there maybe is showed some erros if not then everthing good still on WinCC.

Next if you push buttons then output window should print your text and execute other commands of script behind.

You should see your script text as soon as you push buttons.
If there is delay, something is hanging behind on WinCC and affecting to scripts and you should fix that error(s)

When you have examined everything of script and everything is OK, comment all printf and HMIruntime.trace commands out from scripts.
Otherwise they also are saved to WinCC TXT logs and logs are hard to read afterwards

Same also for global scripts, if you make printf/trace commands to global scripts, the are printed to output window when executed with triggers.

WinCC_appdiag.png WinCC_button_diag.png
 
It is pretty straightforward as on Siemens example.

First you need to give certain name or different numbers to every script which is printed to output window.
(If you use error number on scripts, give for every script different error number, so it is easier to look which script makes error.)

I maded two different buttons, another is with C and other with VBS.

C-code:

#include "apdefap.h"
void OnLButtonDown(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName, UINT nFlags, int x, int y)
{

printf("\r\n");
printf("This is a my script (Button1, C-code");
printf("\r\n");


SetTagBit("test_bit",1); //Return-Type :BOOL


}


and VBS-code


Sub OnLButtonDown(ByVal Item, ByVal Flags, ByVal x, ByVal y)

HMIRuntime.Trace vbNewLine
HMIRuntime.Trace "this is my script (Button2, VBS-code)"
HMIRuntime.Trace vbNewLine


HMIRuntime.Tags("test_bit").Write 0

End Sub


Then start WinCC runtime.

On WinCC installation folder should be folder name uTools and inside folder apdiag.exe

When runtime have started, open apdiag.exe
On apdiag.exe select output window, there should open grey box which prints all errors etc. fron WinCC's active page.

If you now open page or picture window on WinCC, there maybe is showed some erros if not then everthing good still on WinCC.

Next if you push buttons then output window should print your text and execute other commands of script behind.

You should see your script text as soon as you push buttons.
If there is delay, something is hanging behind on WinCC and affecting to scripts and you should fix that error(s)

When you have examined everything of script and everything is OK, comment all printf and HMIruntime.trace commands out from scripts.
Otherwise they also are saved to WinCC TXT logs and logs are hard to read afterwards

Same also for global scripts, if you make printf/trace commands to global scripts, the are printed to output window when executed with triggers.

Thanx a lot, Lare. It helped.

Actually I see all messages from the script when thy are executed.
How can I recognize when an error will occur?
 
HMIRuntime.Trace vbNewLine
HMIRuntime.Trace "this is my script 1"
HMIRuntime.Trace vbNewLine

Traces are working in each of the scripts where it is placed, but how can I recognize if the error takes place ?

If there is delay, something is hanging behind on WinCC and affecting to scripts and you should fix that error(s)
How to recognize what exactly is hanging it?

it is the only line of the script and it's working but very slowly:
HMIRuntime.Tags("com_write").Write 1
 
Last edited:

Similar Topics

Dim i, a(10) For i = 0 To 9 Step 1 a(i) = SmartTags("visuf")(i) Next For i = 10 To 2 Step -1 a(i)= a(i-1) a(0)= SmartTags("valuetag")...
Replies
6
Views
5,490
Hi! In a WinCC Flexible script I'm trying to get some bit from some Tag so as I don't have to read to much Tags from PLC. Now, for example, I'm...
Replies
15
Views
11,508
Hello all, I am new to WinCC & would greatly value any help or pointers in the right direction that this obviously knowledgeable forum can...
Replies
0
Views
6,104
Hello. I have a db which is 1000 INT, and this db is represented in WinCC as a raw data type set of 5x 400 Bytes. This set is read with a script...
Replies
1
Views
77
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
65
Back
Top Bottom