show the entry list
WinCC -- Creating HMI configurations -- Using variables
How do you divide a process tag (16 bits) into 2 internal tags of 8 bits each in WinCC?
How can you indirectly address a variable via a C script?
In the case of an FMS connection from WinCC to a controller, how do you address a bit in the controller?
Converting an integer variable into an ASCII variable in WinCC
Why are spaces displayed at the beginning of the process-associated value (text) and characters truncated at the end?
How can I speed up the first call of GetTag or SetTag functions?
Which logic operations of tags are possible in C scripts?
How do you apply the functions GetTagMultiWait and SetTagMultiWait for strings in WinCC?
What do you have to pay attention to in VBScript when linking tags bit by bit and how do you set the highest value bit (Bit 31/Bit 32) in WinCC with VBS?
How do you use the "SetTagMultiWait()" functions to write multiple WinCC tags?
How do you use the "GetTagMulti()" functions to read multiple WinCC tags?
Why does accessing tags - by specifying the tag prefix in the tag name - lead to access errors within the picture window?
How do you toggle a WinCC variable of the data type "Binary" using VBS (Visual Basic Scripting)?
Why is the value not displayed correctly when you write a tag via VBS and then read it directly?
How can you determine the size of the memory for C data types and C tags?
How can you indirectly address a variable via a C script?
Part number:


Instructions

This script reads in a structure name from an internal variable "VariableFlag" and adds an instance name to it. The variable value is then read from the final variable.
The following script is triggered by a mouse click on a button.

Program listing:
=============

#include "apdefap.h"
void OnClick(char* lpszPictureName, char* lpszObjectName, char* lpszPropertyName)
{
char* InstanceNameA;
DWORD VarContA;
// Presetting of internal variable with structure name,
// this can also have happened at a different point
SetTagChar("VariableFlag","TriangleEnvelopeCurve");
// Reservation of memory
InstanceNameA = SysMalloc(200);
// Read in structure name
strcpy(InstanceNameA,GetTagChar("VariableFlag");
// Test output in diagnostic window
printf("Contents Pointer Position 1: %s\r\n", InstanceNameA);
// Add instance name to variable name
strcat(InstanceNameA,".Triangle_1");
// Test output in diagnostic window
printf("Contents Pointer Position 2: %s\r\n", InstanceNameA);
// Read in variable value
VarInhA = GetTagWord(InstanceNameA);
// Test output in diagnostic window
printf("VariableContents: %d\r\n", VarContA);
// Release of reserved memory
SysFree(InstanceNameA);
}
 

 Entry ID:218537   Date:2011-01-20 
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 
Help
Online Help
Guided Tour