fix: #180 Change autostart method to VBS script.

This commit is contained in:
Torsten Simon 2021-10-25 07:47:08 +00:00 committed by Quentin “Storm1er” Decaunes
parent c97b33de87
commit 8afdfac3f2
2 changed files with 16 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Set WshShell = CreateObject("WScript.Shell" )
scriptdir = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName)
WshShell.Run """" + scriptdir + "\..\..\..\..\Ryzen Controller""", 0
Set WshShell = Nothing

View File

@ -97,15 +97,24 @@ const RyzenControllerSettingsDefinitions: RyzenControllerSettingDefinitionList =
}); });
// Handle new auto launch system. // Handle new auto launch system.
const path = `${window
// C:\git\ryzen-controller\dist\win-unpacked\resources\app.asar\..\app.asar.unpacked\
// workaround with vbs, since admin permissions exe is not suitable for autostart
let ryzenControllerPath = window
.require("electron") .require("electron")
.remote.app.getAppPath()}.unpacked\\build\\bin\\auto-start-ryzen-controller.bat`; .remote.app.getAppPath()
.split("\\");
delete ryzenControllerPath[ryzenControllerPath.length - 1];
ryzenControllerPath = ryzenControllerPath.join("\\");
const autostartVBS = ryzenControllerPath + "app.asar.unpacked\\build\\bin\\Ryzen Controller Autostart.vbs";
try { try {
window.require("electron").remote.app.setLoginItemSettings({ window.require("electron").remote.app.setLoginItemSettings({
openAtLogin: toBeEnabled, openAtLogin: toBeEnabled,
path: path, path: autostartVBS,
}); });
} catch (error) { } catch (error) {
console.error(error);
rej(error); rej(error);
} }
res(true); res(true);