Comment: Script to Schedule, Download, and Install Updates
 
[compiler if Variable UPDATE_SCHEDULING Equals TRUE]
Comment: IMPORTANT!
Comment: If your setup uses the Native Engine,
Comment: And the Scheduled Web Update Mode;
Comment: Comment-in (enable) the line below:
Comment: Set Variable NATIVE_ENGINE to TRUE
 
Set Variable UPDATE_SCHEDULING to TRUE
Set Variable MY_USERNAME to UNKNOWN
Get System Setting Logged on User Name into MY_USERNAME
 
[DEFINE REGION: Update Mode?]
Set Variable COMMANDLINE to $CMDLINE$
Comment: MessageBox: COMMANDLINE, $COMMANDLINE$ 
if Variable COMMANDLINE not Contains /update
  Set Variable UPDATE_SCHEDULE to FALSE
  if Variable MAINTENANCE Equals FALSE
    Set Variable UPDATE_SCHEDULE to TRUE
  end
  Set Persistent Variable ALLUSERS to FALSE
  if Variable UPDATE_SCHEDULE Equals TRUE
    Set Persistent Variable UPDATE_DOWNLOAD to FALSE
    Set Persistent Variable UPDATE_AUTO to TRUE
    Set Persistent Variable UPDATE_LOG to FALSE
    Set Persistent Variable UPDATE_NTKERNEL to 
    Set Persistent Variable WINDOWSINSTALLERDIR to 
    Get Common Folder Location System->Windows Directory into WINDOWSINSTALLERDIR
    Get System Setting Windows NT Kernel (NT4, 2000, XP, 2003, Vista, 2008, 7, 2008 R2, 8, 2012, 8.1, 2012 R2, 10, 2016) into UPDATE_NTKERNEL
    Set Variable WINDOWSINSTALLERDIR to $WINDOWSINSTALLERDIR$\Installer
    Set Variable ALLUSERS to FALSE
    Set Variable ALLUSERS_BACKUP to $ALLUSERS$
    Set Variable ALLUSERS to TRUE
    Set Persistent Variable UPDATEEXE_ALLUSERS to $UNINSTALLLINK$
    Set Variable ALLUSERS to FALSE
    Set Persistent Variable UPDATEEXE_JUSTME to $UNINSTALLLINK$
    Set Variable ALLUSERS to $ALLUSERS_BACKUP$
    Comment: MessageBox: Update Schedule True, $UPDATEEXE_JUSTME$
    Set Persistent Variable LOCALAPPDATA to 
    Set Persistent Variable LOCALAPPDRIVE to 
    Set Persistent Variable UPDATEPATH to 
    Set Persistent Variable UPDATEEXE to 
    Get Folder Location Other->Local Application Data into LOCALAPPDATA
    Get Folder Location Other->Local Application Data into LOCALAPPDRIVE
    Set Persistent Variable UPDATEPATH to $UNINSTALLLINK$
    Set Persistent Variable UPDATEEXE to $UNINSTALLLINK$
    Extract File Folder: UPDATEPATH
    Extract File Name Only: UPDATEEXE
    Extract Parent Drive: LOCALAPPDRIVE
    Write into Text File $LOCALAPPDRIVE$USERS\PUBLIC\PCUPDATE.TXT from Value $UPDATEEXE_JUSTME$ (at start of file)
    Comment: Write into Text File $LOCALAPPDRIVE$USERS\PUBLIC\PCCACHE.TXT from Value ENGINECACHE = $ENGINECACHE$ (at start of file)
    Comment: Write into Text File $LOCALAPPDRIVE$USERS\PUBLIC\PCCACHE.TXT from Value exedir = $EXEDIR$ (at start of file)
    Comment: MessageBox: Write to Text File, $LOCALAPPDRIVE$\USERS\PUBLIC\PCUPDATE.TXT
    Comment: MessageBox: ENGINECACHE, ENGINECACHE  = $ENGINECACHE$ 
    Get Folder Location System->Application Data Directory into MYAPPDATA
    Set Variable MY_DOESINSTALLDIREXIST to FALSE
    Set Variable MY_INSTALLDIRFILE to $LOCALAPPDRIVE$USERS\PUBLIC\INSTALLDIRILLUS.TXT
    Does File Exist $MY_INSTALLDIRFILE$ (get result into variable MY_DOESINSTALLDIREXIST)
    if Variable $MY_DOESINSTALLDIREXIST$ Equals FALSE
      Write into Text File $MY_INSTALLDIRFILE$ from Value $UPDATEPATH$ (at start of file)
    end
  else
    Get Folder Location Other->Local Application Data into LOCALAPPDRIVE
    Extract Parent Drive: LOCALAPPDRIVE
  end
  if Variable MAINTENANCE Equals FALSE
    if Variable NEEDSUPGRADE Equals FALSE
      Comment: Write Registry Key HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\$TITLE$ Update Setup, $UPDATEEXE_JUSTME$ /updatesetup
      Write Registry Key HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\$TITLE$ Update Setup, $UPDATEEXE_JUSTME$ /update
      Comment: MessageBox: Needs Upgrade False, Write Registry Key 1
    end
  end
  if Variable UPDATE_NTKERNEL Equals TRUE
    Comment: Do not create the shorcut here due to permissions.  Will be done in companion update installer
    Comment: Create Shortcut $WINDOWSINSTALLERDIR$\#TITLE# Updates to $UPDATEEXE_JUSTME$
    Comment: MessageBox: Update NTKernel True, write instaldir link
  else
    Recursively Delete Files $WINDOWSINSTALLERDIR$\$TITLE$ Updates.bat
    Write into Text File $WINDOWSINSTALLERDIR$\$TITLE$ Updates.bat from Value @echo off (at end of file)
    Write into Text File $WINDOWSINSTALLERDIR$\$TITLE$ Updates.bat from Value "$UPDATEEXE_JUSTME$" /update (at end of file)
    Comment: MessageBox: Update NTKernel False, write installdir batch file
  end
  if Variable UPDATEEXE_ALLUSERS not Equals (Ignore Case) $UPDATEEXE_JUSTME$
    if Variable MAINTENANCE Equals FALSE
      if Variable NEEDSUPGRADE Equals FALSE
        Comment: Write Registry Key HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\$TITLE$ Update Setup for All Users, $UPDATEEXE_ALLUSERS$ /updatesetup
        Write Registry Key HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\$TITLE$ Update Setup for All Users, $UPDATEEXE_ALLUSERS$ /update
        Comment: MessageBox: Needs Upgrade False, Write Registry Key 2
      end
    end
    if Variable UPDATE_NTKERNEL Equals TRUE
      Comment: Do not create the shorcut here due to permissions.  Will be done in companion update installer
      Comment: Create Shortcut $WINDOWSINSTALLERDIR$\#TITLE# Updates for All Users to $UPDATEEXE_ALLUSERS$
      Comment: MessageBox: Update NTKernel True, write alluser instaldir link
    else
      Recursively Delete Files $WINDOWSINSTALLERDIR$\$TITLE$ Updates for All Users.bat
      Write into Text File $WINDOWSINSTALLERDIR$\$TITLE$ Updates for All Users.bat from Value @echo off (at end of file)
      Write into Text File $WINDOWSINSTALLERDIR$\$TITLE$ Updates for All Users.bat from Value "$UPDATEEXE_ALLUSERS$" /update (at end of file)
      Comment: MessageBox: Update NTKernel False, write installdir batch file
    end
  end
  Set Variable ALLUSERS_BACKUP to $ALLUSERS$
  Set Variable ALLUSERS to TRUE
  Delete Files $ENGINECACHE$\installedupdates.dat (when uninstalling)
  Set Variable ALLUSERS to FALSE
  Delete Files $ENGINECACHE$\installedupdates.dat (when uninstalling)
  Set Variable ALLUSERS to $ALLUSERS_BACKUP$
  Delete Files $WINDOWSINSTALLERDIR$\#TITLE# Updates.bat (when uninstalling)
  Delete Files $WINDOWSINSTALLERDIR$\#TITLE# Updates for All Users.bat (when uninstalling)
   
   
  Get System Setting Windows 9X Kernel (95, 98, ME) into WIN9X
  Set Variable UPDATE_DATE to Every Day
  Set Variable UPDATE_TIME to 4:00 PM
  Set Variable UPDATE_KEEP to TRUE
  if Variable WIN9X not Equals TRUE
    Get System Setting Logged on Domain Name into UPDATE_DOMAIN
    if Variable UPDATE_DOMAIN Equals 
      Get System Setting Logged on Computer Name into UPDATE_DOMAIN
    end
    Get System Setting Logged on User Name into UPDATE_USER
    Set Persistent Variable UPDATE_USER to $UPDATE_DOMAIN$\$UPDATE_USER$
    Set Variable UPDATE_PASS to 
  end
   
  Comment: Show icon in system tray, minimize setup to system tray
  Comment: MessageBalloon: $TITLE$ Updates, Configure automatic updates for $TITLE$.
  Comment: Set Variable WIZARD to NEXT
  Set Variable WIZARD_NEW to NEXT
   
  label: Update Setup Welcome
  label: Update Setup Schedule
  label: Update Setup Account
  label: Update Setup Finished
  label: Update Setup End of Dialogs
   
  if Variable WIZARD_NEW Equals CANCEL
    Terminate Installation
  else
    Get Common Folder Location System->Windows Directory into WINDOWSINSTALLERDIR
    Set Variable WINDOWSINSTALLERDIR to $WINDOWSINSTALLERDIR$\Installer
    Set Variable UPDATE_PASS to 
    if Variable UPDATE_KEEP Equals TRUE
      Get System Setting Windows NT Kernel (NT4, 2000, XP, 2003, Vista, 2008, 7, 2008 R2, 8, 2012, 8.1, 2012 R2, 10, 2016) into UPDATE_NTKERNEL
      if Variable UPDATE_NTKERNEL Equals TRUE
        Get System Setting Windows Vista into UPDATE_VISTA
        if Variable ALLUSERS Equals TRUE
          if Variable UPDATE_VISTA Equals FALSE
            Schedule Task $TITLE$ Updates - $MY_USERNAME$ to run weekly
            Comment: MessageBox: schedule task 1, schedule task 1
          else
            Schedule Task $TITLE$ Updates - $MY_USERNAME$ to run weekly
            Comment: MessageBox: schedule task 2, schedule task 2
          end
        else
          if Variable UPDATE_VISTA Equals FALSE
            Schedule Task $TITLE$ Updates - $MY_USERNAME$ to run weekly
            Comment: MessageBox: schedule task 3, schedule task 3
          else
            Schedule Task $TITLE$ Updates - $MY_USERNAME$ to run weekly
            Comment: MessageBox: schedule task 4, schedule task 4
          end
        end
      else
        if Variable ALLUSERS Equals TRUE
          Schedule Task $TITLE$ Updates - $MY_USERNAME$ to run weekly
          Comment: MessageBox: schedule task 5, schedule task 5
        else
          Schedule Task $TITLE$ Updates - $MY_USERNAME$ to run weekly
          Comment: MessageBox: schedule task 6, schedule task 6
        end
      end
    else
      Delete Scheduled Task $TITLE$ Updates - $MY_USERNAME$
      Comment: MessageBox: delete schedule task, delete schedule task
    end
    Comment: Delete Registry VALUE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\$TITLE$ Update Setup
    Comment: Delete Registry VALUE HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\$TITLE$ Update Setup for All Users
  end
   
   
  [compiler if Variable UPDATE_SCHEDULING not Equals THIRD]
  Set Variable UPDATE_DOWNLOAD to TRUE
  Set Variable UPDATE_AUTO to FALSE
  Set Variable UPDATE_LOG to TRUE
  [compiler else]
  if Variable MAINTENANCE Equals TRUE
    Set Variable UPDATE_DOWNLOAD to TRUE
    Set Variable UPDATE_AUTO to FALSE
    Set Variable UPDATE_LOG to TRUE
  else
    Set Variable UPDATE_DOWNLOAD to FALSE
    Set Variable UPDATE_AUTO to TRUE
    Set Variable UPDATE_LOG to FALSE
  end
  [compiler end]
   
   
  GoTo Label: End of Updates
