I aim to provide a clear explanation of my situation, and I'm happy to elaborate further if necessary. In my facility, there are about 5 or 6 distinct areas, each featuring all SE screens along with a main menu. Access levels vary: some users can navigate the entire collection of screens, while others are restricted to their designated area. The unique challenge I face involves the behavior of the DeskLock application. Specifically, when a supervisor or engineer logs in and subsequently either logs out or is automatically logged out after a specified time (for instance, 5 minutes on VersaView), I need the startup macro for that area to reinitiate the login process. For example, if a supervisor accesses the Filler area, logs out, or is logged out automatically, I want the FillerArea startup macro (or a dedicated FillerArea login macro, if necessary) to activate and automatically log in the FillerOperator user. This requirement applies to each area in the plant since there is only one header screen housing the Login and Logout buttons. My goal is to configure the login button in such a way that it triggers a specific macro tailored to each client's area, given that I manage 5 or 6 areas, each comprising 4 or more screens.
For valuable insights and assistance, you might want to check out the discussion in this thread: http://www.plctalk.net/qanda/showthread.php?t=95319. Best regards!
gclshortt commented: [View the discussion thread here](http://www.plctalk.net/qanda/showthread.php?t=95319). This thread might provide the information you need. Best regards! I've reviewed this suggestion, but it doesn't quite align with my requirements. I am not seeking a "view-only" login; rather, I want to access one of the six startup macros that I have developed. Each operational area requires distinct permissions. For instance, the Filler area should log out and switch to the FillerOperator, while the Capping area must log out and transition to the CappingOperator, both of which operate on separate sides of the facility. Currently, I have a single main menu with a Logout button, which simplifies the interface without cluttering it with numerous screens. Ideally, within the SE environment of the Studio, I would like the Logout button to perform a Login action (specifically, Login startup macro "x"). This means it should log in using FillerMacro or CappingMacro, etc. Although I can set it to log in as a generic operator, that is not my intention. I want the system to log in using the macro that corresponds to the specific client, ensuring that the Logout function logs in the appropriate user profile for that client, rather than just redirecting to the screen.
To effectively resolve this issue, it's essential to incorporate Visual Basic for Applications (VBA). Since FactoryTalk View (FTView) lacks the capability to identify the specific client on which it is operating, utilizing VBA is crucial. By retrieving the PC name through VBA, you can determine the appropriate macro to execute based on the identified client. This approach ensures a tailored solution for your automation needs.
The ASF team stated that you will likely need to integrate VBA (Visual Basic for Applications) to effectively manage client-specific operations in FTView. Since FTView lacks the capability to determine the client being used, VBA is essential for retrieving the PC name. This PC name can then be used to determine which macro should be executed.
If you're looking for a command to obtain the PC name, the only one that comes to mind is `Application.GetHMIServerComputerName`, although this method hasn't proven effective in my case.
Here's an example of the code I'm working with:
```vb
' Note: This code utilizes the RSVIEW32/SE IDLE DETECT CONTROL ActiveX Control
Private Sub RSView32SEIdleDectectControl1_EnterIdleState()
Dim computername As String
computername =
We successfully navigated this issue. Itβs surprising, but embedded commands often fail to function properly within the FTV environment. To illustrate how I tackled this challenge using VBA, consider the following example: ```vba Dim compName As String compName = Environ$("COMPUTERNAME") 'Utilizing the Windows environment variable "COMPUTERNAME" allows us to identify the device running our code. This is done using the Environ$(string environmentVariableName) function. Select Case compName Case "Client4" Select Case CurrentUserName() Case "supervisor" Application.Login "operator", "operator" Application.ExecuteCommand "Display ""Main Menu""" Case Else End Select End Select ``` You can adapt this approach for additional clients as needed. This method efficiently resolves the device name issue and ensures proper user authentication within your application.
β Work Order Management
β Asset Tracking
β Preventive Maintenance
β Inspection Report
We have received your information. We will share Schedule Demo details on your Mail Id.
Join hundreds of satisfied customers who have transformed their maintenance processes.
Sign up today and start optimizing your workflow.