Comment: Win32 Application Setup Project
 
[DEFINE REGION: Check Application Requirements]
Get System Setting Administrator Rights into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
  MessageBox: $TITLE$ Setup Error, This product requires at least Administrator Privileges.$NEWLINE$$NEWLINE$Setup cannot continue.
  Terminate Installation
end
Get System Setting Windows XP into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
  MessageBox: $TITLE$ Setup Error, This product requires at least Windows XP.$NEWLINE$$NEWLINE$Setup cannot continue.
  Terminate Installation
end
Get System Setting 512 MB Physical Memory into CHECKSYSTEM
if Variable CHECKSYSTEM not Equals TRUE
  MessageBox: $TITLE$ Setup Error, This product requires at least 512 MB Physical Memory.$NEWLINE$$NEWLINE$Setup cannot continue.
  Terminate Installation
end
[END REGION]
 
[DEFINE REGION: Check/Install Application Pre-Requisites]
 
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check setup pre-requisites
Set Variable PREREQ to FALSE
Set Variable PRELIST to 
[compiler if Variable BUILDMODE not Equals PATCH]
if Variable NEEDSUPGRADE Equals TRUE
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Uninstallation
end
Include Script: checkvc10_x86
Include Script: checkmsi31
Include Script: checkmsxml60
Set Variable OSVER to 
Get Exact OS Level into OSVER
if Variable OSVER not Equals 2008
  if Variable OSVER not Equals UNKNOWN
  end
end
if Variable OSVER not Equals UNKNOWN
end
[compiler end]
[END REGION]
 
[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 
    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 Visual C++ Runtime 10.0 (includes ATL and MFC), Exclude from Build]
  Include Script: setupvc10_x86
  [DEFINE WEB MEDIA Microsoft Windows Installer 3.1, Exclude from Build]
  Include Script: setupmsi31
  [DEFINE WEB MEDIA Microsoft XML Parser 6.0, Exclude from Build]
  Include Script: setupmsxml60
  if Variable OSVER not Equals 2008
    if Variable OSVER not Equals UNKNOWN
    end
  end
  [compiler end]
  Hide Dialog
end
[END REGION]
 
[END REGION]
 
[DEFINE REGION: Define Setup Globals]
Comment: Define Setup Components
 
Comment: Initialize Setup Globals
Get System Setting Windows NT Kernel (NT4, 2000, XP, 2003, Vista, 2008) into ISNT
Get Folder Location Start Menu->Startup Group into MYSTARTUP
Get Folder Location System->Program Files Directory into PROGRAMFILES
Get Common Folder Location System->Program Files Directory into COMMONFILES
Get Common Folder Location Start Menu->Programs Group into SHORTCUTFILESALL
Get Folder Location Start Menu->Programs Group into SHORTCUTFILES
if Variable SHORTCUTFILESALL Equals 
  Set Variable SHORTCUTFILESALL to $SHORTCUTFILES$
end
Get Folder Location System->Desktop Directory into DESKTOPDIR
Get Folder Location System->Windows Directory into WINDIR
Get Folder Location System->System Directory into WINSYSDIR
Get Folder Location Taskbar->Quick Launch Directory into QUICKLAUNCHDIR
Get Folder Location WWW->WWWRoot into WWWROOTDIR
[END REGION]
 
[DEFINE REGION: Setup User Interview]
if Variable MAINTENANCE Equals TRUE
  GoTo Label: Maintenance
else
  [compiler if Variable BUILDMODE not Equals PATCH]
  Comment: First Time Install
  Set Variable TARGETDIR to $PROGRAMFILES$\Priority
  Set Variable STARTMENU to $TITLE$
  [compiler end]
end
 
label: Welcome Dialog
Display Dialog: welcome, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
  GoTo Label: Main Install
