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 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 !
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)
Please log in to answer
Posted by:
TomB
19 years ago
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:
Then in the InstallExecuteSequence Table on the Custom Action that runs the Uninstall you can put the Condition:
UNINSTPKG=1
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
19 years ago
Posted by:
babric
19 years ago
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.
?????
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
19 years ago
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:
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.
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
19 years ago
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 !
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
19 years ago
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.
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.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.