Run a file upon update
Posted: Tue Aug 14, 2012 8:58 am
Reading the support logs it seems that inorder to run a program prior to an updating an existing installation, the MSI script needs to be edited.
It is unclear to me where to put this code. My first attempt did not work.
See the line that says Run Program $TARGETDIR$\SomneticsUpdateHelper.exe -bu (WAIT) I added. Why doesn't this work?
edit: Could it be that at this point in the script $TARGETDIR$ is not set? If I hardcode the path then it seemsto work.
It is unclear to me where to put this code. My first attempt did not work.
Code: Select all
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install setup pre-requisites
if Variable PREREQ not Equals FALSE
Display Dialog: prereq, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
Terminate Installation
end
Display Dialog: progressprereq, use as progress dialog (non-modal)
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
Set Variable REMOVEOLD to
Set Variable ERROROLD to
Run Program $TARGETDIR$\SomneticsUpdateHelper.exe -bu (WAIT)
Install/Remove MSI Package $PRODUCTCODE$[REMOVE=ALL] (get result into variable REMOVEOLD)
if Variable REMOVEOLD Equals ERROR
MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. Please uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$ERROROLD$
Terminate Installation
end
if Variable REMOVEOLD Equals REBOOT
MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue.$NEWLINE$$NEWLINE$Please save your work in all running programs and click OK to restart your computer. Setup will resume once your computer restarts.$NEWLINE$$NEWLINE$If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.
if Variable REBOOTNOW Equals OK
Reboot Computer and Resume Setup
else
Terminate Installation
end
end
Set Variable MAINTENANCE to FALSE
end
[DEFINE WEB MEDIA Microsoft Windows Installer 3.0]edit: Could it be that at this point in the script $TARGETDIR$ is not set? If I hardcode the path then it seemsto work.