end
[compiler if Variable BUILDMODE not Equals PATCH]
label: License Check
Comment: Display Dialog: licensecheck, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Welcome Dialog
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: ReadMe Information
Comment: Display Dialog: readme, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: License Check
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: User Registration
Comment: Display Dialog: registration, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: ReadMe Information
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Setup Type
Comment: Display Dialog: setuptype, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: User Registration
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
Comment: TO-DO: Customize your minimum setup here
if Variable MINIMUM Equals TRUE
else
  if Variable COMPLETE Equals TRUE
  end
end
label: Custom Setup
Comment: Display Dialog: componentstree (if variable PERSONALIZED is TRUE), wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Setup Type
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Destination Directory
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Custom Setup
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Start Menu
Comment: Display Dialog: startmenu, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Destination Directory
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
[compiler end]
label: Start Installation
Comment: Display Dialog: startinstallation, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  [compiler if Variable BUILDMODE not Equals PATCH]
  GoTo Label: Start Menu
  [compiler else]
  GoTo Label: Welcome Dialog
  [compiler end]
else
  GoTo Label: Main Install
end
 
label: Maintenance
Comment: Maintenance Install/Uninstall
wizard loop
Display Dialog: maintenance, wait for dialog to return (modal)
Comment: Display Dialog: componentstree (if variable MODIFY is TRUE), wait for dialog to return (modal)
Display Dialog: startinstallation, wait for dialog to return (modal)
end
[END REGION]
 
[DEFINE REGION: Process (Un)Installation]
label: Main Install
Comment: Exit Setup if Wizard Loop cancelled
if Variable WIZARD Equals CANCEL
  Terminate Installation
end
if Variable MAINTENANCE Equals TRUE
  if Variable REMOVE Equals FALSE
    MessageBox: Priority 15 Silverlight, The installation has finished successfully.
    Terminate Installation
  end
end
 
Comment: Prepare to install
Set Variable PROGRESSTEXT to Installing $TITLE$
Set Variable SUCCESS to 
Set Variable LASTERROR to 
if Variable ALLUSERS Equals TRUE
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILESALL$\$STARTMENU$
else
  Set Variable SHORTCUTFOLDER to $SHORTCUTFILES$\$STARTMENU$
end
Display Dialog: progress, use as progress dialog (non-modal)
 