end
[END REGION]
 
Comment: ------------------------------------------------------------------------
Comment: Joe - For some reason the UPDATE_ variables are set as persistent on initial install 
Comment: but they are not persisting so we re-set them here
Set Variable UPDATE_DOWNLOAD to FALSE
Set Variable UPDATE_AUTO to TRUE
Set Variable UPDATE_LOG to TRUE
 
Comment: Joe - April 26 2019 - Setting Variables to try and enable balloon pop-up when downloaded
Set Variable UPDATE_DOWNLOAD to FALSE
Set Variable UPDATE_AUTO to FALSE
Set Variable UPDATE_LOG to TRUE
Set Variable UPDATE_SHOWDOWNLOAD to FALSE
 
Comment: MessageBox: UPDATE_SCHEDULING 1, $UPDATE_SCHEDULING$
Set Variable UPDATE_SCHEDULING to FALSE
Set Variable UPDATE_SCHEDULING to THIRD
Comment: Joe - April 26 2019 - Setting UPDATE_SCHEDULING to True to try and enable balloon pop-up when downloaded
Set Variable UPDATE_SCHEDULING to TRUE
Comment: MessageBox: UPDATE_SCHEDULING 2, $UPDATE_SCHEDULING$
 
[DEFINE REGION: Schedule Updates]
if Variable COMMANDLINE not Contains /updatesetup
  GoTo Label: Check for Updates
