Run a file upon update

Got a problem you cannot solve? Try here.
Post Reply
somnetics
Posts: 21
Joined: Tue Aug 14, 2012 8:48 am
Location: St. Paul Minnesota

Run a file upon update

Post 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.
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run a file upon update

Post 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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
somnetics
Posts: 21
Joined: Tue Aug 14, 2012 8:48 am
Location: St. Paul Minnesota

Re: Run a file upon update

Post by somnetics »

Sir,

Do you need to explicitly compile every time you make a change to the MSI file?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Run a file upon update

Post 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
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Post Reply