Archive: ExecShell + Wait


ExecShell + Wait
I'd like to use ExecShell to open up a word document so it'll use the right program. But I'd like it to wait until it's closed, like using ExecWait.

Is there a way to accomplish this?

Thanks so much~


yeah...i would aslo need this feature
...i have also searched a way to solve this problem, but haven't managed to do it so far. i think, that there isn't that feature now(or am i wrong), or atleast it is not in a documentation of NSIS. if it would be possible to improve next NSIS release with this feature, i would be grateful.


Have one function. It do ABOUT all things of both two commands (uses registry):

Wait file execution with parameters (requires String Replace Function)

You can see it in my signature too... :)

I used it in Win98, to open notepad and a text file with it and worked. But (like the ExecWait command) some of the programs NSIS doesn't wait, and the code continue running.


I'd really like to be able to open up a M$ word document, and then start the installer when they close it.

The reason I'm having trouble using ExecWait is because I don't know how to execute Winword.exe.

This doesn't work:
ExecWait `winword "$EXEDIR\README.doc"`

I don't know how to quickly detect where for sure the executable winword.exe will be.

Does anyone know how to detect the correct execute string for winword so that I can use it with ExecWait?


Thanks so much- This would really help.


ExecShell does not support this feature (Windows API limitation). There is an API available to get the application associated with a certain file type, but that will only work if the application does not require additional command line parameters.


deguix's function does exactly what you want... It seems to only work with extensions 3 characters long, but that shouldn't be a problem to you because doc is exactly 2 characters.


I don't think that function will work with all application. There are quite some different ways to set the file associations (classnames etc.).


In your Function ExecWaitWithParameters:

The command at the end seems like it's missing $3 for the file name.

ExecWait '$2 $0' ==> ExecWait '$2 $3 $0'

Can you verify this? I'm changed it to
ExecWait '$2 $3'
because I do not have any parameters and it works.


If you have no paramenters, then $0 will be ""

You should simply Push "" for the parameters part.

-Stu


deguix's function does exactly what you want... It seems to only work with extensions 3 characters long, but that shouldn't be a problem to you because doc is exactly 2 characters.
Works with any number of characters.

There are quite some different ways to set the file associations (classnames etc.).
Maybe you can say HOW to do those to make alternative ones...

Now it have a problem, when the extension program uses DDE (don't put %1 in the string) will only run the program. I'm trying to fix it puting the string to open your document when don't have a "%1" string. It will arrive today or tomorrow.

Originally posted by deguix
Works with any number of characters.
When the extension "" is pushed on the stack the file name is examined and only the 3 last characters are taken. The function doesn't look for the dot, it assumes 3 characters. Of course this is only in the automatic mode, which is where my "seems to" fits in ;)

Anyway, keep up the good work and keep filling the Archive :)

But putting manually the extension it works. Right? So I will try to fix that too. THANKS!

Anyway, keep up the good work and keep filling the Archive :)
Sometimes you make me smile too :)...