/build/static/layout/Breadcrumb_cap_w.png

Set properties using vbs

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   [ + ] Show comments

Answers (7)

Posted by: TomB 18 years ago
Orange Belt
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
Posted by: babric 18 years ago
Senior Purple Belt
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... :-/
Posted by: babric 18 years ago
Senior Purple Belt
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.

?????
Posted by: TomB 18 years ago
Orange Belt
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.
Posted by: babric 18 years ago
Senior Purple Belt
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 !
Posted by: TomB 18 years ago
Orange Belt
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.
Posted by: babric 18 years ago
Senior Purple Belt
0
ok, thank you !
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