travisroberts88
Lifetime Supporting Member
I have a plant with multiple areas, users, codes, etc. I have an auto logout command that triggers if a supervisor logs in and walks away. I use the RSView Idle Detect Active X Event.
As it stands right now, when the plant adds an HMI, I have to update the code on EVERY SINGLE DISPLAY. I'm not talking a handful, I'm talking almost 500 displays.
Any Rockwell reccommended thing for auto logout/login never worked. Here is my code to start:
Private Sub RSView32SEIdleDetectControl1_EnterIdleState() 'ActiveX Control Command for Idle time.
Dim compname As String 'Declaring compname As a String.
compname = Environ$("computername") 'we use the Windows environment variable "computername" to resolve the name of the device' that's running our code. It is accessed via the Environ$(string environmentVariableName) function.
Select Case compname 'compname Select Case statements.
Case "4HEAD-HMI" 'This is the 4 Head Labeler HMI.
Select Case CurrentUserName() 'Grabbing current user.
Case "supv" 'For when user "supv" is logged in.
Application.Login "operatorX", "operatorX" 'Application executing the login for user "operatorX."
Case Else
End Select
So the breakdown is really this. The Active X event is the Sub. We delcare compname as the computer name (HMI IPCs) and the compname is a windows environment variable to resolve the device that is running the code. We then are using case statements for each individual HMI. This is done because the supervisor could log in at any HMI and go to any screen, so the code has to have every single HMI name on every single display.
I've tried having a hidden display that would house the code for all the HMIs and commands. Then have the displays call that function, then I would only need to edit 1 display, not 500. I have roughly 50 HMIs at the time, and more adding constantly. I also have 10 users for the different areas in the plant in the SE environment, all with different user codes.
I only copied one HMIs code, but it is repeated for individual cases of HMIs up to all 50, utilizing the 10 users through the plant.
What I need is a way for ALL displays to call one global function or one display that always stays active. Then when I add an HMI I just have to edit the VBA code on one display, not 500.
I hope this makes sense, if you need me to try and explain differently please let me know and I can try to!
As it stands right now, when the plant adds an HMI, I have to update the code on EVERY SINGLE DISPLAY. I'm not talking a handful, I'm talking almost 500 displays.
Any Rockwell reccommended thing for auto logout/login never worked. Here is my code to start:
Private Sub RSView32SEIdleDetectControl1_EnterIdleState() 'ActiveX Control Command for Idle time.
Dim compname As String 'Declaring compname As a String.
compname = Environ$("computername") 'we use the Windows environment variable "computername" to resolve the name of the device' that's running our code. It is accessed via the Environ$(string environmentVariableName) function.
Select Case compname 'compname Select Case statements.
Case "4HEAD-HMI" 'This is the 4 Head Labeler HMI.
Select Case CurrentUserName() 'Grabbing current user.
Case "supv" 'For when user "supv" is logged in.
Application.Login "operatorX", "operatorX" 'Application executing the login for user "operatorX."
Case Else
End Select
So the breakdown is really this. The Active X event is the Sub. We delcare compname as the computer name (HMI IPCs) and the compname is a windows environment variable to resolve the device that is running the code. We then are using case statements for each individual HMI. This is done because the supervisor could log in at any HMI and go to any screen, so the code has to have every single HMI name on every single display.
I've tried having a hidden display that would house the code for all the HMIs and commands. Then have the displays call that function, then I would only need to edit 1 display, not 500. I have roughly 50 HMIs at the time, and more adding constantly. I also have 10 users for the different areas in the plant in the SE environment, all with different user codes.
I only copied one HMIs code, but it is repeated for individual cases of HMIs up to all 50, utilizing the 10 users through the plant.
What I need is a way for ALL displays to call one global function or one display that always stays active. Then when I add an HMI I just have to edit the VBA code on one display, not 500.
I hope this makes sense, if you need me to try and explain differently please let me know and I can try to!