end
 
Comment: Terminate Installation
[END REGION]
 
[compiler else]
 
[compiler if Variable UPDATE_SCHEDULING Equals THIRD]
if Variable MAINTENANCE Equals TRUE
  [compiler end]
  if Variable CMDLINE not Contains /update
    GoTo Label: End of Updates
  end
  [compiler if Variable UPDATE_SCHEDULING Equals THIRD]
end
[compiler end]
 
[compiler end]
 
 
[DEFINE REGION: Download and Install Updates]
label: Check for Updates
Set Variable UPDATE_GET_INI to 
Download File #UPDATE_SERVER# into $SUPPORTDIR$\updates.ini (get result into variable UPDATE_GET_INI)
Comment: MessageBox: UPDATE_SERVER, #UPDATE_SERVER#
Comment: MessageBox: SUPPORTDIR, $SUPPORTDIR$
 
Comment: Check Internet connectivity
if Variable UPDATE_GET_INI not Equals SUCCESS
  [compiler if Variable UPDATE_SCHEDULING Equals TRUE]
  [compiler else]
  [compiler if Variable UPDATE_SCHEDULING not Equals THIRD]
  if Variable UPDATE_SCHEDULING not Equals THIRD
    MessageBox: $TITLE$ Update, Unable to contact update server for $TITLE$.$NEWLINE$$NEWLINE$Please check your Internet connection and try again.
  else
    [compiler else]
    if Variable MAINTENANCE Equals TRUE
      MessageBox: $TITLE$ Update, Unable to contact update server for $TITLE$.$NEWLINE$$NEWLINE$Please check your Internet connection and try again.
      Terminate Installation
    end
    GoTo Label: End of Updates
  end
  [compiler end]
  [compiler end]
  Terminate Installation
