@echo off

rem --- Check parameters: -----------------------------------------------------

if "%1"=="" goto USAGE
if "%1"=="@" goto PROCESS

rem --- Set up environment: ---------------------------------------------------

set TMPFILE=_PS_.$$$
set BRDFILE=%1.BRD
set OUTFILE=%1.PS
set PLOTCMD=eagle -X -deps -o%TMPFILE% %BRDFILE%

if exist %TMPFILE% del %TMPFILE%
if exist %OUTFILE% del %OUTFILE%

rem --- Some border offset (may be printer dependent, units are 1/72 inch): ---

echo 50 50 translate >> %OUTFILE%

rem --- Process layer groups: -------------------------------------------------

rem Modify this section to get your favourite combination of layers and
rem grayscales. The first parameter after the @ is the gray value, which
rem can be between 0.0 (black) and 1.0 (white)

call %0 @ 0.6 bottom
call %0 @ 0.2 top
call %0 @ 0.9 pad via

rem --- Finish Postscript file: -----------------------------------------------

echo showpage >> %OUTFILE%
goto END

rem --- Routine that processes a layer group with a given setgray value: ------

:PROCESS
%PLOTCMD% %3 %4 %5 %6 %7 %8 %9
echo %2 setgray >> %OUTFILE%
copy %OUTFILE%+%TMPFILE%
goto END

rem --- That's it! ------------------------------------------------------------

:USAGE
echo Usage: xps boardname   (without .BRD!)

:END
