@echo off rem Process abc files with abc2ps, then convert to pdf. rem version 1.2 rem Copyright March 1999 by Eric M. Mrozek. rem rem Note: This batch file assumes that abc2ps and ghostscript rem binaries exist in the search path. See these web pages for details: rem http://www.eecs.umich.edu/~mrozek/abc/abc2ps.html rem http://www.cs.wisc.edu/~ghost/aladdin/index.html rem Setting up environment variables. rem I would like to use about three more variables than this, rem but then I get "out of environment space" error messages rem and command line arguements aren't processed correctly. set MYFILES= set MYABCOPT= set GHOSTOPT= rem echo arg1 is %1 rem echo arg2 is %2 rem echo arg3 is %3 rem echo arg4 is %4 :run if "%2"=="" goto usage if "%1"=="-abc" goto usage if "%1"=="-gs" goto usage goto fileopt :fileopt rem echo at beginning of fileopt set MYFILES=%MYFILES% %1 rem echo MYFILES is now %MYFILES% shift rem echo shifted if "%2"=="" goto exec rem echo tested for 2nd of remaining args if "%1"=="-abc" goto abcopt if "%1"=="-gs" goto ghostopt rem echo tested for 1st of remaining args goto fileopt :abcopt shift if "%2"=="" goto exec if "%1"=="-gs" goto ghostopt set MYABCOPT=%MYABCOPT% %1 goto abcopt :ghostopt shift if "%2"=="" goto exec if "%1"=="-abc" goto abcopt set GHOSTOPT=%GHOSTOPT% %1 goto ghostopt :exec abc2ps %MYFILES% %MYABCOPT% -o -O %1.ps rem echo %1.ps created rem Watcom C deletes = signs, so use # instead. rem Doing an initial 'save' helps keep fonts from being flushed between pages. rem If you are using Adobe Acrobat Distiller rem http://www.adobe.com/prodindex/acrobat/main.html rem instead of Ghostscript, comment rem out the following two commands and place the PS files into a "watched" rem folder. Distiller will automatically convert such PS files to PDF. gswin32c -q -dNOPAUSE -dBATCH -sDEVICE#pdfwrite %GHOSTOPT% -sOutputFile#%1.pdf -c save pop -f %1.ps echo %1.ps converted to %1.pdf del %1.ps echo %1.ps deleted goto end :usage echo Usage: abc2pdf files [-abc [abc2psOptions]] [-gs [ghostscriptOptions]] outfile echo Note: The abc2ps options -o -O and -E are overridden. abc2ps -V abc2ps goto end :end rem Clean up environment. set MYFILES= set MYABCOPT= set GHOSTOPT=