# Fix script error (%%n)

**URL:** <https://community.unix.com/t/fix-script-error-n/325817>\
**Category:** Microsoft Windows\
**Created:** [March 16, 2013, 8:51pm UTC](https://community.unix.com/t/fix-script-error-n/325817 "2013-03-16T20:51:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pasc](https://community.unix.com/letter_avatar/pasc/32/6_22734026db12803ebb3e059622ac3534.png) [@pasc](https://community.unix.com/u/pasc)\
**Post date:** [March 16, 2013, 8:51pm UTC](https://community.unix.com/t/fix-script-error-n/325817/1 "2013-03-16T20:51:24Z")

</div>

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:

```nohighlight
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:

```nohighlight
@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

---

<div class="post-metadata">

**Author:** ![Corona688](https://community.unix.com/letter_avatar/corona688/32/6_22734026db12803ebb3e059622ac3534.png) [@Corona688](https://community.unix.com/u/Corona688)\
**Post date:** [March 17, 2013, 3:46pm UTC](https://community.unix.com/t/fix-script-error-n/325817/2 "2013-03-17T15:46:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pasc](https://community.unix.com/letter_avatar/pasc/32/6_22734026db12803ebb3e059622ac3534.png) [@pasc](https://community.unix.com/u/pasc)\
**Post date:** [March 17, 2013, 4:07pm UTC](https://community.unix.com/t/fix-script-error-n/325817/3 "2013-03-17T16:07:45Z")

</div>

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

It calls Image Magick