Comment: Modify Target System
[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
  Comment: Uninstall product
  Comment: TO-DO: Insert any additional uninstall commands here
  Run Program $TARGETDIR$\olsync.exe -uninstall (WAIT)
  Apply Uninstall (get result into variable SUCCESS)
  Set Variable PROGRESS to 100
else
  [END REGION]
  [DEFINE REGION: Perform First Time or Maintenance Installation]
  Comment: Install/Re-Install product
  Create Shortcut $SHORTCUTFOLDER$\Uninstall PrioritySetup to $UNINSTALLLINK$
  [OFFLINE CONTENT]
  [OFFLINE CONTENT]
  if Variable SELECTED Equals TRUE
  end
  [OFFLINE CONTENT]
  if Variable SELECTED Equals TRUE
  end
  [DEFINE WEB MEDIA PrioritySetup]
  if Variable SELECTED Equals TRUE
  end
  Comment: TO-DO: Insert any additional install commands here
  [compiler if Variable BUILDMODE Equals PATCH]
  Apply Patch (get result into variable SUCCESS)
  [compiler else]
  if Variable ADVERTISE Equals TRUE
    Apply Advertised (get result into variable SUCCESS)
  else
    Write Registry Key HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\net_tabula.ini\\, USR:Software\Priority\tabula.ini
    Install Files J:\Library\wpf\publish\localbin\heblocale.msi to $TARGETDIR$
    Install Files J:\Library\wpf\publish\localbin\certmgr.exe to $TARGETDIR$
    Install Files J:\Library\wpf\publish\localbin\eshbel.cer to $TARGETDIR$
    Write Registry Key HKLM\SOFTWARE\Priority\tabula.ini\\Tabula Path, $TARGETDIR$\
    Write Registry Key HKLM\SOFTWARE\Microsoft\.NETFramework\Windows Presentation Foundation\Hosting\\RunUnrestricted, 1
    Write Registry Key HKCU\Software\priority\tabula.ini\NetMenu\\Tabula Path, $TARGETDIR$\
    Install Files J:\Library\wpf\publish\localbin\unzip.exe to $TARGETDIR$
    Install Files J:\Library\wpf\publish\localbin\mage.exe to $TARGETDIR$
    Write Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Ext\PreApproved\{0002E55D-0000-0000-C000-000000000046}\\, 
    Write Registry Key HKCU\Software\Microsoft\Office\12.0\Common\Security\\DisableHyperlinkWarning, 1
    Write Registry Key HKCU\Software\Microsoft\Office\11.0\, 
    Write Registry Key HKCU\Software\Microsoft\Office\11.0\Common\, 
    Write Registry Key HKCU\Software\Microsoft\Office\11.0\Common\Security\DisableHyperlinkWarning, 1
    Write Registry Key HKLM\SOFTWARE\Priority\tabula.ini\Priority Version, 15.0
    Install Files H:\Library\wpf\publish\localbin\olsync.exe to $TARGETDIR$
    Get Folder Location Start Menu->Start Menu Group into SHORTCUTROOT
    Create Shortcut $MYSTARTUP$\Priority - Outlook Sync to $TARGETDIR$/olsync.exe
    Install Files J:\Library\wpf\publish\localbin\priol.dll to $TARGETDIR$
    Write Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent\Post Platform\Priority SL 15.0, 
    Apply Install (get result into variable SUCCESS)
    if Variable SUCCESS not Equals ERROR
      if Variable SUCCESS not Equals CANCEL
        Set Read Write Permissions on File System Object "$TARGETDIR$" for Everyone 
        Grant Complete Access to Registry Key "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\IniFileMapping\net_tabula.ini"
        Grant Complete Access to Registry Key "HKLM\SOFTWARE\Priority\tabula.ini"
        Run Program $TARGETDIR$\olsync -t tabula.ini -r
        Set Read Write Permissions on Registry Key "HKCU\Software\Classes" for Current User 
        Set Read Write Permissions on File System Object "%userprofile%\local settings\apps" for Current User 
        Set Read Write Permissions on File System Object "%userprofile%\local settings\application data" for Current User 
        Run Program $TARGETDIR$\certmgr.exe -add eshbel.cer -s -r localMachine TrustedPublisher (WAIT)
      end
    end
  end
  [compiler end]
  Set Variable PROGRESS to 100
end
[END REGION]
[END REGION]
 
[DEFINE REGION: Finish Setup]
Comment: End of Installation
Hide Dialog
Display Dialog: finish, wait for dialog to return (modal)
if Variable SILENT Equals FALSE
  if Variable REBOOTCOMPUTER Equals TRUE
    if Variable SUCCESS Equals REBOOT
      Reboot Computer
    end
  end
  if Variable RUNAPP Equals TRUE
    if Variable REMOVE Equals FALSE
      if Variable SUCCESS Equals COMPLETE
        Comment: TO-DO: Insert command that starts your application here
      end
    end
  end
end
if Variable REMOVE Equals FALSE
  Set Variable RESTARTNOW to FALSE
  if Variable OSVER Equals VISTA
    Set Variable RESTARTNOW to TRUE
  end
  if Variable OSVER Equals UNKNOWN
    Set Variable RESTARTNOW to TRUE
  end
  if Variable RESTARTNOW Equals TRUE
    Set Variable RESTARTNOW to 
    MessageBox: Priority 15 Silverlight, You need to restart your computer before you can run Priority 15 on Silverlight.$NEWLINE$Restart now?
    if Variable RESTARTNOW Equals YES
      Reboot Computer
    end
  end
end
[END REGION]
 
