WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Printing Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Print a Directory of PDF Files

Keywords: 	 print PDF files

;set working directory
pdfdir="c:\incoming\1 work\" ;needs trailing \
DirChange(pdfdir)

BoxOpen("PDF Print","")

;get list and count of pdf files.
pdflist=FileItemize("*.pdf")
pdfcount=ItemCount(pdflist,@tab)

;Get PDF printing command line
pcommand=RegQueryValue(@REGCLASSES,"AcroExch.Document\shell\print\command")
;set lower case for easier parsing
pcommand=strlower(pcommand)
;break it into exe and param section.
;find the /p
ptr=StrIndex(pcommand,"/p",0,@fwdscan)
;grab previous stuff
exepart=strsub(pcommand,1,ptr-1)
parampart=strsub(pcommand,ptr,-1)
;clean up exe part
exepart=strtrim(strreplace(exepart,'"',''))


for xx=1 to pdfcount
   thispdf=ItemExtract(xx,pdflist,@tab)
   BoxText(thispdf)
   thisfullpdf=strcat(pdfdir,thispdf)
   thisparams=StrReplace(parampart,"%%1",thisfullpdf)
   Run(exepart,thisparams)
   WinWaitExist("Print",30)
   SendKey("~")
   ;Message(exepart,thisparams)
next

Message("All","Done")

Article ID:   W14942
File Created: 2001:11:08:12:41:02
Last Updated: 2001:11:08:12:41:02