@if not exist echo echo off
rem usage: HP2GIF base_name

if not X%1 == X goto parm_ok1
echo please supply HPGL file base name as first parameter!
echo usage: HP2GIF base_name
echo which will convert base_name.hgl into base_name.gif
goto finis
:parm_ok1

if exist %1.hgl goto parm_ok2
echo can't find HPGL file %1.hgl!
goto oops
:parm_ok2

hp2xx -q -m pbm -d 75 -f- %1.hgl | ppmmerge ppmtogif > %1.gif
if errorlevel 1 goto oops
echo GIF file %1.gif is ready
goto done

:oops
echo aborted!
goto finis

:done
:finis

