Files
hms-mediaengine/HMS-Start.vbs
T

52 lines
1.8 KiB
Plaintext
Raw Normal View History

' HMS MediaEngine - Windows-Starter (unsichtbar, Doppelklick)
' Startet die Engine im Hintergrund (nur Browser sichtbar).
' Fehlen Abhaengigkeiten, oeffnet sich der grafische Installer.
Option Explicit
Dim fso, sh, py, cand, dir_, tmpFile, ts, out
Dim candidates(3)
Set fso = CreateObject("Scripting.FileSystemObject")
Set sh = CreateObject("WScript.Shell")
dir_ = fso.GetParentFolderName(WScript.ScriptFullName)
py = ""
candidates(0) = sh.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Programs\Python\Python313\pythonw.exe"
candidates(1) = sh.ExpandEnvironmentStrings("%LOCALAPPDATA%") & "\Programs\Python\Python312\pythonw.exe"
candidates(2) = "C:\Python313\pythonw.exe"
candidates(3) = "C:\Python312\pythonw.exe"
For Each cand In candidates
If py = "" Then
If fso.FileExists(cand) Then py = cand
End If
Next
If py = "" Then
' PATH-Suche VERSTECKT (sh.Exec wuerde ein Konsolenfenster zeigen):
' cmd versteckt laufen lassen, Ausgabe in Temp-Datei
tmpFile = sh.ExpandEnvironmentStrings("%TEMP%") & "\hms_py_path.txt"
On Error Resume Next
sh.Run "cmd /c where pythonw > """ & tmpFile & """ 2>nul", 0, True
If fso.FileExists(tmpFile) Then
Set ts = fso.OpenTextFile(tmpFile, 1)
If Not ts.AtEndOfStream Then
out = Trim(ts.ReadLine())
If Len(out) > 4 Then
If fso.FileExists(out) Then py = out
End If
End If
ts.Close
fso.DeleteFile tmpFile, True
End If
On Error GoTo 0
End If
If py = "" Then
MsgBox "Python wurde nicht gefunden." & vbCrLf & vbCrLf & _
"Bitte einmal 'HMS-Install.vbs' doppelklicken -" & vbCrLf & _
"es installiert Python und GStreamer ueber grafische Installer.", _
48, "HMS MediaEngine"
WScript.Quit 1
End If
sh.CurrentDirectory = dir_
sh.Run Chr(34) & py & Chr(34) & " " & Chr(34) & dir_ & "\launcher.pyw" & Chr(34), 0, False