Page 1 of 1
How to run a VB script after install / before uninstall?
Posted: Wed Sep 27, 2006 7:22 am
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
Posted: Wed Sep 27, 2006 1:10 pm
by MichaelNesmith
I'd take out the outer-most double quotes.
Posted: Thu Sep 28, 2006 2:37 am
by binkle
That's it.
Thank you very much!!!

there is a bug:
Posted: Thu Sep 28, 2006 7:13 am
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?
Posted: Thu Sep 28, 2006 7:17 am
by MichaelNesmith
That's very strange, no actually
Try using Run Program As maybe?
Posted: Thu Sep 28, 2006 7:43 am
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?
Posted: Thu Sep 28, 2006 1:46 pm
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...
Posted: Fri Sep 29, 2006 4:10 am
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.