KB-109599: Limiting the amount of Viewers in Elipse E3 via scripts.

Question:

Is it possible to limit, via scripts, the amount of Viewers in an application developed with Elipse E3? I need that each different computer open only one Viewer. Since  the computers on the network have dynamic IPs, I can’t use Viewer Groups in the Domain Options.

 

Solution:

The Viewer object allows operating the applications residing in the server from any computer with the executable program Viewer (Windows XP, 2003, Vista, and Windows 7) or from a browser connected to the Internet. In both cases, you don’t need to install the application in the client machine; all its components (Screens, Libraries, ActiveX controls) will be automatically downloaded and registered.

 

In order to limit the amount of Viewers in an application developed with Elipse E3 in a group of IPs, you must first access the Domain’s setup window (E3Admin -> Domain -> Options). Then, click Viewers Group and select the desired group; after that, configure it so it will only open one Viewer at a time.

Elipse E3 won’t allow any configurations that limits the amount of Viewers per IP inside a group. Therefore, you would need to create several groups, with only one IP per group, and then limit the amount of Viewer in these groups.

Since the process described above would be time-consuming in a large range of IPs, an alternative for this case would be to check, via scripts, if there are any Viewer processes already being executed in the computer. If so, the new Viewer would be closed via scripts.

This alternative would consume a Viewer license, temporarily, while the script is running and the Viewer closes.

You should then add the following script to the Viewer’s OnStartRunning event:

ProcessName = "Viewer.exe"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\localhostrootcimv2")
Set results = objWMIService.ExecQuery(" Select * from Win32_Process where Name = '"& ProcessName &"'")
If results.count >1 Then
  For each obj in results
    MsgBox "There already is a Viewer open in this computer!"
    Application.Exit()
    Exit Sub
  Next
End If

 

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *