WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> Can you print to anything but lpt1:
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1129160829

Message started by jeloca on Oct 13th, 2005 at 1:47am

Title: Can you print to anything but lpt1:
Post by jeloca on Oct 13th, 2005 at 1:47am
The following bat file seems to run OK, but nothing is printed. I am in a command window and am executing "WORDPRINT.BAT C:\TEMP\TEST.DOC".
I do not have a printer on LPT1:.
I am running "NET USE LPT1: \\Computer_Name\Shared_Printer_Name" to redirect it before the bat file. Anyone have an idea on how to make this work?  :-?

WORDPRINT.BAT
===========
@echo off
set GDPDDE C:\temp\gdpDDE.EXE
SET TMPDIR=C:\TEMP
SET WORD_CMD="C:\Program Files\Microsoft Office 2003\OFFICE11\WINWORD.EXE"
SET WORD_PARAM=/x /n
SET WORD_SERVICE=WinWord
SET WORD_TOPIC=System
SET WORD_VERBS=[REM _DDE_Minimize][FileOpen("%1%")][t=IsDocumentDirty()][FilePrint 0][SetDocumentDirty t][DocClose]
SET DDEFILE="%TMPDIR%\%1_B%.DDE"
ECHO [dde]>%DDEFILE%
ECHO cmd=%WORD_CMD%>>%DDEFILE%
ECHO param=%WORD_PARAM%>>%DDEFILE%
ECHO service=%WORD_SERVICE%>>%DDEFILE%
ECHO topic=%WORD_TOPIC%>>%DDEFILE%
ECHO verbs=%WORD_VERBS%>>%DDEFILE%
"%GDPDDE%" %DDEFILE%
DEL %DDEFILE%
:QUIT

Title: Re: Can you print to anything but lpt1:
Post by Gert on Oct 13th, 2005 at 4:06am
I am not sure, can you try again with the normal DDE verbs:

SET WORD_VERBS=[FileOpen("%1%")][FilePrint 0][FileExit 2]

and make sure Word is not running before you start?

Gert

Title: Re: Can you print to anything but lpt1:
Post by jeloca on Oct 14th, 2005 at 1:14am
The script is now working - not sure what the problem was. It works with my WORD_VERBS and with your WORD_VERBS. There was a problem somehow where gdpDDE was set to D:\temp\gdpDDE (bad drive) and it would not reset inside the script. It did a "SET" manually and it works now.

My only issues now are (1) that it will only print to my default printer (local or network), (2) Word does not run minimized and (3) Word does not close.

Any ideas on how to set these?

Title: Re: Can you print to anything but lpt1:
Post by Gert on Oct 14th, 2005 at 5:02am

jeloca wrote on Oct 14th, 2005 at 1:14am:
The script is now working - not sure what the problem was. It works with my WORD_VERBS and with your WORD_VERBS. There was a problem somehow where gdpDDE was set to D:\temp\gdpDDE (bad drive) and it would not reset inside the script. It did a "SET" manually and it works now.

Strange, the SET statement in the script should have the same effect as your manual SET.

jeloca wrote on Oct 14th, 2005 at 1:14am:
(1) that it will only print to my default printer (local or network)

You can try to use the DefPrint utility to change the default printer inside the script.

jeloca wrote on Oct 14th, 2005 at 1:14am:
(2) Word does not run minimized and

I guess I need to change the gdpDDE program to handle that, I'll see what I can do in the next few days.

jeloca wrote on Oct 14th, 2005 at 1:14am:
(3) Word does not close.


With "my" word_verbs, [FileExit 2] should close word.

Gert
Any ideas on how to set these?[/quote]

Title: Re: Can you print to anything but lpt1:
Post by jeloca on Oct 14th, 2005 at 1:46pm
I have managed to close Word by adding [AppClose] to the Word Verbs.

I tried [AppHide], but I was unable to function when Word was hidden.

I will try today to set to printer using either the DefPrint or ActivePrinter - will let you know.

Thanks for all the help so far.  :)

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