diff --git a/server/scripts/start-hidden.vbs b/server/scripts/start-hidden.vbs index 701b8af..6448bea 100644 --- a/server/scripts/start-hidden.vbs +++ b/server/scripts/start-hidden.vbs @@ -1,9 +1,23 @@ +' Launch wled_controller silently (no console, no window). +' Used by the Start Menu / autostart / desktop shortcut created by the +' NSIS installer. Must set the same env vars as LedGrab.bat, otherwise +' the server runs with built-in defaults (wrong config path, wrong data +' dir) and the UI appears to be unconfigured on every startup. + Set fso = CreateObject("Scripting.FileSystemObject") Set WshShell = CreateObject("WScript.Shell") + ' Get the directory of this script (scripts\), then go up to app root scriptDir = fso.GetParentFolderName(WScript.ScriptFullName) appRoot = fso.GetParentFolderName(scriptDir) WshShell.CurrentDirectory = appRoot + +' Set environment variables for the child process. WshShell.Environment("Process") +' is writable and child processes spawned via Run inherit it. +Set procEnv = WshShell.Environment("Process") +procEnv("PYTHONPATH") = appRoot & "\app\src" +procEnv("WLED_CONFIG_PATH") = appRoot & "\app\config\default_config.yaml" + ' Use embedded Python if present (installed dist), otherwise system Python embeddedPython = appRoot & "\python\pythonw.exe" If fso.FileExists(embeddedPython) Then