show the entry list

WinCC -- Creating HMI configurations -- Handling script editors  
What are the differences between VBS and VBA in WinCC? 
What is the cause of the error message: "...\global.pin" could not be found? 
What is the difference between a project function and a global action? 
What is the maximum number of characters in a C script? 
Why don't any actions run on my computer? 
The object window is no longer visible in the Global Script editor  
How do you insert new/changed scripts in WinCC Runtime? 
How do you use the Microsoft Script Debugger in SIMATIC WinCC and how do you visualize the VB scripts of the pictures in the Microsoft Script Debugger? 
How do assign a know-how protection to C scripts and VBS scripts? 
How do you define a C tag that is known in all functions? 
What is the meaning of function return values? 
How can you incorporate your own header files in C scripts? 
Why do you get an error after compiling even though the contents of the C script are correct? 

What are the differences between VBS and VBA in WinCC?Go to beginning
Part number:

Description
You use VBA for creating process images in the Graphics Designer. It helps to make configuring simpler and automatic. VBA programs run only in the configuration environment for the PCS 7 OS.
Detailed information on VBA is available in the Online Help of WinCC under
"Working with WinCC > VBA for automated configuration".

VBS speeds up the graphics objects in the process mode (Runtime). Contrary to VBA, with VBS you can neither create nor change objects and images.
Detailed information on VBS is available in the Online Help of WinCC under
"Working with WinCC > VBS for creating procedures and actions".

What is the cause of the error message: "...\global.pin" could not be found?Go to beginning
Part number:

Description:
The following error messages appears when you start the Global Script C editor:

An unknown error occurred while accessing \\<Computer name>\<Share: WinCCProject>\<Project name>.pin.
and
An unknown error occurred while accessing \\<Computer name>\SCRIPTFCT\global.pin.

The "global.pin" file is in the WinCC installation directory, in the folder: "...\SIEMENS\WINCC\aplib\". The "<ProjectName>.pin" file is in the WinCC project directory. The WinCC C editor accesses these files via the network path although the files are locally on the computer. Therefore, you should check the following settings:

1. Network:

  • Check that the network card is working and the drivers are loaded correctly.
  • Check that the LAN connection is enabled in the network properties.

2. Release

The "aplib" folder in the WinCC installation directory must be released as follows:

  • Share name: "SCRIPTFCT"
  • Permissions: Group "SIMATIC HMI" Full Control Allow

The project folder does not have to be released explicitly, this is done automatically by WinCC when started. You can check your computer's network release settings with the console command "net view <computer_name>".


Fig. 01

What is the difference between a project function and a global action?Go to beginning
Part number:

Description

  • Project functions are called in actions or other project functions. They can however also be incorporated through WinCC applications such as Tag Logging and Alarm Logging. Here you have to keep to usually clearly defined transfer parameters that are described in the Online Help.
  • Actions are called cyclically depending on their triggers. These can be both object-specific actions in an image, and global actions that are called independently of Graphics Runtime.
  1. Project functions
    Project functions can be renamed and you can also change the transfer parameters. You can define yourself the return value of the function and the parameters with which the function has to be called.
    In the Graphics Designer you can update the property of an object by action (e.g. size) via the return value (here "andy") of a project function. The data type of the return value depends on the type of the property that is to be affected. The project function in the example given is declared as integer (INT), because this integer value is transferred to the property through the return (andy). Note that no return values are given in the case of VOID functions.


    Fig. 01
     

  2. Global action
    Global actions have no transfer parameters. You can execute the action upon change of variables or also with time triggers. You define the trigger criterion in the trigger of the action concerned.


    Fig. 02

What is the maximum number of characters in a C script?Go to beginning
Part number:

Description
A maximum of 64 000 characters may be used per C script. If you need larger scripts, then you must divided them across several project functions that you can call when required.

Why don't any actions run on my computer?Go to beginning
Part number:

Description
In Global Script you have programmed local or global actions. These actions are not executed in Runtime.

The most common reasons for this are:

  • You have not selected Global Script Runtime in the start-up list.
  • You have not defined a trigger for the action. This is indicated in the Global Script editor by a red cross next to the function name.

Important
As far as possible try to use variable triggers instead of the cyclic trigger. The cyclic trigger could overload your system.

Keywords
Service

The object window is no longer visible in the Global Script editor Go to beginning
Part number:
>

QUESTION:
Why is the object window no longer visible when you move it to the edge?

ANSWER:
If you move the object window (functions and actions) to the edge in the Global Script editor, this window disappears and you cannot make it visible again. You must make the following entry in the Registry to make the window visible again.

  1. Start menu > Run, enter "regedit".
  2. Find the code:
    HKEY_CURRENT_USER/Software/Siemens/WINCC/Script/ap_gsccs/ObjTreeBar
  3. Set the "Floating" value from 1 to 0.
  4. Restart the Global Script.
  5. The window is displayed again.