end
Comment: Check update availability
Get INI $SUPPORTDIR$\updates.ini, [Update Packs for Versions] $VERSION$ Value into Variable UPDATE_AVAILABLE
if Variable UPDATE_AVAILABLE Equals 
  [compiler if Variable UPDATE_SCHEDULING Equals TRUE]
  [compiler else]
  [compiler if Variable UPDATE_SCHEDULING not Equals THIRD]
  if Variable UPDATE_SCHEDULING not Equals THIRD
    MessageBox: $TITLE$ Update, No updates are available for $TITLE$ at this time.$NEWLINE$$NEWLINE$Please check back again later.
  else
    [compiler else]
    if Variable MAINTENANCE Equals TRUE
      MessageBox: $TITLE$ Update, No updates are available for $TITLE$ at this time.$NEWLINE$$NEWLINE$Please check back again later.
      Terminate Installation
    end
    GoTo Label: End of Updates
    [compiler end]
  end
  [compiler end]
  Terminate Installation
end
 
if Variable UPDATE_LOG Equals TRUE
  Comment: Remove previously installed updates from list of available updates
  label: Remove Previously Installed
  Set Variable UPDATE_PREVIOUSLY_INSTALLED to 
  Read from Text File $EXEDIR$\installedupdates.dat into Variable UPDATE_PREVIOUSLY_INSTALLED (get EOF into UPDATE_EOF)
  if Variable UPDATE_PREVIOUSLY_INSTALLED not Equals 
    Replace $UPDATE_PREVIOUSLY_INSTALLED$$NEWLINE$ with  in variable UPDATE_AVAILABLE
    Replace $NEWLINE$$UPDATE_PREVIOUSLY_INSTALLED$ with  in variable UPDATE_AVAILABLE
    Replace $UPDATE_PREVIOUSLY_INSTALLED$ with  in variable UPDATE_AVAILABLE
  end
  if Variable UPDATE_EOF Equals FALSE
    GoTo Label: Remove Previously Installed
  end
  Comment: Quit if no new updates are available
  if Variable UPDATE_AVAILABLE Equals 
    [compiler if Variable UPDATE_SCHEDULING Equals TRUE]
    [compiler else]
    if Variable UPDATE_SCHEDULING Equals TRUE
      MessageBox: $TITLE$ Update, No updates are available for $TITLE$ at this time.$NEWLINE$$NEWLINE$Please check back again later.
    end
    [compiler end]
    Terminate Installation
  end
