mirror of
https://github.com/Andre-Bzk/FocusFix.git
synced 2026-11-15 09:33:14 +01:00
- Debug-Logging optional gemacht, den Legacy-Wrapper portabler aufgebaut (relative Pfade, Debug-Weitergabe, Python-Fallback) und die README für Endanwender und Entwickler klarer neu strukturiert.
51 lines
1.4 KiB
Plaintext
51 lines
1.4 KiB
Plaintext
Set WshShell = CreateObject("WScript.Shell")
|
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
|
|
|
Dim baseDir, pythonwPath, focusfixPath
|
|
baseDir = fso.GetParentFolderName(WScript.ScriptFullName)
|
|
pythonwPath = fso.BuildPath(baseDir, ".venv\Scripts\pythonw.exe")
|
|
focusfixPath = fso.BuildPath(baseDir, "focusfix.py")
|
|
|
|
If Not fso.FileExists(pythonwPath) Then
|
|
pythonwPath = "pythonw.exe"
|
|
End If
|
|
|
|
Dim debugEnabled, exePath, exeName, gameCmd, arg, i
|
|
debugEnabled = False
|
|
exePath = ""
|
|
gameCmd = ""
|
|
|
|
For i = 0 To WScript.Arguments.Count - 1
|
|
arg = WScript.Arguments(i)
|
|
|
|
If arg = "-d" Or arg = "-debug" Or arg = "--debug" Then
|
|
debugEnabled = True
|
|
Else
|
|
If exePath = "" Then
|
|
exePath = arg
|
|
End If
|
|
gameCmd = gameCmd & """" & arg & """ "
|
|
End If
|
|
Next
|
|
|
|
If exePath = "" Then
|
|
WScript.Quit 1
|
|
End If
|
|
|
|
' Prozessname aus dem ersten nicht-Wrapper-Argument (Steam %command%) extrahieren
|
|
exeName = fso.GetBaseName(exePath)
|
|
|
|
' FocusFix Script unsichtbar starten (pythonw = kein Konsolenfenster)
|
|
Dim focusfixCmd
|
|
focusfixCmd = """" & pythonwPath & """ """ & focusfixPath & """"
|
|
If debugEnabled Then
|
|
focusfixCmd = focusfixCmd & " -debug"
|
|
End If
|
|
focusfixCmd = focusfixCmd & " --process """ & exeName & """"
|
|
WshShell.Run focusfixCmd, 0, False
|
|
|
|
' Spiel starten: alle übrigen Argumente (= Steam %command%) zusammensetzen und ausführen
|
|
If Trim(gameCmd) <> "" Then
|
|
WshShell.Run gameCmd, 1, False
|
|
End If
|