Hi all,
I need a way to get the path where MS Word/Office has been installed. I need
to start Word from a script (see earlier post), but it doesn't work if I
don't know its path. So "os.system("winword.exe %s" % fileName)" doesn't
always work; I need to say "os.system("C:\Program Files\Microsoft
Office\Office10\winword.exe %s" % fileName)".
Any ideas?
TIA,
g 6 1429
Guy Lateur wrote: I need a way to get the path where MS Word/Office has been installed. I need to start Word from a script (see earlier post),
(Asking us to refer to some earlier post that may or may not even be
available on our news servers isn't the best way to get us the info. A
sentence or two summarizing would work best, I think.)
Can you describe what the user is going to do after Word pops open with
this file in it? Maybe there are simpler ways to do what you are trying
to accomplish, aside from the specific issue of how to open Word itself.
For example, maybe the work you plan to have the user accomplish can be
done automatically by controlling Word with COM.
-Peter
My original post is called "Start application & continue after app exits".
Is there a better way to refer to past posts, btw?
I want to make a temporary file (directory listing), open it in Word to let
the user edit, layout and print it, and then delete the temp file
afterwards. I don't think we'll be able to fully automate it, though. The
user should be able to set her own fonts and stuff.
g
"Peter Hansen" <pe***@engcorp.com> schreef in bericht
news:zN********************@powergate.ca... Guy Lateur wrote: I need a way to get the path where MS Word/Office has been installed. I need to start Word from a script (see earlier post),
(Asking us to refer to some earlier post that may or may not even be available on our news servers isn't the best way to get us the info. A sentence or two summarizing would work best, I think.)
Can you describe what the user is going to do after Word pops open with this file in it? Maybe there are simpler ways to do what you are trying to accomplish, aside from the specific issue of how to open Word itself.
For example, maybe the work you plan to have the user accomplish can be done automatically by controlling Word with COM.
-Peter
Guy Lateur wrote: My original post is called "Start application & continue after app exits". Is there a better way to refer to past posts, btw?
No, the subject is a good way to refer to past posts. I just meant
forcing us to dig back, when the post may no longer even be on our
servers, is not helpful.
I want to make a temporary file (directory listing), open it in Word to let the user edit, layout and print it, and then delete the temp file afterwards. I don't think we'll be able to fully automate it, though. The user should be able to set her own fonts and stuff.
I understand now. Definitely if you are doing this to allow customizing
fonts and such, at the user's whim, you can't automate it, by definition...
(Perhaps I should ask why anyone would want to waste time putting
arbitrary fonts and colours and such around a simple directory listing,
but I won't. <wink>)
-Peter No, the subject is a good way to refer to past posts. I just meant forcing us to dig back, when the post may no longer even be on our servers, is not helpful.
I agree, my bad.
(Perhaps I should ask why anyone would want to waste time putting arbitrary fonts and colours and such around a simple directory listing, but I won't. <wink>)
Please don't.. ;)
g
Thanks for all the feedback, everyone. What a helpfull community this is!
It's actually kinda hard keeping up with y'all..
Cheers,
g
"Guy Lateur" <gu********@b-b.be> schreef in bericht
news:uF**********************@phobos.telenet-ops.be... Hi all,
I need a way to get the path where MS Word/Office has been installed. I need to start Word from a script (see earlier post), but it doesn't work if I don't know its path. So "os.system("winword.exe %s" % fileName)" doesn't always work; I need to say "os.system("C:\Program Files\Microsoft Office\Office10\winword.exe %s" % fileName)".
Any ideas?
TIA, g
Ok, I've tried various proposed solutions, and this is what I've come up
with:
<code>
# get Word path
wordKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths', 0, win32con.KEY_READ)
wPath = win32api.RegQueryValue(wordKey, 'winword.exe')
win32api.RegCloseKey(wordKey)
# open/write tempfile & delete afterwards
fD, fN = tempfile.mkstemp('.txt')
fH = os.fdopen(fD, 'w')
fH.write('blabla')
fH.close()
os.spawnl(os.P_WAIT, wPath, 'winword.exe', fN)
os.remove(fN)
</code>
The above seems to work ok, but if you run the script a second time without
first closing Word(1), the os.spawnl() doesn't seem to block. As a
consequence, the tempfile is not removed (because Word still has it open
when os.remove(fN) is called).
Is this behaviour normal? Anything I can do about this?
Thanks,
g This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bengt Richter |
last post by:
We have where syntax in combination with suite expression syntax (bear with me,
I think a good synergy will emerge ;-)
...
|
by: Guy Lateur |
last post by:
Hi all,
This goes back to my previous post called "Where is Word". In short, I
wanted to make a temporary file (directory listing), open it in Word to let
the user edit, layout and print it, and...
|
by: dkultasev |
last post by:
I mean, I am trying to use Microsoft word with Borland C++ Builder.
I found some examples like that:
Variant V;
V = CreateOleObject("Word.Basic");
V.Exec(Procedure("AppShow"));...
|
by: x-pander |
last post by:
Is is guaranteed, that a pointer to any object in C points exactly at the
lowest addressed byte of this object?
Specifcally is it possible for any platform/os/compiler combination that:
(char...
|
by: Lampa Dario |
last post by:
Hi, where is this stupid error in this program? When I execute it, i
receive a segmentation fault error.
#include <stdio.h>
int main(int argc, char *argv, char *env) { int i=0; int l=0;
int...
| |
by: TC |
last post by:
I'd like to open a discussion about the state of the industry. For the
past year, I've been unable to find competent Access developers
available for hire. I'm worried about that.
I think there's...
|
by: mimenko |
last post by:
Hello,
I like to play with letters, and I try to find some websites on which I could find source codes of word games, like crossword, scrabble, anagrams, word utilities,... , and other games but...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |