question using a menu script
Boaz Bezborodko
boaz at mirrotek.com
Fri Apr 20 05:56:08 PDT 2012
> Date: Tue, 17 Apr 2012 15:39:27 -0700 (PDT)
> From: Richard Hane<yoresoft at sbcglobal.net>
> Subject: question using a menu script
> To: file Pro Mailing List<filepro-list at lists.celestial.com>
> Message-ID:
> <1334702367.68990.YahooMailNeo at web181003.mail.ne1.yahoo.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Good afternoon list,
> ?
> Is it just me or has activity just died?
> ?
> Anyway, my question.
> ?
> First our system, 4 server Win 2003 using fpodbc and Print Wizard.
> ?
> I have 2 users that sometime print report to their printer and then again would rather print to a pdf.? We use Print Wizard.
> ?
> In the past I set up 2 batch files, one for each operation.? I also have set up 2 copies of each report; 1 with the pdf defintion and 1 with the users HP printer type.
> ?
> My question is if use only 1 batch file but on the menu line defined a script (F5) and added the Print Wizard pfpostprint as seen below, run the rreport?then added another pfpostprint to set the state back to printer; would that work?
> ?
> I probably would have to set pfprinter 2 times as well.
> ?
> set pfpostprint=C:\Program Files\Rasmussen Software, Inc\Print Wizard 4\printwiz /fpDF://V:\rickpdf\
> ?
> Thank in advance,
> Rick Hane
> Controller
> Deluxe Stitcher Company Inc
> ISP Stitching Products
> www.deluxestitcher.com
I have a setup where on any report that I want to give the option it
comes up during Sort/Select processing. I give the options of which
printer to send the report or to generate a PDF. It does this by
generating a PrintWizard file and then, if the PDF option is selected,
adds a PrintWizard !PDF command to the first line.
The following is put into the Sort/Select table:
::DECLARE GLOBAL PrintSelPos(1,.0,g) 'Set 'Shipping' as the default:
::DECLARE GLOBAL PrintFileOpt(1,yesno,g) 'Allow printing to file as an
option:
::DECLARE GLOBAL PrintToPDF(1,yesno,g) 'Pass whether PDF option was
chosen:
::DECLARE GLOBAL PrintFileName(100,*,g) 'Set the file name prefix:
::PrintSelPos ="1":
::PrintFileOpt="Y":
::PrintFileName="OpenAPCutOff-"&:
::CALL NOAUTO "H\fpro\filepro\invno\printsel":
:PrintFileOpt eq "N" and PrintToPDF eq "Y":EXIT 'BRKY was
pressed:
After entering it I tailor this for the specific report...Do I allow a
PDF option? What is the default printer to offer for this report? What
is the start of the PDF filename that I will generate.
Here is PRINTSEL, the program that does the actual selection:
::DECLARE EXTERN PrintSelPos 'Should be defined as (1,.0):
::DECLARE EXTERN PrintFileOpt ' Should be defined as (1,yesno):
::DECLARE EXTERN PrintToPDF ' Should be defined as (1,yesno):
::DECLARE EXTERN PrintFileName ' Should be defined as (100,*) - used for
filename prefix:
::DIM prnter[10](20,*):
::prnter("2")="SHIPPING" ; prnter("1")="OFFICE" ; prnter("3")="PDF-FILE":
::DECLARE flname:
:'Set filename for printer file name with
username-date-time:ab(5,*)=GETENV("USERNAME"):
::lookup ctl = invno r=("1") -ep:
::aa(7,*)=ctl(168)+"1" ; ctl(168)=ctl(168)+"1" ; WRITE ctl:
:'Set filename for printer file name with
username-date-time:flname="f/fpro/temp/ "{ab{PrintFileName{aa:
::CLS("21","4"):
::SHOW "\r What printer should be used? \r":
LIST:PrintFileOpt eq
"Y":pr=LISTBOX(prnter,"1","3","20","56","","",PrintSelPos):
:PrintFileOpt eq "N" or PrintFileOpt eq
"":pr(1,*)=LISTBOX(prnter,"1","2","20","56","","",PrintSelPos):
:@sk="SAVE":GOTO LIST:
:@sk="BRKY" ' Signal that the BRKY was hit with an
impossible:PrintFileOpt="N" ; PrintToPDF="Y" ; END 'combination.:
::SHOW "":
:pr eq "1" or pr eq "2":PRINTER NAME prnter(pr) ; END:
:pr eq "3":PRINTER FILE flname{".txt" ; PrintToPDF="Y":
::PrintFileName=ab{PrintFileName{aa:
::SHOW ("24","7") "FILE WILL BE "&flname{".pdf":
::END:
I have to run a program at the end of the report processing that adds
the "!PDF" first line to the report in order. These lines are added to
an @done routine in the report table:
@DONE::DECLARE EXTERN PrintToPDF:
::DECLARE EXTERN PrintFileName:
:PrintToPDF ne "Y":END:
::CALL NOAUTO "H\fpro\filepro\invno\topdf":
::END:
This is "ToPDF":
::DECLARE EXTERN PrintFileName ' Should be defined as (25,*):
::DECLARE flname ; DECLARE flname2:
::aa(8,yymd)=@td ; ab(5,*)=GETENV("USERNAME"):
::flname="f\fpro\temp\ "{PrintFileName:
::ad=flname{".txt":
::ae=("!PDF \"/f\\mirrotek-server\data\fpro\temp\ "{PrintFileName{".pdf\""):
::af=("f\fpro\temp\temp"&PrintFileName{".txt"):
::lookup ref = invno r=("1") -ep:
::ai(30,*)="temp"{ref(168)&".pdf" ; CLOSE ref:
::EXPORT ASCII pdf = (af) R=\n:
::pdf(1) = ae:
::CLOSE pdf:
::SYSTEM "TYPE "&ad&" >> "&af:
::SYSTEM "ECHO !PDF /f\\mirrotek-server\data\fpro\temp\ "{ai&" >> "&af:
::SYSTEM "COPY "&af&" \\mirrotek-server\pw1":
WAITLP:EXISTS("f\fpro\temp\ "{ai) eq "0" and zz lt "150000":SLEEP "500"
; zz(6,.0)=zz+"500" ; GOTO WAITLP:
:zz ge "60000":SHOW "@TIMEOUT ERROR! PLEASE RETRY OR CALL AN
ADMINISTRATOR" ; EXIT:
WAITLP2:::
::SYSTEM "START "&flname{".pdf > "&flname{".err 2>&1":
::SYSTEM "ERASE "&ad:
::SYSTEM "ERASE "&af:
::SYSTEM "ERASE f\fpro\temp\ "{ai:
::SYSTEM "ERASE "&flname{".err":
::END:
This last one is a bit convoluted as my system was reporting files as
being closed even when they were open so I couldn't tell when
PrintWizard was finished generating the PDF. So I add a second !PDF
command for a different file (temp#####.pdf) at the end of the file sent
to PrintWizard. When that file appears I know PrintWizard has finished
with the main PDF.
The resulting PDF starts with the username, adds the report name, the
date, and a unique reference number. I stores it in Fpro\temp.
Feel free to change it as you see fit.
More information about the Filepro-list
mailing list