[XP] Batch-print bunch of RTF files?

G

Guest

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.
 
D

drobinow

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()
 
G

Guest

Sure it does, just not the way you think.

Thanks guys, that did it. I had to print in smaller batches because
200 in one shot caused Word to crash, but I got the job done.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top