Page 2 of 2

Re: batch append not working - DOS

Posted: 2015-06-25T03:52:44-07:00
by snibgo

Code: Select all

 IF  EXIST  %ZERO%  GOTO  APPEND1

:APPEND1
for %%f in (%ZERO%) do set BYTE=%%~zf
If %ZERO% exists, we goto the next statement, which would happen anyway.

What do you think will happen if %ZERO% doesn't exist?

Re: batch append not working - DOS

Posted: 2015-06-28T19:45:00-07:00
by FlyingJenny2bucks
I modified it and the dos window simply exited without executing the commands. Is there a way to show precisely which step is causing the problem?
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
)
)

Re: batch append not working - DOS

Posted: 2015-06-28T19:52:37-07:00
by snibgo
... the dos window simply exited without executing the commands.
No commands were executed at all? I don't believe that.

After you set the value of BYTE, test the value with

Code: Select all

echo %BYTE%
Then learn about "delayed expansion".

Re: batch append not working - DOS

Posted: 2015-06-28T20:27:59-07:00
by FlyingJenny2bucks
echo is showing %BYTE% as nothing.
for %%f in ((NULL)) do set BYTE=%%~zf
echo
Edit: I found the problem. Its the bloody parenthesis ().

I have to rearrange the code to exclude the parenthesis.

Code: Select all

For %%a in (*.jpg) do Set ZERO=Blues\%%~na-007-a.jpg
For %%f in (%ZERO%) do set BYTE=%%~zf

Re: batch append not working - DOS

Posted: 2015-06-28T20:53:05-07:00
by FlyingJenny2bucks
I've rearranged the code below but it says "convert.exe: unable to open image " Blues\%%~na-007-a.jpg". No such file or directory."

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

Re: batch append not working - DOS

Posted: 2015-06-28T21:52:44-07:00
by snibgo
Your questions are now entirely about scripting, rather than ImageMagick. I suggest you find a book or website devoted to that topic.