Auto-open browser after server start
This commit is contained in:
+4
-10
@@ -8,27 +8,21 @@ sLog = sDir & "\logs\server.log"
|
|||||||
|
|
||||||
Set oShell = CreateObject("WScript.Shell")
|
Set oShell = CreateObject("WScript.Shell")
|
||||||
|
|
||||||
' Verificar si ya está corriendo en puerto 5000
|
|
||||||
Dim oExec, sOut
|
Dim oExec, sOut
|
||||||
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING")
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING")
|
||||||
sOut = oExec.StdOut.ReadAll()
|
sOut = oExec.StdOut.ReadAll()
|
||||||
If Len(Trim(sOut)) > 0 Then
|
If Len(Trim(sOut)) > 0 Then
|
||||||
MsgBox "MarineInvoice ya está corriendo en el puerto 5000.", 64, "MarineInvoice"
|
oShell.Run "http://localhost:5000", 1, False
|
||||||
WScript.Quit
|
WScript.Quit
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Iniciar servidor oculto — redirige salida al log
|
|
||||||
oShell.Run "cmd /c cd /d """ & sDir & """ && """ & sPython & """ app.py >> """ & sLog & """ 2>&1", 0, False
|
oShell.Run "cmd /c cd /d """ & sDir & """ && """ & sPython & """ app.py >> """ & sLog & """ 2>&1", 0, False
|
||||||
|
WScript.Sleep 2000
|
||||||
|
|
||||||
WScript.Sleep 1500
|
|
||||||
|
|
||||||
' Confirmar que arrancó
|
|
||||||
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING")
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING")
|
||||||
sOut = oExec.StdOut.ReadAll()
|
sOut = oExec.StdOut.ReadAll()
|
||||||
If Len(Trim(sOut)) > 0 Then
|
If Len(Trim(sOut)) > 0 Then
|
||||||
MsgBox "MarineInvoice iniciado correctamente." & vbCrLf & vbCrLf & _
|
oShell.Run "http://localhost:5000", 1, False
|
||||||
"URL: http://localhost:5000" & vbCrLf & _
|
|
||||||
"Tailscale: http://100.96.43.86:5000", 64, "MarineInvoice"
|
|
||||||
Else
|
Else
|
||||||
MsgBox "El servidor tardó en iniciar. Revisa logs\server.log si hay errores.", 48, "MarineInvoice"
|
MsgBox "El servidor no respondio. Revisa logs\server.log", 48, "MarineInvoice"
|
||||||
End If
|
End If
|
||||||
|
|||||||
@@ -79,3 +79,9 @@ If ok3 Then sMsg = sMsg & "OK AidsMonitoring -> http://localhost:5503" & vb
|
|||||||
sMsg = sMsg & vbCrLf & "AR ECDIS lanzado (ventana independiente)"
|
sMsg = sMsg & vbCrLf & "AR ECDIS lanzado (ventana independiente)"
|
||||||
|
|
||||||
MsgBox sMsg, 64, "Servidores Marinos"
|
MsgBox sMsg, 64, "Servidores Marinos"
|
||||||
|
|
||||||
|
' Abrir browser para cada servidor que respondio
|
||||||
|
If ok0 Then oShell.Run "http://localhost:5000", 1, False
|
||||||
|
If ok1 Then oShell.Run "http://localhost:5500", 1, False
|
||||||
|
If ok2 Then oShell.Run "http://localhost:5010", 1, False
|
||||||
|
If ok3 Then oShell.Run "http://localhost:5503", 1, False
|
||||||
|
|||||||
Reference in New Issue
Block a user