Question:
How can I open an E3 application with a button, so that this application opens only once?
Solution:
To do so, create an internal tag in the Viewer, and then use the following script in the button’s OnClick() event:
‘Ret receives process’ value
ret = Application.Item(“InternalTag1”).Value
‘No calculator can be opened while the process is running
IF Application.IsAppRunning(ret) then
MsgBox “Calculator is already opened “, 64
else
‘Opens an external application (Windows calculator)
Application.ExecuteExternalApp “calc.exe”, “”, “”, 4, ret
‘Inserts ProcessID’s value in the Internal Tag
Application.Item(“InternalTag1”).Value = ret
END IF