Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enableextensions enabledelayedexpansion
- echo ####################
- echo #Raw and Sub Merger#
- echo ####################
- echo.
- echo This batch file was created to merge a Manga with a translation overlay.
- echo.
- echo Known limitations include:
- echo All file names should be in the form of Manga[RAW].zip, Manga[SUB].zip and the output will be Manga.zip.
- echo The actual name has to match but need not be case sensitive in Windows.
- echo Subfolders within the zip file will probably not work.
- echo All image file names have to match for them to merge.
- echo Any image missing a matching overlay will probably cause an error.
- echo The files can use any compression method compatible with 7zip but the name needs to end in .zip.
- echo This batch file requies 7zip and ImageMagick installed to work.
- echo If 7zip fails, make sure you have the correct version (64 bit for 64 bit) installed for your OS and that it's in the %programfiles% folder.
- echo This has only been tested on Windows 7. Probably will not work for anything older than Win 2k.
- echo.
- set /P file_name="Enter the name of the manga you want merged or enter all to attempt to merge all manga in this folder: "
- IF /I "%file_name%"=="quit" (goto BatchEnd)
- IF /I "%file_name%"=="exit" (goto BatchEnd)
- IF /I "%file_name%"=="ALL" (
- call:MergeFolder
- ) ELSE (
- call:SubMerge %file_name%[RAW] %file_name%[SUB] %file_name%
- )
- pause
- goto BatchEnd
- ::##############
- ::#Merge Folder#
- ::##############
- :MergeFolder
- for %%b in (*.zip) do (
- call:CheckName %%~nb
- )
- goto:eof
- :CheckName
- set str1=%1
- if /I not "x%str1:[RAW]=%"=="x%str1%" call:SubMerge %str1% %str1:[RAW]=[SUB]% %str1:[RAW]=%
- goto:eof
- ::################
- ::#Merge Function#
- ::################
- :SubMerge
- set PATH=%PATH%;%programfiles%\7-Zip\
- set RAW=%CD%\Raw
- set SUB=%CD%\Sub
- set MRG=%CD%\%~3
- md "%MRG%"
- echo Extracting %~1.zip ...
- echo.
- 7z e %~1.zip -o"%RAW%"
- echo Extracting %~2.zip ...
- echo.
- 7z e %~2.zip -o"%SUB%"
- echo Merging files ...
- echo.
- cd Raw
- for %%a in (*.png) do convert "%RAW%\%%a" "%SUB%\%%a" -composite "%MRG%\%%a"
- cd ..
- echo Creating archive ...
- echo.
- 7z a -tzip %~3.zip "%MRG%"
- echo Cleaning up ...
- echo.
- rmdir /s /q "%RAW%"
- rmdir /s /q "%SUB%"
- rmdir /s /q "%MRG%"
- echo Done.
- goto:eof
- :BatchEnd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement