WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> printing folder name
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1102552669

Message started by leafster on Dec 9th, 2004 at 1:37am

Title: printing folder name
Post by leafster on Dec 9th, 2004 at 1:37am
What I am trying to do is monitor a folder and as a new folder is added I would like to auto print it to a specifc network printer. The folder would be a numeric number with a PDF file inside the folder. I would like to print a front page that says something like This is coming from (folder number) and then print the pdf.

Can this be done

Title: Re: printing folder name
Post by Gert on Dec 9th, 2004 at 4:52am
Hello,

The .bat file below should do the trick. You should let watchDirectory monitor for new files.

[code]
@echo off

rem === change the settings below ===

rem TMPDIR
rem    This script needs to create a temporary file
rem    enter the name of a directory where this file
rem    can be created (NO TRAILING BACKSLASH!!!)
SET TMPDIR=C:\Temp

rem ACROCMD
rem    the command line for printing PDF files
rem    make sure this is the same as the location on your system
rem     - enclose the path (including executable) with "quotes"
SET ACROCMD="C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe" /t


rem ACROPRT
rem   the printer to use
rem
rem this is a 3 entry value:
rem   1: printername (as can be found on "start menu -> settings -> printers & faxes")
rem   2: drivername (advanced properties of the printer)
rem   portname (see ports in properties of the printer)
rem
rem please make sure to surround entries with "quotes" if they contain spaces in their name
SET ACROPRT="HP DeskJet 950C/952C/959C" "HP DeskJet 950C/952C/959C" USB001


rem
rem Printer to use to print the banner page
rem
SET BANPRT="HP DeskJet 950C/952C/959C"

rem === no need to change anything below ===

rem we only process new files
IF "%WD_REASON%" NEQ "FILENEW" GOTO :Done

rem check for valid file type
IF NOT "%WD_FILE_E%" == "PDF" GOTO :Done

rem
rem create the banner page
rem

SET BAN=%TMPDIR%\%WD_TIME%.TXT
ECHO %WD_DATE% %WD_TIME% %WD_FILE_N% > "%BAN%"
ECHO Found in directory %WD_FILE_D% >> "%BAN%"

notepad /pt "%BAN%" %BANPRT%
DEL "%BAN%"

rem
rem print the pdf
rem

"%WD_INSTDIR%\GdPUtil.exe" -runkill 120 %ACROCMD% "%WD_FILE%" %ACROPRT%
goto :Done


:Done
[/code]

Gert

[edit]small typo:
ECHO Found in directory %WD_FILE_D% > "%BAN%"
should have been
ECHO Found in directory %WD_FILE_D% >> "%BAN%"
[/edit]

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.