I'm making an installation with WiX that have a "Launch an application after install" checkbox.
The goal is to have a reaction on settting the checkbox as well as on unsetting the checkbox. In case the checkbox is set, I need to run an application. In case the checkbox is not set, I need to run the same application but with command line argument.
Here is a part of my WiX script.
<CustomAction Id="StartConfigManagerOnExit"
FileKey="ParamsShower.exe"
ExeCommand=""
Execute="immediate"
Impersonate="yes"
Return="asyncNoWait" />
<CustomAction Id="StartUpgradeConfigOnExit"
FileKey="ParamsShower.exe"
ExeCommand="/upgrade"
Execute="immediate"
Impersonate="yes"
Return="asyncNoWait" />
<UI>
<Publish Dialog="ExitDialogEx"
Control="Finish"
Order="1"
Event="DoAction"
Value="StartConfigManagerOnExit">LAUNCHAPPONEXIT = 1</Publish>
<Publish Dialog="ExitDialogEx"
Control="Finish"
Order="1"
Event="DoAction"
Value="StartUpgradeConfigOnExit">LAUNCHAPPONEXIT = 0</Publish>
<Publish Dialog="ExitDialogEx"
Control="Finish"
Event="EndDialog"
Value="Return"
Order="999">1</Publish>
<Dialog Id="ExitDialogEx"
Width="370"
Height="270"
Title="[ProductName] Setup">
<Control Id="LaunchCheckBox"
Type="CheckBox"
X="135"
Y="190"
Width="220"
Height="40"
Property="LAUNCHAPPONEXIT"
Hidden="yes"
CheckBoxValue="1"
Text="Launch an app">
<Condition Action="show">NOT Installed</Condition>
</Control>
</Dialog>
<InstallUISequence>
<Show Dialog="ExitDialogEx"
OnExit="success" />
</InstallUISequence>
<AdminUISequence>
<Show Dialog="ExitDialogEx"
OnExit="success" />
</AdminUISequence>
</UI>
An installation starts the application when LaunchCheckBox is set. But it doesn't run it in case the checkbox is not set.
I've found an answer. Looks like checkbox property is not equal to 0 when unchecked. Simply change the condition "LAUNCHAPPONEXIT = 0" with "NOT LAUNCHAPPONEXIT" solves the situation.
Make default:
<Property Id="LAUNCHAPPONEXIT" Value="1" />
Then correct the conditions (corrected with sascha's comment):
<Publish Dialog="ExitDialogEx" Control="Finish" Order="1" Event="DoAction" Value="StartConfigManagerOnExit">LAUNCHAPPONEXIT</Publish>
<Publish Dialog="ExitDialogEx" Control="Finish" Order="1" Event="DoAction" Value="StartUpgradeConfigOnExit">NOT LAUNCHAPPONEXIT</Publish>
A checkbox has no value at all when unchecked, so rather than use the 1/0 notation you can simply use
LAUNCHAPPONEXIT
and
Not LAUNCHAPPONEXIT
You need to add initialize custom action for your property,
<CustomAction ID="InitLAUNCHAPPONEXIT"
Property="LAUNCHAPPONEXIT"
Value="0"
Return="check"/>
and then add it to InstallUISequence before show exit dialog, or simply add your property to product <Property Id="LAUNCHAPPONEXIT" Value="0" />.
Related
The case is, I want to have a checkbox in a dialog. If the checkbox
is checked I want to create a file and do some other stuff.
I have a custom action which should using the value of the checkbox-property.
Now I try to pass the checkbox value to my CA-Method but it never receives a value,
the variable is present but always empty. I asume the checkbox variable itself
is not present at this point, because session.CustomActionData.ToString() shows:
INSTALLFOLDER=C:\Program Files (x86)\WixTesterSetup\;CHECKBOXProperty=
My Dialog is:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="UserRegDialogUI">
<Property Id="Proceed">proceedbtn</Property>
<Dialog Id="UserRegDialog" Width="400" Height="300" Title="Atled Service Konfiguration">
<Control Id="headerText" Type="Text" X="65" Y="10" Width="350" Height="40" Transparent="yes" Text="Something to Check" />
<Control Id="checkboxLabel" Type="Text" X="58" Y="150" Height="14" Width="141" Transparent="yes" Text="Checkbox Text" />
<Control Id="checkbox" Type="CheckBox" X="60" Y="165" Height="17" Width="120" Property="CHECKBOXProperty" CheckBoxValue="true" />
<Control Id="proceedButton" Type="PushButton" Text="Weiter" Height="20" Width="43" X="349" Y="266">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="cancelButton" Type="PushButton" Text="Beenden" Height="22" Width="50" X="293" Y="266" Cancel="yes">
<Publish Event="EndDialog" Value="Exit" />
</Control>
</Dialog>
</UI>
<InstallUISequence>
<Show Dialog="UserRegDialog" Before="ExecuteAction" />
</InstallUISequence>
</Fragment>
</Wix>
And Product.wsx contains:
<Binary Id="CustomActionBinary" SourceFile="$(var.RegistrationInfoCustomAction.TargetDir)$(var.RegistrationInfoCustomAction.TargetName).CA.dll"/>
<CustomAction Id="RegistrationInfoCustomAction" BinaryKey="CustomActionBinary" DllEntry="SaveUserInfo" Execute="deferred" Impersonate="no" />
<CustomAction Id="CustomAction51" Property="RegistrationInfoCustomAction" Value="INSTALLFOLDER=[INSTALLFOLDER];CHECKBOXProperty=[CHECKBOXProperty]" />
<InstallExecuteSequence>
<Custom Action="CustomAction51" Before='InstallFinalize' />
<Custom Action='RegistrationInfoCustomAction' After='CustomAction51'>NOT Installed</Custom>
</InstallExecuteSequence>
I tried to initialize set the property:
<Property Id="CHECKBOXProperty" Value="true" />
In that case it´s always true even if I uncheck the box.
I tried empty value (compiler says the property will be ignored)
May someone tell me a solution?
It looks like you're running your custom action with deferred context and I think this is what's causing your problems. Read through Obtaining Context Information for Deferred Execution Custom Actions. If you put your property in CustomActionData it should then be available.
My setup consists of 6 features.
I have feature named "Server".
If Server feature is not installed WIXUI_EXITDIALOGOPTIONALCHECKBOX should be disabled or hidden.
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 AND NOT Installed</Publish>
<Property Id="WixShellExecTarget" Value="[#exefile]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch application"/>
I'm having a problem with the wix installer.
I want to remove the last dialog window when installing my application. The last dialog only shows the message "installation successful" and the user has to click finish.
I want the installation to close automatically after the progress bar reaches 100%.
I tried the approach Changing the UI sequence of a built-in dialog set but i got numerous errors and could not get it to work.
I also tried user "joylons" answer here but had no success either.
Is there another way to get this to work? Or can someone help me with the mentioned approach?
I am using the WixUI_Minimal scheme:
<UI>
<UIRef Id="WixUI_Minimal"/>
</UI>
EDIT:
Based on other answers I tried to use WixUI_Common and alter the sequences.
<UI>
<Property Id="WIXUI_INSTALLDIR" Value="TARGETDIR" />
<Property Id="WixUI_Mode" Value="Custom" />
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="9" Bold="yes" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="FatalError" />
<DialogRef Id="UserExit" />
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="EndDialog" Value="Return" Order="1"></Publish>
</UI>
<UIRef Id="WixUI_Common" />
<InstallUISequence>
<Show Dialog="WelcomeDlg" Sequence="1"/>
</InstallUISequence>
<AdminUISequence>
<Show Dialog="WelcomeDlg" Sequence="1"/>
</AdminUISequence>
Changes to the InstallUISequence or AdminUISequence do not seem to have any impact. The installer still shows the three dialogs: licence, progress and then the finished dialog.
I tried to remove the Publish Dialog="ExitDialog" and get the error: "Exit dialog/action not found in 'InstallUISequence' Sequence Table"
EDIT2: I changed my UI Tag like this (according to Chris Eelmaa's answer):
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_Minimal"/>
<UI>
<InstallUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</InstallUISequence>
<AdminUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</AdminUISequence>
</UI>
Unfortunatelly the dialog is still shown at the end of the installation process...
EDIT3 (25.03.15)
The problem seems to be the bootstrapper I'm using. Without the bootstrapper Chris Eelmaa's solution works. The bootstrapper seems to ignore all of the changes i make in my .wxs file and still displays the ExitDialog. Any suggestions?
It's pretty easy, basically you need to overwrite the scheduled "Show exit dialog when installation was successful", and say that it should never happen. The "0" means disabled.
<InstallUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</InstallUISequence>
<AdminUISequence>
<Show Dialog="ExitDialog" OnExit="success">0</Show>
</AdminUISequence>
I've made my Wix installer run an application after finishing installation. This now works, but the installer does not close. Every time I click the Finish button, the application is started once more.
I'd like the application to be run async and then installer terminate.
This is how I did it in Wix;
<UI>
<Publish Dialog="ExitDialog" Control="Finish" Order="1" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.ProductName) Launcher" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="LaunchApplication" FileKey="LnLauncherExe" ExeCommand="" Execute="immediate" Return="asyncNoWait" Impersonate="yes" />
An other problem I have is that the checkbox does not show up. I can live with this, but if someone can spot why, it would be nice to get fixed.
Thanks!
Adding the following seems to work;
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
I read an article http://wix.sourceforge.net/manual-wix3/run_program_after_install.htm and it works.
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch MS" />
<Property Id="WixShellExecTarget" Value="[#MainExe]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<UI Id="MyWixUI_Mondo">
<UIRef Id="WixUI_Minimal" />
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
<UIRef Id="WixUI_ErrorProgressText"/>
</UI>
But I want to have checked checkbox by default, not unchecked. How to do it
Add <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" /> to give the checkbox property its "checked" value.
It goes outside the UI element. Here's a complete example:
<UI>
<UIRef Id="WixUI_Minimal"/>
<Publish Dialog="ExitDialog"
Control="Finish"
Event="DoAction"
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed
</Publish>
</UI>
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>