Update MultiDrop.bat

This commit is contained in:
Laggamer2005 2024-11-17 09:52:59 +00:00 committed by GitHub
parent 49f73eb3d6
commit 232cc96016
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,56 +1,47 @@
@echo off
setlocal
setlocal enabledelayedexpansion
title ModMii MultiDrop
::chdir /d "%~dp0"
pushd "%~dp0"
cd ..\..
if not exist ModMii.exe (
echo Error: ModMii.exe not found.
goto :exit
)
if not exist temp\MultiDrop.txt (
echo Error: temp\MultiDrop.txt not found.
goto :exit
)
cls
cd ../..
if not exist ModMii.exe exit
if not exist temp\MultiDrop.txt exit
support\sfk echo [Red]ModMii MultiDrop
echo.
echo To interrupt sending dropped files to ModMii, close this window.
echo.
echo If you manually close ModMii but want to continue sending dropped files, enter N when asked to terminate batch job
echo.
::for /f %%a in (temp\MultiDrop.txt) do (set /a TotalItems+=1)
support\sfk echo [Blue]MultiDrop Queue
::Loop through the the following once for EACH line in *.txt, but respecting & ^ using !!
setlocal ENABLEDELAYEDEXPANSION
set /a TotalItems=0
for /F "tokens=*" %%A in (temp\MultiDrop.txt) do call :process "%%A"
goto:skip
:process
set command=%*
set "command=!command:^^=^!"
set "command=!command:~1,-1!"
set /a TotalItems=%TotalItems%+1
echo %TotalItems%: "!command!"
goto:EOF
:skip
::setlocal DISABLEDELAYEDEXPANSION
for /F "usebackq delims=" %%A in ("temp\MultiDrop.txt") do (
set "command=%%~A"
set /a TotalItems+=1
echo !TotalItems!: "!command!"
)
echo.
support\sfk echo [Blue]Sending ModMii Commands
::Loop through the the following once for EACH line in *.txt, but respecting & ^ using !!
::setlocal ENABLEDELAYEDEXPANSION
set /a Item=0
for /F "tokens=*" %%A in (temp\MultiDrop.txt) do call :processMultilist "%%A"
goto:quickskip
:processMultilist
set command=%*
set "command=!command:^^=^!"
set "command=!command:~1,-1!"
set /a Item=%Item%+1
echo %Item% of %TotalItems%: "!command!"
start /WAIT ModMii.exe "!command!"
goto:EOF
:quickskip
::setlocal DISABLEDELAYEDEXPANSION
for /F "usebackq delims=" %%A in ("temp\MultiDrop.txt") do (
set "command=%%~A"
set /a Item+=1
echo !Item! of !TotalItems!: "!command!"
start /WAIT ModMii.exe "!command!"
)
echo.
support\sfk echo [Green]Finished, press any key to exit
pause>nul
exit
:exit
exit /b