IMPORTANT
Basically, no warranty can be given for direct changes in the registry database, because this is entirely the responsibility of the user. In any case it is recommended to make a backup of the registry before proceeding as described below. Furthermore, these settings are computer-specific. This means that when copying the project to another computer, the settings have to be made again.

Keywords:
service

How do you insert new/changed scripts in WinCC Runtime?Go to beginning
Part number:

Description
In WinCC V6.0 onwards see also the notes on online configuring and online change downloading in the WinCC Information System in the path below: "Working with WinCC > Working with projects > Create and edit project > Online configuration" or "Working with WinCC > Working with projects > Create and edit project > Online change downloading".

Instructions
There are two options as described below.

Changing/creating project functions, scripts and actions on a configuration computer and then transferring them to an operator station in WinCC Runtime

Basically you can change/create project functions, scripts and actions on an Engineering Station and then transfer them to your operator station. When the changes become effective depends on the object changed.

  1. Pictures with changed scripts (e.g. mouse click) can be transferred. The changes become effective immediately upon change of picture.
  2. In project functions, changes can only be made to the function body. The parameter part must not be changed.
    If a new function is copied in or the prototype (the parameters) of existing functions are changed, you have to recreate the header file.
    Changes to the header file only become effective after a restart of WinCC Runtime. 
  3. Global actions have to be opened and saved on the operator station.
    Warning
    Changing actions can lead to undefined states, because when you save the action, the static tags are reset.
    It is therefore recommended to restart WinCC Runtime.

Changing/creating project functions, scripts and actions on an operator station during WinCC Runtime 

Basically, you can change/create project functions, scripts and actions on an operator station during WinCC Runtime  When the changes become effective depends on the object changed.

  1. Pictures with changed scripts (e.g. mouse click) become effective immediately upon change of picture.
  2. In project functions, changes can only be made to the function body. The parameter part must not be changed.
    If a new function is copied in or the prototype (the parameters) of existing functions are changed, you have to recreate the header file.
    Changes to the header file only become effective after a restart of WinCC Runtime. 
  3. Changed and newly created global actions are integrated directly in WinCC Runtime as soon as they are saved. 
    Warning
    Changing actions can lead to undefined states, because when you save the action, the static tags are reset.
    It is therefore recommended to restart WinCC Runtime.

Keywords
Programming notes, Online configuration

How do you use the Microsoft Script Debugger in SIMATIC WinCC and how do you visualize the VB scripts of the pictures in the Microsoft Script Debugger?Go to beginning
Part number:

Instructions
In SIMATIC WinCC V6.0 it is also possible to configure the visualization of your WinCC Project by means of VBS scripts. You can use the Windows component "Microsoft Script Debugger" to debug your VBS scripts.

Detailed information is available in the WinCC Information System in the paths below:

  • "Working with WinCC > Working with Projects > Making Settings for Runtime > Setting up Runtime > How to make computer-specific settings"
  • "Working with WinCC > VBS for creating procedures and actions > Diagnostics > Testing with the debugger"

If you have configured this debugger in WinCC, it will also be executed and started when you start up WinCC Runtime.

To debug the WinCC VBS scripts you open the "View" drop-down menu and click "Running Documents". The "Running Documents" window opens in which you can see all the WinCC VBS scripts.


Fig. 01: View of the "Running Documents" window

The VBS scripts in the pictures are not yet shown in the picture above. To debug these scripts, change the picture to the picture you intend to debug in your WinCC project.
The "Running Documents" window now displays the PDLRT and your picture.


Fig. 02: View of your picture

Double-click the picture of your choice. A window opens containing the configured VBS code of this picture. 
Now in this window you can debug the scripts configured in your picture.


Fig. 03: Debugger window opens

How do assign a know-how protection to C scripts and VBS scripts?Go to beginning
Part number:

Description
You can provide a know-how protection to self-created scripts in the form of project functions, actions, global actions (C scripts) and as from WinCC V6.0 also in the form of project modules, standard modules and actions (VBS scripts). 

You cannot protect C scripts and VBS scripts in pictures. If you nevertheless want to protect the data in the scripts in pictures, you should write your instructions in global actions and then call those global actions in the pictures.

Instructions

SIMATIC WinCC V5.x
In the Global Script Editor select an action/function, go to the menu item "Edit > Info" and assign a password for the selected action/function.

Note
Information about this topic is available in the WinCC Information System under the keyword "How to protect an action against access and change".

