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")
|
||||
|
||||
' Verificar si ya está corriendo en puerto 5500
|
||||
Dim oExec, sOut
|
||||
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5500 | findstr LISTENING")
|
||||
sOut = oExec.StdOut.ReadAll()
|
||||
If Len(Trim(sOut)) > 0 Then
|
||||
MsgBox "MarineMaintenance ya está corriendo en el puerto 5500.", 64, "MarineMaintenance"
|
||||
oShell.Run "http://localhost:5500", 1, False
|
||||
WScript.Quit
|
||||
End If
|
||||
|
||||
' Iniciar servidor oculto — redirige salida al log
|
||||
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 :5500 | findstr LISTENING")
|
||||
sOut = oExec.StdOut.ReadAll()
|
||||
If Len(Trim(sOut)) > 0 Then
|
||||
MsgBox "MarineMaintenance iniciado correctamente." & vbCrLf & vbCrLf & _
|
||||
"URL: http://localhost:5500" & vbCrLf & _
|
||||
"Tailscale: http://100.96.43.86:5500", 64, "MarineMaintenance"
|
||||
oShell.Run "http://localhost:5500", 1, False
|
||||
Else
|
||||
MsgBox "El servidor tardó en iniciar. Revisa logs\server.log si hay errores.", 48, "MarineMaintenance"
|
||||
MsgBox "El servidor no respondio. Revisa logs\server.log", 48, "MarineMaintenance"
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user