Fix script error (%%n)

Hi,

I'm currently tinkering with a script that uses the for command to process all *.gif files in the current folder.

I marked the spot where it exits out with an error by adding a "pause"

The error message given is:

convert.exe: unable to open image `%x': No such file or directory @ error/blob.c
/OpenBlob/2641.
convert.exe: no decode delegate for this image format `%x' @ error/constitute.c/
ReadImage/550.
convert.exe: invalid argument for option `-geometry': ) @ error/convert.c/Conver
tImageCommand/1619.

The script is:

@echo off

SET REP="C:\Users\Pascal\Desktop\MMBN3Programs\ProgramParts\01blnk.gif"
SET SUB="C:\Users\Pascal\Desktop\MMBN3Programs\ProgramParts\02blnkCMD.gif"
SET SRC=%%n
:start



for %%n in (*.gif) do (
"%IMG%compare" -metric RMSE %%n %SUB% -subimage-search found.png 2>co.txt
)
set /p xycos= <co.txt
set str=%xycos%
echo.%str%
set str=%str:,=+%
ECHO %str% > co.TXT
set /p xycos= <co.txt
set str=%xycos%
echo."%str%"
set str=%str: =%
ECHO %str% > co.TXT
set /p xycos= <co.txt
set str=%xycos%
echo.%str%
set str=%str:@=                    +%
ECHO %str% > co.TXT
set /p xycos= <co.txt
set str=%xycos%
echo.%str%
set str=%str:~-12%
ECHO %str% > co.TXT
set /p xcoyco= <co.txt
ECHO %str% >> coordinates.TXT
pause
for %%n in (*.gif) do CALL :run
:run
"%IMG%convert" ^
  %%x ^
  ( %REP% -geometry %xcoyco% ) ^
  -composite ^
  %%x
ECHO %str% >> coordinates.TXT
goto start

Thanks in advance for your help

What is %IMG% ? I don't see it defined anywhere in the script.

%IMG% is the envioironment variable that ImageMagick defindes upon its Windows installation.

It calls Image Magick