Skip to content

Commit 19cdf9a

Browse files
authored
Update RCFI Tools.bat
...
1 parent c46a88e commit 19cdf9a

1 file changed

Lines changed: 150 additions & 26 deletions

File tree

RCFI Tools.bat

Lines changed: 150 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ goto Options-Input
3737
echo.&echo.&echo.&echo.
3838
set "Already="
3939
set "referer="
40-
call :timer-end
41-
if defined timestart set "processingtime=The proccess took %ExecutionTime% ^|"
40+
if defined timestart call :timer-end
4241
set "timestart="
4342
if /i "%Context%"=="refresh.NR" exit
4443
if defined Context (
@@ -67,6 +66,7 @@ if defined Context (
6766
:Options-Input
6867
if not defined OpenFrom echo %_%%GG_%Keyword%G_%^|%GG_%Scan%G_%^|%GG_%Template%G_%^|%GG_%Generate%G_%^|%GG_%Refresh%G_%^|%GG_%RefreshFc%G_%^|%GG_%Search%G_%^|%GG_%ON%G_%^|^
6968
%GG_%OFF%G_%^|%GG_%Remove%G_%^|%GG_%Config%G_%^|%GG_%Setup%G_%^|%GG_%RCFI%G_%^|%GG_%O%G_%^|%GG_%S%G_%^|%GG_%Help%G_%^|..
69+
if defined OpenFrom if /i not "%AlwaysAskTemplate%"=="yes" echo %g_%Template:%ESC%%cc_%%TemplateName%%ESC%
7070
echo %g_%--------------------------------------------------------------------------------------------------
7171
title %name% %version% "%cd%"
7272
call :Config-Save
@@ -148,6 +148,7 @@ if /i "%Context%"=="IMG-Convert" goto IMG-Convert
148148
if /i "%Context%"=="IMG-Resize" goto IMG-Resize
149149
REM Selected Dir
150150
if /i "%Context%"=="Change.Folder.Icon" %Dir% &call :Config-Save &set "Context="&set "OpenFrom=Context" &cls &echo.&echo.&echo.&goto Intro
151+
if /i "%Context%"=="Select.And.Change.Folder.Icon" goto FI-Selected_folder
151152
if /i "%Context%"=="DIR.Choose.Template" goto FI-Template
152153
if /i "%Context%"=="FI.Search.Folder.Icon" goto FI-Search
153154
if /i "%Context%"=="FI.Search.Poster" goto FI-Search
@@ -254,6 +255,94 @@ call :timer-start
254255
call :FI-Generate-Folder_Icon
255256
goto options
256257

258+
:FI-Selected_folder
259+
set "input=_0"
260+
set "cdonly=true"
261+
set "context="
262+
echo %TAB% %i_% Change folder icon for selected folders. %_%
263+
echo %TAB% %_%--------------------------------------------------------------------%_%
264+
for %%S in (%xSelected%) do (
265+
echo %TAB% 📂%ESC%%%~nxS%ESC%
266+
)
267+
echo %TAB% %_%--------------------------------------------------------------------%_%
268+
echo %TAB% %g_%Template:%ESC%%cc_%%TemplateName%%ESC%
269+
for %%S in (%xSelected%) do (
270+
for %%F in (%%S) do (
271+
set "FolderPath=%%~fF"
272+
set "FolderName=%%~nxF"
273+
set "ReplaceThis="
274+
if exist "%%~fF\desktop.ini" for /f "usebackq tokens=1,2 delims==" %%C in ("%%~fF\desktop.ini") do set "%%C=%%D" 2>nul
275+
call :FI-Selected_folder-input
276+
)
277+
)
278+
set "context=FI-Selected_folder"
279+
goto options
280+
281+
:FI-Selected_folder-input
282+
echo.
283+
if not exist "%input%" echo %g_%to enter the image path you can drag and drop the image here. then press enter. ^
284+
&echo %g_%-------------------------------------------------------------------------------------------------- ^
285+
&set /p "Input=%_%%w_%Enter the image path:%_%%c_%"
286+
set "Input=%Input:"=%"
287+
if not exist "%Input%" (
288+
echo.
289+
echo.
290+
echo %TAB% %_%Invalid path.
291+
echo %TAB%%ESC%%r_%%i_%%input%%ESC%
292+
echo %TAB% %g_%Make sure to enter a valid file path.%_%
293+
echo.
294+
echo.
295+
call :FI-Selected_folder-input
296+
)
297+
set "RefreshOpen=Select"
298+
set "Selected="
299+
for %%I in ("%input%") do (
300+
set "filename=%%~nxI"
301+
set "filepath=%%~dpI"
302+
set "fileext=%%~xI"
303+
)
304+
for %%X in (%ImageSupport%) do (
305+
if "%%X"=="%fileext%" (
306+
echo.
307+
echo %TAB%%ESC%%yy_%📁 %FolderName%%_%%ESC%
308+
PUSHD "%FolderPath%"
309+
310+
if defined iconresource if /i not "%replace%"=="all" (
311+
echo %TAB%%ESC%Folder icon:%c_%%iconresource%%ESC%
312+
attrib -s -h "%iconresource%"
313+
attrib |exit /b
314+
echo.
315+
echo %TAB% This folder already has a folder icon.
316+
echo %TAB% Do you want to replace it^? %gn_%A%_%/%gn_%Y%_%/%gn_%N%bk_%
317+
echo %TAB%%g_% Press %gg_%Y%g_% to confirm.%_%%g_% Press %gg_%A%g_% to confirm all.%k_%
318+
CHOICE /N /C AYN
319+
IF "%ERRORLEVEL%"=="1" set "replace=all"
320+
IF "%ERRORLEVEL%"=="3" (
321+
echo %_%%TAB% %I_% Skip %_%
322+
attrib +h "%iconresource%"
323+
attrib -|exit /b
324+
set "iconresource="
325+
exit /b
326+
)
327+
set "ReplaceThis=%iconresource%"
328+
)
329+
call :FI-Generate-Folder_Icon
330+
331+
POPD
332+
set "iconresource="
333+
exit /b
334+
)
335+
)
336+
echo.
337+
echo %TAB% %r_%File format not supported.%-%
338+
echo %TAB% %g_%^(supported file: %ImageSupport%^)
339+
echo.
340+
set "input="
341+
call :FI-Selected_folder-input
342+
exit /b
343+
344+
345+
257346
:FI-GetDir
258347
set "locationCheck=Start"
259348
REM Current dir only
@@ -614,7 +703,7 @@ if /i "%TemplateChoice%"=="NotSelected" echo %_%%TAB% %i_% CANCELED %-%&%p2%
614703
if /i "%TemplateChoice%"=="r" cls&echo.&echo.&echo.&goto FI-Template
615704
if /i "%TemplateChoice%"=="s" set "act=FI-Template-Sample-All" &set "FITSA=%TemplateSampleImage%"&start "" "%~f0"&cls&echo.&echo.&echo.&goto FI-Template
616705

617-
rem Proccess valid selected options
706+
rem Process valid selected options
618707
set "TSelector=Select"&set "TCount=0"
619708
PUSHD "%rcfi%\template"
620709
FOR %%T in (*.bat) do (
@@ -713,6 +802,7 @@ if exist "%outputFile%" for %%C in ("%outputFile%") do (
713802
exit /b
714803

715804
:FI-Template-Sample-All
805+
call :Timer-start
716806
if /i "%Context%"=="IMG.Template.Samples" (
717807
for %%I in ("%img%") do (
718808
set "FITSA=%%~fI"
@@ -746,8 +836,13 @@ PUSHD "%rcfi%\template"
746836
POPD
747837
echo %TAB%%i_%%yy_% Done! %_%
748838
if /i "%Context%"=="IMG.Template.Samples" (
749-
"%montage%" -pointsize 3 -label "%%f" -density 300 -tile 4x0 -geometry +3+2 -border 1 -bordercolor rgba^(210,210,210,0.3^) -background rgba^(255,255,255,0.4^) "%rcfi%\template\sample\*.ico" "%~dpn1-Folder_Samples.png"
750-
explorer.exe "%~dpn1-Folder_Samples.png"
839+
md "%rcfi%\template\sample\montage" 2>nul
840+
for /f "tokens=*" %%I in ('dir /b "%rcfi%\template\sample\*.ico"') do (
841+
"%converter%" "%rcfi%\template\sample\%%~nxI" -define icon:auto-resize="256" "%rcfi%\template\sample\montage\%%~nI.ico"
842+
)
843+
"%montage%" -pointsize 3 -label "%%f" -density 300 -tile 4x0 -geometry +3+2 -border 1 -bordercolor rgba^(210,210,210,0.3^) -background rgba^(255,255,255,0.4^) "%rcfi%\template\sample\montage\*.ico" "%~dpn1-Folder_Samples.png"
844+
explorer.exe "%~dpn1-Folder_Samples.png"
845+
rd /s /q "%rcfi%\template\sample\montage"
751846
) else explorer.exe "%rcfi%\template\sample\"
752847
goto options
753848

@@ -1213,14 +1308,15 @@ echo %TAB% %i_%%w_% Generating Icon.. %_%
12131308
echo.
12141309
echo %TAB%Template:%ESC%%cc_%%Tname%%ESC%
12151310
echo %TAB%%_%----------------------------------------------------%_%
1311+
if "%Context%"=="IMG.Generate.PNG" (set "OutputExt=.png") else (set "OutputExt=.ico")
12161312
FOR %%I in (%xSelected%) do (
12171313
set "IMGpath=%%~dpI"
12181314
set "IMGfullpath=%%~fI"
12191315
set "IMGname=%%~nI"
12201316
set "IMGext=%%~xI"
12211317
set "Size_B=%%~zI"
12221318
call :FileSize
1223-
Call :IMG-Generate_icon-Display
1319+
Call :IMG-Generate_icon-FileList
12241320
call :IMG-Generate_icon-Act
12251321
call :IMG-Generate_icon-Done
12261322
)
@@ -1229,20 +1325,19 @@ echo.
12291325
echo %TAB%%g_%%i_% Done! %_%
12301326
goto options
12311327

1232-
:IMG-Generate_icon-Display
1328+
:IMG-Generate_icon-FileList
12331329
if "%IMGext%"==".ico" set "IMGext=%y_%%IMGext%"
12341330
echo %_%%TAB%-%ESC%%c_%%IMGname%%bb_%%IMGext% %g_%(%pp_%%size%%g_%)%ESC%%r_%
12351331
exit /b
12361332

12371333
:IMG-Generate_icon-Act
12381334
set /a filenum+=1
12391335
set "InputFile=%IMGfullpath%"
1240-
set "OutputFile=%IMGpath%%IMGname%.ico"
1241-
if "%Context%"=="IMG.Generate.PNG" set "OutputFile=%IMGpath%%IMGname%.png"
1336+
set "OutputFile=%IMGpath%%IMGname%%OutputExt%"
12421337

12431338
if exist "%outputfile%" (
1244-
if not exist "%IMGpath%%IMGname%_(%filenum%).ico" (
1245-
set "outputfile=%IMGpath%%IMGname%_(%filenum%).ico"
1339+
if not exist "%IMGpath%%IMGname%-%filenum%%OutputExt%" (
1340+
set "outputfile=%IMGpath%%IMGname%-%filenum%%OutputExt%"
12461341
) else (
12471342
goto IMG-Generate_icon-Act
12481343
)
@@ -1260,7 +1355,7 @@ if exist "%outputfile%" (
12601355
set "IMGext=%%~xG"
12611356
set "Size_B=%%~zG"
12621357
call :FileSize
1263-
call :IMG-Generate_icon-Display
1358+
call :IMG-Generate_icon-FileList
12641359
)
12651360
) else (echo %TAB%%r_%Generate icon fail!)
12661361
exit /b
@@ -1336,21 +1431,40 @@ set "Action=Start" &cls&goto IMG-Convert
13361431
set Size_B=1
13371432
set "ImgOutput=%ImgName%%ImgExtNew%"
13381433
"%converter%" "%ImgPath%%ImgName%%ImgExt%" %convertcode% "%ImgPath%%ImgOutput%"
1434+
1435+
if "%ImgExt%"==".ico" (
1436+
PUSHD "%ImgPath%"
1437+
if exist "%ImgName%-*%ImgExtNew%" (
1438+
echo.
1439+
echo %TAB% %_%The icon file contains multiple resolution resources.
1440+
for /f %%G in ('dir /b "%ImgName%-*%ImgExtNew%"') do (
1441+
for %%I in ("%%~fG") do (
1442+
set "Size_B=%%~zI"
1443+
set "ImgName=%%~nI"
1444+
set "ImgExt=%%~xI"
1445+
call :FileSize
1446+
call :IMG-Convert-FileList
1447+
)
1448+
)
1449+
if not exist "%ImgPath%%ImgOutput%" exit /b
1450+
)
1451+
POPD
1452+
)
13391453
if exist "%ImgPath%%ImgOutput%" (
13401454
for %%I in ("%ImgPath%%ImgOutput%") do (
13411455
set "Size_B=%%~zI"
1456+
set "ImgName=%%~nI"
1457+
set "ImgExt=%%~xI"
13421458
call :FileSize
1459+
call :IMG-Convert-FileList
13431460
)
13441461
) else (
13451462
echo %TAB%-%ESC%%c_%%ImgName%%ImgExtNew%%g_% (%r_%Convert Fail!%g_%)%_%
13461463
exit /b
13471464
)
1348-
if not %Size_B% LSS 1000 (
1349-
echo %TAB%%_%-%ESC%%c_%%ImgName%%cc_%%ImgExtNew%%g_% (%pp_%%size%%g_%)%_%
1350-
) else (
1351-
echo %TAB%-%ESC%%c_%%ImgName%%ImgExtNew%%g_% (%r_%Convert Fail!%g_%)%_%
1465+
if %Size_B% LSS 100 (
1466+
echo %TAB% %r_%Convert Fail!%_%
13521467
del /q "%ImgPath%%ImgOutput%"
1353-
exit /b
13541468
)
13551469
exit /b
13561470

@@ -1589,13 +1703,13 @@ for %%S in (%xSelected%) do (
15891703
set "MKVdir=%%~dpS__"
15901704
set "size_B=%%~zS"
15911705
call :FileSize
1592-
call :MKV-Subtitle-merge_proccess
1706+
call :MKV-Subtitle-merge_process
15931707
)
15941708
)
15951709
echo %_%%i_% Done! %_%
15961710
goto options
15971711

1598-
:MKV-Subtitle-merge_proccess
1712+
:MKV-Subtitle-merge_process
15991713
set "MKVDisplay=yes"
16001714
set MKVfileDisplay=%c_%🎞%ESC%%c_%%MKVname%.mkv%_% %pp_%%size% %g_%(%size_B% Bytes)%ESC%
16011715
set MKVfileDisplay_=%c_%🎞%ESC%%c_%%MKVname%.mkv%_% %pp_%%size% %g_%(%size_B% Bytes)%ESC%
@@ -1916,6 +2030,7 @@ if %mins% gtr 0 set "show_mins=%mins%m "
19162030
if %hours% lss 1 set "show_hours="
19172031
if %hours% gtr 0 set "show_hours=%hours%h "
19182032
set ExecutionTime=%show_hours%%show_mins%%secs%.%ms%s
2033+
set "processingtime=The process took %ExecutionTime% ^|"
19192034
exit /b
19202035

19212036

@@ -2270,19 +2385,19 @@ if "%setup_select%"=="1" (
22702385
set "Setup_action=install"
22712386
set "HKEY=HKEY"
22722387
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v MultipleInvokePromptMinimum /t REG_DWORD /d 0x000003e8 /f >nul
2273-
goto Setup_Proccess
2388+
goto Setup_process
22742389
)
22752390
if "%setup_select%"=="2" (
22762391
echo %g_%Deactivating RCFI Tools%_%
22772392
set "Setup_action=uninstall"
22782393
set "HKEY=-HKEY"
22792394
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" /v MultipleInvokePromptMinimum /t REG_DWORD /d 0x0000000f /f >nul
2280-
goto Setup_Proccess
2395+
goto Setup_process
22812396
)
22822397
if "%setup_select%"=="3" goto options
22832398
goto Setup-Options
22842399

2285-
:Setup_Proccess
2400+
:Setup_process
22862401
set "Setup_Write=%~dp0Setup_%Setup_action%.reg"
22872402
call :Setup_Writing
22882403
if not exist "%~dp0Setup_%Setup_action%.reg" goto Setup_error
@@ -2427,10 +2542,17 @@ rem Generating setup_*.reg
24272542
:REG-FI-Change.Folder.Icon
24282543
echo [%RegExShell%\RCFI.Change.Folder.Icon]
24292544
echo "MUIVerb"="Change Folder Icon"
2430-
echo "Icon"="shell32.dll,-16801"
2545+
echo "Icon"="imageres.dll,-5303"
24312546
echo [%RegExShell%\RCFI.Change.Folder.Icon\command]
24322547
echo @="%cmd% set \"Context=Change.Folder.Icon\"%RCFIexe% \"%%V\""
24332548

2549+
:REG-FI-Select.And.Change.Folder.Icon
2550+
echo [%RegExShell%\RCFI.Select.And.Change.Folder.Icon]
2551+
echo "MUIVerb"="Select and Change Folder Icon"
2552+
echo "Icon"="imageres.dll,-5382"
2553+
echo [%RegExShell%\RCFI.Select.And.Change.Folder.Icon\command]
2554+
echo @="%Scmd% set \"Context=Select.And.Change.Folder.Icon\"%SRCFIexe% \"%%V\""
2555+
24342556
:REG-FI.Search.Folder.Icon
24352557
echo [%RegExShell%\RCFI.Search.Folder.Icon]
24362558
echo "MUIVerb"="Search Folder Icon"
@@ -2465,6 +2587,7 @@ rem Generating setup_*.reg
24652587
echo [%RegExShell%\RCFI.RefreshNR]
24662588
echo "MUIVerb"="Refresh Icon Cache (Without Restart)"
24672589
echo "Icon"="shell32.dll,-16739"
2590+
echo "CommandFlags"=dword:00000020
24682591
echo [%RegExShell%\RCFI.RefreshNR\command]
24692592
echo @="%cmd% set \"Context=RefreshNR\"%RCFIexe% \"%%V\""
24702593

@@ -2562,6 +2685,7 @@ rem Generating setup_*.reg
25622685
echo [%RegExShell%\RCFI.RefreshNR.Here]
25632686
echo "MUIVerb"="Refresh Icon Cache (Without Restart)"
25642687
echo "Icon"="shell32.dll,-16739"
2688+
echo "CommandFlags"=dword:00000020
25652689
echo [%RegExShell%\RCFI.RefreshNR.Here\command]
25662690
echo @="%cmd% set \"Context=RefreshNR.Here\"%RCFIexe% \"%%V\""
25672691

@@ -2658,13 +2782,13 @@ rem Generating setup_*.reg
26582782
echo [%RegExDir%\RCFI.Folder.Icon.Tools]
26592783
echo "MUIVerb"="Folder Icon Tools"
26602784
echo "Icon"="imageres.dll,-190"
2661-
echo "SubCommands"="RCFI.Change.Folder.Icon;RCFI.RefreshNR;RCFI.Refresh;RCFI.DIR.Choose.Template;RCFI.Search.Poster;RCFI.Search.Folder.Icon;RCFI.Scan;RCFI.DefKey;RCFI.GenKey;RCFI.GenJPG;RCFI.GenPNG;RCFI.GenPosterJPG;RCFI.GenLandscapeJPG;RCFI.ActivateFolderIcon;RCFI.DeactivateFolderIcon;RCFI.RemFolderIcon"
2785+
echo "SubCommands"="RCFI.Change.Folder.Icon;RCFI.Select.And.Change.Folder.Icon;RCFI.RefreshNR;RCFI.Refresh;RCFI.DIR.Choose.Template;RCFI.Search.Poster;RCFI.Search.Folder.Icon;RCFI.Scan;RCFI.DefKey;RCFI.GenKey;RCFI.GenJPG;RCFI.GenPNG;RCFI.GenPosterJPG;RCFI.ActivateFolderIcon;RCFI.DeactivateFolderIcon;RCFI.RemFolderIcon"
26622786

26632787
:REG-Context_Menu-FI-Background
26642788
echo [%RegExBG%\RCFI.Folder.Icon.Tools]
26652789
echo "MUIVerb"="Folder Icon Tools"
26662790
echo "Icon"="imageres.dll,-190"
2667-
echo "SubCommands"="RCFI.RefreshNR.Here;RCFI.Refresh.Here;RCFI.DIR.Choose.Template;RCFI.Search.Folder.Icon.Here;RCFI.Scan.Here;RCFI.DefKey;RCFI.GenKey.Here;RCFI.GenJPG.Here;RCFI.GenPNG.Here;RCFI.GenPosterJPG.Here;RCFI.GenLandscapeJPG.Here;RCFI.ActivateFolderIcon.Here;RCFI.DeactivateFolderIcon.Here;RCFI.RemFolderIcon.Here;RCFI.Edit.Config;RCFI.Ver.Context.Click;"
2791+
echo "SubCommands"="RCFI.RefreshNR.Here;RCFI.Refresh.Here;RCFI.DIR.Choose.Template;RCFI.Search.Folder.Icon.Here;RCFI.Scan.Here;RCFI.DefKey;RCFI.GenKey.Here;RCFI.GenJPG.Here;RCFI.GenPNG.Here;RCFI.GenPosterJPG.Here;RCFI.ActivateFolderIcon.Here;RCFI.DeactivateFolderIcon.Here;RCFI.RemFolderIcon.Here;RCFI.Edit.Config;RCFI.Ver.Context.Click;"
26682792

26692793
:REG-Context_Menu-Images
26702794
echo [%RegExImage%\RCFI.Tools]
@@ -2740,4 +2864,4 @@ echo %g_%MKV Tools detected%gg_%✓%g_%
27402864
echo @="%CMD% set \"Context=XML.Rename\"%RCFIexe% \"%%1\""
27412865

27422866
)>>"%Setup_Write%"
2743-
exit /b
2867+
exit /b

0 commit comments

Comments
 (0)