From 82b667b83b00f3d82a889aa384bbe178308480d2 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Mon, 25 Apr 2022 18:37:41 -0700 Subject: [PATCH] fix some script related issues --- resources/js/index.js | 11 +++++++---- scripts/install.cmd | 5 ----- scripts/private_server_launch.cmd | 8 +------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/resources/js/index.js b/resources/js/index.js index 6f4f4a0..d0042a8 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -2,6 +2,9 @@ Neutralino.init(); let localeObj; const filesystem = Neutralino.filesystem +const createCmdWindow = async (command) => { + Neutralino.os.execCommand(`cmd.exe /c start ${command}`, { background: true }) +} /** * Enable play buttons @@ -283,7 +286,7 @@ async function closeFirstTimePopup() { } async function runInstallScript() { - Neutralino.os.execCommand(`${NL_CWD}/scripts/install.cmd "${NL_CWD}" true`) + createCmdWindow(`${NL_CWD}/scripts/install.cmd "${NL_CWD}" true`) // Create an interval that will check for the proxy server installation finish const interval = setInterval(async () => { @@ -380,7 +383,7 @@ async function setGrasscutterFolder() { async function launchOfficial() { const config = await getCfg() - Neutralino.os.execCommand(config.gamefolder + '/' + await getGameExecName()) + createCmdWindow(config.gamefolder + '/' + await getGameExecName()) } /** @@ -399,11 +402,11 @@ async function launchPrivate() { Neutralino.storage.setData('config', JSON.stringify(config)) // Pass IP and game folder to the private server launcher - Neutralino.os.execCommand(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} ${port} ${config.useHttps} "${config.gamefolder}/${await getGameExecName()}" "${NL_CWD}" ${config.enableKillswitch} true`).catch(e => console.log(e)) + createCmdWindow(`${NL_CWD}/scripts/private_server_launch.cmd ${ip} ${port} ${config.useHttps} "${config.gamefolder}/${await getGameExecName()}" "${NL_CWD}" ${config.enableKillswitch} true`).catch(e => console.log(e)) } async function launchLocalServer() { const config = await getCfg() - Neutralino.os.execCommand(`${NL_CWD}/scripts/local_server_launch.cmd "${config.serverFolder}"`).catch(e => console.log(e)) + createCmdWindow(`${NL_CWD}/scripts/local_server_launch.cmd "${config.serverFolder}"`).catch(e => console.log(e)) } diff --git a/scripts/install.cmd b/scripts/install.cmd index 71d6c5c..178f1a7 100644 --- a/scripts/install.cmd +++ b/scripts/install.cmd @@ -2,11 +2,6 @@ set ORIGIN=%1 set ORIGIN=%ORIGIN:"=% -set OPEN_CONCUR=%2 - -if "%OPEN_CONCUR%" EQU "true" ( - cd /d "%~dp0" && ( if exist "%temp%\start.vbs" del "%temp%\start.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set SHELL = CreateObject^("Shell.Application"^) : SHELL.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 "%1" false", "", "", 1 >> "%temp%\start.vbs" && "%temp%\start.vbs" && exit /B ) -) echo Downloading proxy server... diff --git a/scripts/private_server_launch.cmd b/scripts/private_server_launch.cmd index 887226b..c6e3402 100644 --- a/scripts/private_server_launch.cmd +++ b/scripts/private_server_launch.cmd @@ -6,12 +6,6 @@ @REM cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %1 %2 %3 "%4" ""%cd%"" %6", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B ) @REM ) -set OPEN_CONCUR=%7 - -if "%OPEN_CONCUR%" EQU "true" ( - cd /d "%~dp0" && ( if exist "%temp%\start.vbs" del "%temp%\start.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set SHELL = CreateObject^("Shell.Application"^) : SHELL.ShellExecute "cmd.exe", "/k cd ""%~sdp0"" && %~s0 %1 %2 %3 "%4" ""%cd%"" %6", "", "", 1 >> "%temp%\start.vbs" && "%temp%\start.vbs" && exit /B ) -) - :: Use to force task kill title PS Launcher Script @@ -86,7 +80,7 @@ taskkill /f /im mitmdump.exe echo Done, see you next time -timeout /t 2 /nobreak >nul +timeout.exe /t 2 /nobreak >nul taskkill /f /fi "WINDOWTITLE eq Administrator: PS Launcher Script" || taskkill /f /fi "WINDOWTITLE eq PS Launcher Script"