M
Matthew Zimmer
Hey all,
I'm working on a program where I open up a word document using the exec
command like this:
Process p = r.exec(...); // this works fine
I then want to receive notification from Windows when word is done with
the file. I can kind of do that by using the waitFor method on Process
like this:
int res = p.waitFor();
This basically worked in most cases. As soon as I shut down word, my
program resumes after the waitFor command. However, if I open up the
word document at a time when another file is open in word something
weird happens. It appears that windows creates a new instance of word,
then opens the file in another instance, then shuts down the original
instance which is the one that waitFor is waiting for. Thus, even
though the file is open, the original process closes which means that I
get to the next line in my code well before it should be there.
Does anybody have any idea how to stop this? I've tried using the whole
exclusive open in java io, but that doesn't work at all. Thanks for any
help.
Matthew
I'm working on a program where I open up a word document using the exec
command like this:
Process p = r.exec(...); // this works fine
I then want to receive notification from Windows when word is done with
the file. I can kind of do that by using the waitFor method on Process
like this:
int res = p.waitFor();
This basically worked in most cases. As soon as I shut down word, my
program resumes after the waitFor command. However, if I open up the
word document at a time when another file is open in word something
weird happens. It appears that windows creates a new instance of word,
then opens the file in another instance, then shuts down the original
instance which is the one that waitFor is waiting for. Thus, even
though the file is open, the original process closes which means that I
get to the next line in my code well before it should be there.
Does anybody have any idea how to stop this? I've tried using the whole
exclusive open in java io, but that doesn't work at all. Thanks for any
help.
Matthew