Question:
Is it possible to display on the Viewer all users that are logged into multiple Viewers in the Server?
Solution:
Yes. Elipse E3 version 5.5 comes with a new ServerNode object in E3Server, called Server Information (“[?Server]”). From this object, you can access the session’s information.
Using brackets when referring to this objects via scripts is mandatory; for example “[?Server].Clients.Viewers”.
In the example below you can see the script that returns the login name of the session user, alongside the name of the client machine:
set obj = Application.GetObject("[?Server].Clients.Viewers") i=1 For each ii in obj msg = "" msg = msg & "Item: " & i & chr(10) & chr(13) msg = msg & "User: " & obj.Item(i).User & chr(10) & chr(13) msg = msg & "Machine: " & obj.Item(i).Machine & chr(10) & chr(13) i=i+1 msgbox msg next
For further information about the object (“[?Server]”), please refer to the following article: Server Information object (“[?Server]”).
For versions lower than 5.5, you can use the procedure below to check the users logged to multiple Viewers.
The attached application is an example that shows it is possible to display which users are logged in the server, considering multiple Viewers on the network.
To do so, an internal tag was inserted in the Data folder. The tag performs as an array, since that each array position stores a logged user. For further information on vectors, please refer to the related article below.
NOTE 1: The button for closing a window at the Viewer was disabled, so that the operator will not forget to log out the user. A button was created on screen to both close the Viewer and log out the user.
NOTE 2: This system cannot use a Viewer-Only, because they are not allowed to write in the server.