WinCC Flexible User Name

The following guide is to know when a user is logged in and when they are not.

The first thing we are going to do is to create two internal tags, as shown in the following image.


we're going to create a script that I called LogOn_LogOut.

If we analyze the lines of code, I've declared an internal tag. Then we use the GetUserName System function and assign the result to our tag.

At that moment, we make use of a conditional and compare whether the value of User is equal to Admin or Supervisor, which are the two users I have created in the project. If there is one of these users, we change the UserLogin tag to TRUE or FALSE.

With the value of this tag we will know if there is a user logged in. With this we have finished our Script and now we need to call it.


To call the Script we have just created, go to the Task Scheduler and create a new task with the Change User event. And we assign our Script to the functions that will be executed at each User change.

Now let's see what we can do with the tag that tells us there is a logged in user


We are going to create a new graphics list with a boolean value, and assign two images for example. When there is no user the value is 0 (false) and when there is a user the value is 1 (true)


Assign this list graphics to a button, and link the UserLogin tag, with this we will visually know when there is a user in the system. Run the Runtime and check it out.

We can also put an Output field, with the tag CurrentUser, which was the one we created and we'll see the name of the User.


01 de Junio del 2018

"La gratitud en silencio no sirve a nadie". Gladys Bronwyn Stern