29 lines
949 B
Plaintext
29 lines
949 B
Plaintext
' MarineInvoice — Inicia servidor en segundo plano (sin ventana)
|
|
Option Explicit
|
|
Dim oShell, sDir, sPython, sLog
|
|
|
|
sDir = "C:\MarineInvoice"
|
|
sPython = "C:\Users\aerom\AppData\Local\Python\pythoncore-3.14-64\pythonw.exe"
|
|
sLog = sDir & "\logs\server.log"
|
|
|
|
Set oShell = CreateObject("WScript.Shell")
|
|
|
|
Dim oExec, sOut
|
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING")
|
|
sOut = oExec.StdOut.ReadAll()
|
|
If Len(Trim(sOut)) > 0 Then
|
|
oShell.Run "http://localhost:5000", 1, False
|
|
WScript.Quit
|
|
End If
|
|
|
|
oShell.Run "cmd /c cd /d """ & sDir & """ && """ & sPython & """ app.py >> """ & sLog & """ 2>&1", 0, False
|
|
WScript.Sleep 2000
|
|
|
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING")
|
|
sOut = oExec.StdOut.ReadAll()
|
|
If Len(Trim(sOut)) > 0 Then
|
|
oShell.Run "http://localhost:5000", 1, False
|
|
Else
|
|
MsgBox "El servidor no respondio. Revisa logs\server.log", 48, "MarineInvoice"
|
|
End If
|