end
 
Comment: Gather update details
Set Variable UPDATE_REBOOT to FALSE
Set Variable UPDATE_DETAIL to 
Set Variable UPDATE_AVAILABLE_TEMP to $UPDATE_AVAILABLE$
Set Variable UPDATE_COUNT to 0
label: Form Description
Parse String $UPDATE_AVAILABLE_TEMP$ into Variables UPDATE_NAME and UPDATE_AVAILABLE_TEMP (Split at first occurrence of pattern)
UPDATE_COUNT = $UPDATE_COUNT$ + 1
Get INI $SUPPORTDIR$\updates.ini, [$UPDATE_NAME$] Description Value into Variable UPDATE_DETAIL_TEMP
if Variable UPDATE_DETAIL_TEMP not Equals 
  if Variable UPDATE_COUNT Equals 1
    Set Variable UPDATE_DETAIL to $UPDATE_NAME$$NEWLINE$$UPDATE_DETAIL_TEMP$
  else
    Set Variable UPDATE_DETAIL to $UPDATE_DETAIL$$NEWLINE$$NEWLINE$$UPDATE_NAME$$NEWLINE$$UPDATE_DETAIL_TEMP$
  end
end
if Variable UPDATE_AVAILABLE_TEMP not Equals 
  GoTo Label: Form Description
end
 
Comment: Choose updates to download
if Variable UPDATE_DOWNLOAD Equals TRUE
  [compiler if Variable UPDATE_SCHEDULING Equals TRUE]
  MessageBalloon: Updates are available for $TITLE$, The InstallAware Wizard has found updates for $TITLE$. Click here to download these updates.
  Show icon in system tray, minimize setup to system tray
  [compiler end]
end
label: Download Prompt
if Variable UPDATE_DOWNLOAD not Equals TRUE
  Set Variable UPDATE_SELECTED to $UPDATE_AVAILABLE$
else
  Set Variable UPDATE_SELECTED to $UPDATE_AVAILABLE$
  Display Dialog: update_notify_download, wait for dialog to return (modal)
end
if Variable WIZARD Equals BACK
  Run Program $UNINSTALLLINK$ /updatesetup
  GoTo Label: Download Prompt
end
if Variable WIZARD Equals CANCEL
  Terminate Installation
end
if Variable UPDATE_SELECTED Equals 
  MessageBox: $TITLE$ Updates, Please select some updates to download.
  GoTo Label: Download Prompt
end
 
Comment: Download selected updates
Comment: Joe -----------------------------------------------------------------
[compiler if Variable UPDATE_SCHEDULING Equals TRUE]
if Variable UPDATE_SCHEDULING Equals TRUE
  if Variable UPDATE_SHOWDOWNLOAD Equals TRUE
    MessageBalloon: Downloading $TITLE$ updates..., The InstallAware Wizard is downloading updates.$NEWLINE$You can continue working while updates are being downloaded. To view detailed progress, click the $TITLE$ Update icon below.
    Show icon in system tray, minimize setup to system tray
  end
