Batch-print bunch of RTF files?
drobinow at gmail.com
drobinow at gmail.com
Wed Jun 4 12:54:20 EDT 2008
On Jun 4, 12:26 pm, "nos... at nospam.com" <Gilles@> wrote:
> Hello,
>
> I have about two hundred individual RTF files to print from an
> XP host. Word 2000 doesn't seem to have this feature, so I'm looking
> for a way to print those RTF files from an ActivePython script. Would
> someone have some working code handy?
>
> Thank you.
The code below will print one file from your current directory to the
default printer. You should be able to tweak it to your needs.
import sys
import os
from win32com.client import Dispatch
MYDIR = os.getcwd() + '/'
myWord = Dispatch('Word.Application')
myWord.Visible = 1 # comment out for production
myDoc = myWord.Documents.Open(MYDIR + sys.argv[1])
myDoc.PrintOut()
myDoc.Close()
More information about the Python-list
mailing list