Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
I am a huge coding novice and I was hoping someone might be able to tell me why my batch code will not run.
I am trying to pass many .jpg's into the run.bat and have the run.bat check the .jpg's name and path against a text file containing the names of .jpg's that have already been processed.
I am guessing it might have something to do with scope but to be honest I have no idea. (The resize.bat works by itself btw).
SETLOCAL EnableDelayedExpansion
%%~d1
CD %%~p1
SET EXISTS=0
FOR %%A in (%%*) DO (
FOR /F %%I in (piclist.txt) DO (
IF %%A=%%I (
SET EXISTS=1
)
)
IF EXISTS=1 (
SET EXISTS=0
) ELSE (
CALL resize.bat "%%A"
ECHO %%A>>piclist.txt
)
)
Your question is more about Windows Batch file processing than about ImageMagick. And seeing this code doesn't make me believe that you are a coding novice.
Why are you cross-checking the files against a list that you even modify during the batch processing? This seems unnessessary to me and, moreover, needlessly complicating matters.
Thanks for the help but omitting the % still didn't allow the batch to run.
Also the reason I am cross checking the .jpg's against a list of names then adding to the list is because I am using a system that will pass the same jpg's to the batch file as well as new ones. I only want the new ones to be processed. I am unable to change the system so I have to accommodate in my code.
I would very much appreciate any suggestions you might have on a better way of doing things.
ERRORLEVEL will only be zero if the string is found.
This seems to be an easier approach to the problem.
Moreover, I would recommend that you develop the batch file step by step, first testing the cross-checking procedure and then introducing the ImageMagick command.
You cannot really expect other people to read some complex code and figure out what's wrong with it. You have to pose more specific questions.