end
[compiler end]
Set Variable UPDATE_CURRENT to 0
Set Variable UPDATE_DOWNLOADED to 0
Set Variable UPDATE_SELECTED_TEMP to $UPDATE_SELECTED$
Set Variable UPDATE_DOWNLOAD_PROGRESS to 
Set Variable UPDATE_DETAIL_INSTALL to 
label: Download Updates
UPDATE_CURRENT = $UPDATE_CURRENT$ + 1
Parse String $UPDATE_SELECTED_TEMP$ into Variables UPDATE_NAME and UPDATE_SELECTED_TEMP (Split at first occurrence of pattern)
if Variable UPDATE_NAME not Equals 
  Get INI $SUPPORTDIR$\updates.ini, [$UPDATE_NAME$] Description Value into Variable UPDATE_DETAIL_INSTALL_TEMP
  if Variable UPDATE_DETAIL_INSTALL_TEMP not Equals 
    if Variable UPDATE_CURRENT Equals 1
      Set Variable UPDATE_DETAIL_INSTALL to $UPDATE_NAME$$NEWLINE$$UPDATE_DETAIL_INSTALL_TEMP$
    else
      Set Variable UPDATE_DETAIL_INSTALL to $UPDATE_DETAIL_INSTALL$$NEWLINE$$NEWLINE$$UPDATE_NAME$$NEWLINE$$UPDATE_DETAIL_INSTALL_TEMP$
    end
  end
  Get INI $SUPPORTDIR$\updates.ini, [$UPDATE_NAME$] URL Value into Variable UPDATE_DOWNLOAD_TEMP
  if Variable UPDATE_CURRENT Equals 1
    Set Variable UPDATE_DOWNLOAD_PROGRESS to Downloading $UPDATE_NAME$ for $TITLE$ ($UPDATE_CURRENT$ of $UPDATE_COUNT$)...
  else
    Set Variable UPDATE_DOWNLOAD_PROGRESS to $UPDATE_DOWNLOAD_PROGRESS$$UPDATE_DOWNLOAD_RESULT$$NEWLINE$Downloading $UPDATE_NAME$ for $TITLE$ ($UPDATE_CURRENT$ of $UPDATE_COUNT$)...
  end
  if Variable UPDATE_SCHEDULING Equals TRUE
    if Variable UPDATE_DOWNLOAD Equals TRUE
      Display Dialog: update_download, use as progress dialog (non-modal)
    end
  end
  Set Variable UPDATE_GET_DOWNLOAD to 
  Download File $UPDATE_DOWNLOAD_TEMP$ into $SUPPORTDIR$\$UPDATE_NAME$.exe (get result into variable UPDATE_GET_DOWNLOAD)
  Write into Text File $LOCALAPPDRIVE$USERS\PUBLIC\FLFUPDATE.TXT from Value Downloaded $UPDATE_DOWNLOAD_TEMP$ to $SUPPORTDIR$\$UPDATE_NAME$.exe (at end of file)
  if Variable UPDATE_GET_DOWNLOAD Equals SUCCESS
    Set Variable UPDATE_DOWNLOAD_RESULT to done!
    UPDATE_DOWNLOADED = $UPDATE_DOWNLOADED$ + 1
  else
    Set Variable UPDATE_DOWNLOAD_RESULT to failed!
    Replace $UPDATE_NAME$$NEWLINE$ with  in variable UPDATE_SELECTED
    Replace $NEWLINE$$UPDATE_NAME$ with  in variable UPDATE_SELECTED
    Replace $UPDATE_NAME$ with $UPDATE_NAME$ [download was unsuccessful] in variable UPDATE_DETAIL_INSTALL
  end
  Hide Dialog
  if Variable ABORT Equals TRUE
    Terminate Installation
  end
end
if Variable UPDATE_CURRENT not Equals $UPDATE_COUNT$
  GoTo Label: Download Updates
end
 
Comment: Choose updates to install
Comment: ----------------------------------------------------------------------
Comment: Joe - only show baloon if update_scheduling is true
Comment: MessageBox: UPDATE_SCHEDULING, $UPDATE_SCHEDULING$
if Variable UPDATE_SCHEDULING Equals TRUE
  [compiler if Variable UPDATE_SCHEDULING Equals TRUE]
  MessageBalloon: Updates are ready for $TITLE$, The InstallAware Wizard has downloaded updates for $TITLE$. Click here to install these updates.
  Show icon in system tray, minimize setup to system tray
  [compiler end]
end
label: Install Prompt
if Variable UPDATE_AUTO Equals TRUE
  Set Variable UPDATE_SELECTED_INSTALL to $UPDATE_SELECTED$
else
  Set Variable UPDATE_SELECTED_INSTALL to $UPDATE_SELECTED$
  Display Dialog: update_notify_install, wait for dialog to return (modal)
end
if Variable WIZARD Equals BACK
  Run Program $UNINSTALLLINK$ /updatesetup
  GoTo Label: Install Prompt
end
if Variable WIZARD Equals CANCEL
  Terminate Installation
end
if Variable UPDATE_SELECTED_INSTALL Equals 
  MessageBox: $TITLE$ Updates, Please select some updates to install.
  GoTo Label: Download Prompt
end
 
