Where is Word?
Tim Golden
tim.golden at viacom-outdoor.co.uk
Tue Jun 14 06:30:56 EDT 2005
[Guy Lateur]
| Sent: 14 June 2005 11:02
| To: python-list at python.org
| Subject: Re: Where is Word?
|
|
| Unfortunately, I need to open/edit a (temporary) text file
| with Word, and
| those are opened by default with UltraEdit (or Notepad or..).
| Thanks for the
| tip, though.
|
| Anything else? Do I need to read the registry?
|
| g
OK, a slightly more intelligent idea in place of my previous
one. You can use win32api.ShellExecute (from the pywin32 extensions)
which is like a beefed-up os.startfile. In particular, it allows
you to pass parameters to the command. So...
<code>
import win32api
win32api.ShellExecute (
0, # hwnd
"open", # action; could be "print" etc.
"winword.exe", # application
"c:/temp/temp.txt", #params
".", # working directory
1 # show/don't show
)
</code>
TJG
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-list
mailing list