@echo off
:: -----------------------------------------------------
:: Set the counter into "~%fpuser%c.txt" and create a batch file to set
:: environment variable REPORTN=nnnnnn
::
icount.exe
::  
:: now set REPORTN=nnnnnn
::
call "~%fpuser%b.bat"
del "~%fpuser%b.bat" > NUL
::
:: -----------------------------------------------------
:: Process the output to a unique name using the name of
:: the user and a sequential # assigned by icount.exe
::
type "%1 %2 %3 %4" | sed15 -f %pfprog%\fp\fp2rtf\script.sed > "%pfprog%\fp\fp2rtf\tmp\%fpuser%%reportn%.rtf"
::
:: -----------------------------------------------------
:: View output section
::
:: Use the following line to view the output in Atlantis before printing (default)  
:: 
start /w atlantis.exe "%pfprog%\fp\fp2rtf\tmp\%fpuser%%reportn%.rtf"
:: End of View Output section
:: -----------------------------------------------------
:: Disable Viewing Output section
::
:: Use the following line to put Atlantis in the system tray (disable viewing)
:: If you use this option, rem the View output section "start ..." line of this batch file
::
rem start /w atlantis.exe /p /st "%pfprog%\fp\fp2rtf\tmp\%fpuser%%reportn%.rtf"
:: End of Disable Output section
:: -----------------------------------------------------
del "%pfprog%\fp\fp2rtf\tmp\%fpuser%%reportn%.rtf" >NUL
:END