In this lecture, we learn about scripting process to control colors of rectangle in WinCC window. Sometimes we need to use scripting during runtime (WinCC RT) and we need to know how to make it!
One of subscribers asked for help:
"Can you please make one video for changing object colour with 3 different conditions using C script.
If Tag A is 1it should be greenWith Tag B is 1 it should be redWith Tag C is 1 yellow and flashing"
Check the script below:
// WINCC:TAGNAME_SECTION_START
// syntax: #define TagNameInAction "DMTagName"
// next TagID : 2
#define TAG_1 "TagA"
#define TAG_2 "TagB"
#define TAG_3 "TagC"
// WINCC:TAGNAME_SECTION_END
// WINCC:PICNAME_SECTION_START
// syntax: #define PicNameInAction "PictureName"
// next PicID : 1
// WINCC:PICNAME_SECTION_END
if (GetTagBit(TAG_1) & GetTagBit(TAG_2) & GetTagBit(TAG_3)) // TagA = 1 AND TagB = 1 AND TagC = 1??
return 64255;
else if (GetTagBit(TAG_1) & GetTagBit(TAG_2)) // TagA = 1 AND TagB = 1??
return 255;
else if (GetTagBit(TAG_1))// TagA = 1?
return 65280;
else
return 0;