Page 1 of 1

Run a file upon update

Posted: Tue Aug 14, 2012 8:58 am
by somnetics
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.

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]
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.

Re: Run a file upon update

Posted: Thu Aug 16, 2012 2:49 am
by FrancescoT
Dear User,

Is the SomneticsUpdateHelper.exe already available in your targetdir?

Are you sure that is TRUE the IF statement (if Variable NEEDSUPGRADE Equals TRUE)?

Regards

Re: Run a file upon update

Posted: Thu Aug 16, 2012 10:13 am
by somnetics
Sir,

Do you need to explicitly compile every time you make a change to the MSI file?

Re: Run a file upon update

Posted: Thu Aug 16, 2012 10:34 am
by FrancescoT
Dear User,

what do you exactly mean?

The MSI file is generated by the GP wzard tool.
If you make modification to your project and you want these reflected to your MSI, you must rebuild your project and then regenerate the MSI.

Regards