Re: batch append not working - DOS
Posted: 2015-06-25T03:52:44-07:00
Code: Select all
IF EXIST %ZERO% GOTO APPEND1
:APPEND1
for %%f in (%ZERO%) do set BYTE=%%~zf
What do you think will happen if %ZERO% doesn't exist?
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=27889
Code: Select all
IF EXIST %ZERO% GOTO APPEND1
:APPEND1
for %%f in (%ZERO%) do set BYTE=%%~zf
Set FILESIZE=1000000
For %%a in (*.jpg) do (
Set ZERO=Blues\%%~na-007-a.jpg
for %%f in (%ZERO%) do set BYTE=%%~zf
IF %BYTE% LEQ %FILESIZE% (
convert Blues\%%~na-007-a.jpg Blues\%%~na-007-b.jpg Blues\%%~na-007-c.jpg Blues\%%~na-007-d.jpg -background grey +append Done\%%~na.jpg
) ELSE (
convert Blues\%%~na-007-a.jpg Blues\%%~na-007-b.jpg Blues\%%~na-007-c.jpg Blues\%%~na-007-d.jpg -background grey -append Done\%%~na.jpg
)
)
No commands were executed at all? I don't believe that.... the dos window simply exited without executing the commands.
Code: Select all
echo %BYTE%
Edit: I found the problem. Its the bloody parenthesis ().for %%f in ((NULL)) do set BYTE=%%~zf
echo
Code: Select all
For %%a in (*.jpg) do Set ZERO=Blues\%%~na-007-a.jpg
For %%f in (%ZERO%) do set BYTE=%%~zf
Code: Select all
Set FILESIZE=1000000
For %%a in (*.jpg) do Set ZERO=Blues\%%~na-007-a.jpg
For %%f in (%ZERO%) do set BYTE=%%~zf
IF %BYTE% LEQ %FILESIZE% GOTO APPEND1 ELSE GOTO APPEND2
:APPEND1
convert Blues\%%~na-007-a.jpg Blues\%%~na-007-b.jpg Blues\%%~na-007-c.jpg Blues\%%~na-007-d.jpg -background grey +append Done\%%~na.jpg
:APPEND2
convert Blues\%%~na-007-a.jpg Blues\%%~na-007-b.jpg Blues\%%~na-007-c.jpg Blues\%%~na-007-d.jpg -background grey -append Done\%%~na.jpg