mirror of
https://gitlab.com/ryzen-controller-team/ryzen-controller.git
synced 2024-12-21 17:43:29 +07:00
fix: #180 Change autostart method to VBS script.
This commit is contained in:
parent
c97b33de87
commit
8afdfac3f2
4
public/bin/Ryzen Controller Autostart.vbs
Normal file
4
public/bin/Ryzen Controller Autostart.vbs
Normal 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
|
@ -97,15 +97,24 @@ const RyzenControllerSettingsDefinitions: RyzenControllerSettingDefinitionList =
|
||||
});
|
||||
|
||||
// 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")
|
||||
.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 {
|
||||
window.require("electron").remote.app.setLoginItemSettings({
|
||||
openAtLogin: toBeEnabled,
|
||||
path: path,
|
||||
path: autostartVBS,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
rej(error);
|
||||
}
|
||||
res(true);
|
||||
|
Loading…
Reference in New Issue
Block a user