As from SIMATIC WinCC V6.0
As from WinCC V6.0 there is the Global Script VBS editor in addition to the Global Script C editor.

  • In the Global Script C editor the know-how protection works as described above for WinCC V5.x.
  • In the Global script VBS editor the selected action or project module can be protected with a password under the menu item "Options > Info / Trigger".

Note
Information on the topic of password protection is available in the WinCC Information System in the paths below.

How do you define a C tag that is known in all functions?Go to beginning
Part number:

Description
A detailed description is available in the documentation and Online Help for your version, under the keyword "Global C tag".

Instructions
Please proceed as follows.
Create a new project function, for example:

void dummy()
{
}

Now, if you create a tag in the dummy function, for example:

void dummy()
{
int a = 0;
}

this tag is only known in the dummy function.

If, however, the tag is to be known in the entire C program, then you simply declare it outside the scope of the function, for example:

int a = 0;
void dummy()
{
}

Tag "a" is now available at runtime in the entire program (to all functions, actions, actions on the object, all project functions, all standard functions).
In order to be able to use tag a in an action on the object, for example, then this simply has to be declared as external. This means that the compiler is informed that it must not create this tag itself, but that it will be created at another point at runtime. Tag a exists only locally on the computer. In a multi-client environment, this tag remains unknown on other computers. In this case, you can only fall back on internal WinCC tags and use them as data exchange area.

Example
void OnPropertyChange(..........)
 

{

extern int a;

// Tag is not created on the stack, but it is only announced

 

 

// that it has been instanced at another point.

 

a += 1;

// Therefore it must not be initialized here.

}

 

 

If the tag is now accessed, the common tag a is change in the entire program.
If you declare the tag in a project function, this tag then exists in the entire project.
If you declare the tag in a standard function, this tag then exists in all projects.

Notes

  1. A maximum of 64 Kbytes of memory is available to a function and the global C tags defined with it.
  2. If you change the global C tag, all functions (project functions, global actions and object actions in the pictures) in which this C tag is used will have to be recompiled.
  3. In the case of project and standard functions, you can achieve this with the 'Compile all functions' functionality of the Global Script editor.

What is the meaning of function return values?Go to beginning
Part number:

Configuration Notes
Information about this topic is available in the specialist literature on the "C" programming language. More information is available in the WinCC Information System in the path "Working with WinCC > ANSI-C for creating functions and actions".

In addition, it should be mentioned that C functions of the calling function often return a so-called "error code". In the simplest of cases, therefore, a function might return a value of the BOOL data type (TRUE for "Function executed successfully" and "FALSE" for "Function not executed successfully"). Entry ID 22196775 includes a description of how you can use the return value for error handling in C scripts.

How can you incorporate your own header files in C scripts?Go to beginning
Part number:

Instructions:
You can incorporate your own header files by proceeding as follows.
 
No. Procedure Validity
1 Header definition as first statement in the function body
Insert your header definition as first statement after the brace.


Fig. 01  
 

Graphics Designer,
Global Script
2 Extension of the standard header file "apdefap.h"
Open the standard header file "apdefap.h" with the Global Script editor or a simple ASCII editor (notepad.exe). The "apdefap.h" file is in the WinCC project path  ".\library\apdefap.h".

Enter you header definition.


Fig. 02  
 

Graphics Designer,
Global Script
3 Header definition before the function declaration
In the case of Global Script functions you can insert additional header files before the function declaration.


Fig. 03  
 

Global Script

The requirement for all three methods is that the header file to be incorporated is located in the "Search Path" for Global Script. For example, this can be:

  • "<WinCC project path>\library" or
  • <WinCC installation path>\aplib"

Important:
You must make sure that the code in the header is not executed twice. You can ensure this by using appropriate C preprocessor statements.


Fig. 04  
 


Why do you get an error after compiling even though the contents of the C script are correct?Go to beginning
Part number:

Description
If your error image is similar to the one illustrated below, then the problems is most likely in the header files for the project and standard functions. These are referenced via the files ap_pbib.h and ap_glob.h. If these files are defective or empty, then you get the error described.


Fig. 01

Remedy
Often there is an empty copy of each of the specified files in the WinCC\bin or WinNT\system32 directory. In the directories find the files with the names ap_pbib.h or ap_glob.h. If these files are in the directories specified, then they can be deleted.

Keywords
Undefined, Identifier

 Entry ID:26732184   Date:2013-02-25 
I regard this article....as helpfulas not helpful                                 






























mySupport
My Documentation Manager 
Newsletter 
CAx-Download-Manager 
Support Request
To this entry
Print
Create PDF 
Send to a friend
QuickLinks
Compatibility tool 
Topics
Help
Online Help
Guided Tour