On Jun 4, 12:26 pm, "[EMAIL PROTECTED]" <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()
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to