.st0{fill:#FFFFFF;}

WinCC SCADA C-action Scripting Course: Tutorial #70 

 August 16, 2021

By  SCADA World

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 with flashing option:


// 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??
{
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",1);//FLASHING RECTANGLE ON
return 64255; //YELLOW COLOR
}
else if (GetTagBit(TAG_1) & GetTagBit(TAG_2)) // TagA = 1 AND TagB = 1??
{
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",0);//FLASHING RECTANGLE OFF
return 255;
}
else if (GetTagBit(TAG_1))// TagA = 1?
{
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",0);//FLASHING RECTANGLE OFF
return 65280;
}
else
SetPropBOOL(lpszPictureName,"Rec10","FlashBackColor",0);//FLASHING RECTANGLE OFF
return 0;


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>