/bundles/itninjaweb/img/Breadcrumb_cap_w.png
Hello !

Do you know if I could set properties using vbs ?

My problem :

The old versions of a product are Installshield 6.3 based.
New ones will be MSI based.

When I run an MSI install, I would like to ask :

Do you want to uninstall previous Version ? YES NO

If Yes : I launch the unsinstall process (I know the path of the old setup.exe)
If No : I stop the install.

I'm currently building it with this vbs code :


If Msgbox("uninstall ?", vbYesNo + vbDefaultButton2 + vbExclamation,"Uninstall Previous Version")=VbYes Then
[???]
Else
[???]
End If


If I choose the "No" button, the installation continues... So one solution would be to set a property that I evaluate in a second Custom Action (19)


Can you help me ?
Do you have another solution ?

Thanks !
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
You can use Session.Property when the install is happening to set any property, for example say you want to set a property called UNINSTPKG then you can try following:


If Msgbox("uninstall ?", vbYesNo + vbDefaultButton2 + vbExclamation,"Uninstall Previous Version")=VbYes Then
Session.Property("UNINSTPKG") = 1
Else
Session.Property("UNINSTPKG") = 0
End If


Then in the InstallExecuteSequence Table on the Custom Action that runs the Uninstall you can put the Condition:
UNINSTPKG=1
Answered 07/27/2005 by: TomB
Orange Belt

Please log in to comment
0
thanks for your reply.

I already tried it, but a popup vbs error is shown when the vbs comes to the "Session.Property("UNINSTPKG") = 1" line... :-/
Answered 07/27/2005 by: babric
Senior Purple Belt

Please log in to comment
0
running my script as "stored directly in the custom action", Immediate, during InstallUISequence (after Appsearch), I obtain an "...Script absent error...."

If I run it as deffered in the ExecuteSequence, I obtain an "Internal error 2762" > 2762 Cannot write script record. Transaction not started.

?????
Answered 07/27/2005 by: babric
Senior Purple Belt

Please log in to comment
0
You can not write to properties during a derfered Custom action.

Try to create a Function in the VBS file, then store it in the binary table. For example:



Function PromptUninstall
If Msgbox("uninstall ?", vbYesNo + vbDefaultButton2 + vbExclamation,"Uninstall Previous Version")=VbYes Then
Session.Property("UNINSTPKG") = 1
Else
Session.Property("UNINSTPKG") = 0
End If
End Function



The create an Imediate custom Action and store the vbs in the binary table.

Type = 6
Source = <Binary Table Reference>
Target = PromptUninstall

Schedule the Custom Action to come after CostFinalize in the InstallExecuteSequence Table


However,
If using the UI is an option and you have a tool such as InstallShield it would be just as easy to Create a Dialog that has a bullet for Yes and a bullet for No and and have that option set the property accordingly.
Answered 07/27/2005 by: TomB
Orange Belt

Please log in to comment
0
Thank you very much TomB !

I was looking for a Custom Action with some VB Script, whereas I had the solution using Dialogs... [8|].

I didn't try your VB script solution, but maybe it will be useful in the future.

However, I would have an other question : Do you know if I can create a popup message using Dialogs ? I didn't find this option, and I think popups are importants when I want to warn customers about consequences of something...

thank you again !
Answered 07/28/2005 by: babric
Senior Purple Belt

Please log in to comment
0
Babric,

I belive that you will only be able to use Dialogs when in the UISequence. And the only Windows Installer message I know that you can get during the ExecuteSequence table is a CA 19, however that cancles the install. I would stick to vbs msgboxes unless you wish to utilize the Full UI of the MSI package.

If there is another way, I do not konw.
Answered 07/28/2005 by: TomB
Orange Belt

Please log in to comment
0
ok, thank you !
Answered 07/28/2005 by: babric
Senior Purple Belt

Please log in to comment