Make Local Agent desktop dashboard single-instance
This commit is contained in:
@@ -1,26 +1,22 @@
|
||||
Option Explicit
|
||||
|
||||
Dim fso, shell, baseDir, launcher, pyw, py, cmd
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
Dim shell, fso, root, pythonw, dashboard, command
|
||||
Set shell = CreateObject("WScript.Shell")
|
||||
Set fso = CreateObject("Scripting.FileSystemObject")
|
||||
|
||||
baseDir = fso.GetParentFolderName(WScript.ScriptFullName)
|
||||
launcher = baseDir & "\ERPAgentDashboard.pyw"
|
||||
pyw = baseDir & "\.venv\Scripts\pythonw.exe"
|
||||
py = baseDir & "\.venv\Scripts\python.exe"
|
||||
root = fso.GetParentFolderName(WScript.ScriptFullName)
|
||||
pythonw = fso.BuildPath(root, ".venv\Scripts\pythonw.exe")
|
||||
dashboard = fso.BuildPath(root, "ERPAgentDashboard.pyw")
|
||||
|
||||
If Not fso.FileExists(launcher) Then
|
||||
MsgBox "ERPAgentDashboard.pyw was not found in " & baseDir, 16, "ERP Local Agent"
|
||||
WScript.Quit
|
||||
If Not fso.FileExists(pythonw) Then
|
||||
MsgBox "ERP Local Agent Python environment was not found:" & vbCrLf & pythonw, vbCritical, "ERP Local Agent"
|
||||
WScript.Quit 1
|
||||
End If
|
||||
|
||||
If fso.FileExists(pyw) Then
|
||||
cmd = """" & pyw & """ """ & launcher & """"
|
||||
ElseIf fso.FileExists(py) Then
|
||||
cmd = """" & py & """ """ & launcher & """"
|
||||
Else
|
||||
MsgBox "ERP Local Agent Python environment was not found.", 16, "ERP Local Agent"
|
||||
WScript.Quit
|
||||
If Not fso.FileExists(dashboard) Then
|
||||
MsgBox "ERP Local Agent dashboard launcher was not found:" & vbCrLf & dashboard, vbCritical, "ERP Local Agent"
|
||||
WScript.Quit 1
|
||||
End If
|
||||
|
||||
shell.Run cmd, 0, False
|
||||
command = Chr(34) & pythonw & Chr(34) & " " & Chr(34) & dashboard & Chr(34)
|
||||
shell.Run command, 0, False
|
||||
|
||||
Reference in New Issue
Block a user