How to run a VB script after install / before uninstall?

Got a problem you cannot solve? Try here.
Post Reply
binkle

How to run a VB script after install / before uninstall?

Post by binkle »

Hi,
I need to run a VB script after install, but the following code does not work:

Code: Select all

Run Program $WINSYSDIR$\\cscript.exe  ""$TARGETDIR$\\bin\\Myscript.Vbs" scriptparam1 scriptparam2 "script param3"" (WAIT)
I also tried to put this with relative paths into a batch file and started the startScript.bat, but is batch file is executed from a temp path, so the relative params aren't correct.

How to do this?

Greetings

Harry
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

I'd take out the outer-most double quotes.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
binkle

Post by binkle »

That's it.

Thank you very much!!!
:D
binkle

there is a bug:

Post by binkle »

Hi,
one more thing.
I use this code on installation:

Code: Select all

...
    Apply Install (get result into variable SUCCESS)
    if Variable SUCCESS not Equals ERROR
      if Variable SUCCESS not Equals CANCEL
        Run Program $TARGETDIR$\\bin\\RegAsm.exe ExchangeServerToolbox.dll /codebase
        Run Program $WINSYSDIR$\\cscript.exe  "$TARGETDIR$\\bin\\SMTPReg.Vbs" /add 1 OnArrival ExchangeServerToolbox Jam.ExchangeServerToolbox.Plugin.MsgSub "MAIL FROM=*" (WAIT)
      end
    end
...
the last line works only fine if the 'hide window' checkbox is NOT checked.
If I check it to avoid a commandline window flashing the command seems not to be executed.

Hint: I use a similar command on uninstall

Code: Select all

...
if Variable REMOVE Equals TRUE
  Run Program $WINSYSDIR$\\cscript.exe  "$TARGETDIR$\\bin\\SMTPReg.Vbs" /remove 1 OnArrival ExchangeServerToolbox (WAIT)
  Run Program $TARGETDIR$\\bin\\RegAsm.exe ExchangeServerToolbox.dll /unregister
  Apply Uninstall (get result into variable SUCCESS)
...
this works fine no matter if the 'hide window' option is checked or not.

Any ideas on this?
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

That's very strange, no actually :(
Try using Run Program As maybe?
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
binkle

Post by binkle »

can't get it to work with 'run programm as' in any window mode.....
I even do not see any window popping up in windows 'normal' mode using the same syntax as in 'run programm' (without 'as').

Any further ideas?

What about 'run programm'? Can you fix this?
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Post by MichaelNesmith »

I'm not sure this is an error with the product. You have to make sure every parameter is specified correctly, the startup folders are set correctly, and so on. Run Program As is more flexible but uses the same internal API calls as Run Program, so it makes no sense that one would work and the other not.

Please double-check everything you're doing...
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
binkle

Post by binkle »

Ok, I tried it again with run...as.
It works now, but it still works only if the window mode is set to 'normal'.
The other three modes prevent my script from successful execution.

I fear the problem is somewhere in my script. It seems to need a window handle.

Thanks so far.
Post Reply