Comment: Install selected updates
[compiler if Variable UPDATE_SCHEDULING Equals TRUE]
Comment: ---------------------------------------------------------------------
Comment: Joe - Added the AUTO_SCHEDULING if condition because we want to suppress this to make it completely silent
if Variable UPDATE_SCHEDULING Equals TRUE
  MessageBalloon: Installing $TITLE$ updates..., Udates are being installed. Please close the illustration program. To view detailed progress, click the $TITLE$ Update icon below.
  Show icon in system tray, minimize setup to system tray
end
[compiler end]
Set Variable UPDATE_CURRENT to 0
Set Variable UPDATE_SELECTED_TEMP to $UPDATE_SELECTED_INSTALL$
Set Variable UPDATE_INSTALL_PROGRESS to 
label: Install Updates
UPDATE_CURRENT = $UPDATE_CURRENT$ + 1
if Variable UPDATE_DOWNLOADED not Equals 0
  PROGRESS = $UPDATE_CURRENT$ * 100
  PROGRESS = $PROGRESS$ / $UPDATE_DOWNLOADED$
end
Parse String $UPDATE_SELECTED_TEMP$ into Variables UPDATE_NAME and UPDATE_SELECTED_TEMP (Split at first occurrence of pattern)
if Variable UPDATE_NAME not Equals 
  Get INI $SUPPORTDIR$\updates.ini, [$UPDATE_NAME$] URL Value into Variable UPDATE_DOWNLOAD_TEMP
  Get INI $SUPPORTDIR$\updates.ini, [$UPDATE_NAME$] Silent Value into Variable UPDATE_SILENT
  Get INI $SUPPORTDIR$\updates.ini, [$UPDATE_NAME$] Parameters Value into Variable UPDATE_PARAMETERS
  if Variable UPDATE_REBOOT Equals FALSE
    Get INI $SUPPORTDIR$\updates.ini, [$UPDATE_NAME$] Reboot Value into Variable UPDATE_REBOOT_TEMP
    if Variable UPDATE_REBOOT_TEMP Contains (Ignore Case) Yes
      Set Variable UPDATE_REBOOT to TRUE
    end
  end
  if Variable UPDATE_CURRENT Equals 1
    Set Variable UPDATE_INSTALL_PROGRESS to Installing $UPDATE_NAME$ for $TITLE$ ($UPDATE_CURRENT$ of $UPDATE_DOWNLOADED$)...
  else
    Set Variable UPDATE_INSTALL_PROGRESS to $UPDATE_INSTALL_PROGRESS$finished!$NEWLINE$Installing $UPDATE_NAME$ for $TITLE$ ($UPDATE_CURRENT$ of $UPDATE_DOWNLOADED$)...
  end
  if Variable UPDATE_SCHEDULING Equals TRUE
    Display Dialog: update_install, use as progress dialog (non-modal)
  end
  Set Variable UPDATE_GET_DOWNLOAD to 
  if Variable UPDATE_SILENT not Contains (Ignore Case) No
    Set Variable SILENTVAR to /s
  else
    Set Variable SILENTVAR to 
  end
  Run Program $SUPPORTDIR$\$UPDATE_NAME$.exe $UPDATE_PARAMETERS$ $SILENTVAR$ REBOOTCOMPUTER=FALSE RUNAPP=FALSE REBOOTNOW=CANCEL (WAIT)
  if Variable UPDATE_LOG Equals TRUE
    Write into Text File $EXEDIR$\installedupdates.dat from Value $UPDATE_NAME$ (at end of file)
    Write into Text File $LOCALAPPDRIVE$USERS\PUBLIC\FLFUPDATE.TXT from Value Update = $UPDATE_NAME$ (at end of file)
  end
  Hide Dialog
  if Variable ABORT Equals TRUE
    Terminate Installation
  end
end
if Variable UPDATE_DOWNLOADED Greater Than $UPDATE_CURRENT$
  GoTo Label: Install Updates
end
if Variable UPDATE_REBOOT Equals TRUE
  Display Dialog: update_reboot, wait for dialog to return (modal)
  [compiler if Variable UPDATE_SCHEDULING Equals TRUE]
  MessageBalloon: Restart required, Your computer needs to be restarted before changes made to $TITLE$ take effect.
  [compiler end]
  if Variable WIZARD Equals NEXT
    Reboot Computer
  end
end
 
Terminate Installation
[END REGION]
 
label: End of Updates
 
