[DEFINE REGION: Check Application Requirements]
[END REGION]
Set Variable UAC to 
Get Common Folder Location System->Program Files Directory into ALLPROGRAMFILES
Get Folder Location Other->Local Application Data into MYLOCALAPPDATA
Get Folder Location System->Application Data Directory into UAC
Does Folder Exist $UAC$UAC_CHECK (get result into variable FOLD)
Comment: Set Variable TARGETDIR to 
if Variable FOLD Equals FALSE
  Create Folder $UAC$UAC_CHECK
end
Read from Text File $UAC$UAC_CHECK\uac_status.txt into Variable UAC_CHECKING
Read from Text File $UAC$UAC_CHECK\uac_user_status.txt into Variable UAC_USER_CHECKING
Read from Text File $UAC$UAC_CHECK\uac_destination.txt into Variable UAC_TARGET_CHECKING
if Variable UAC_CHECKING Equals ENABLED
  Set Variable MAINTENANCE to FALSE
  Comment: IF INSTALLATION FAILED & WHEN OPEN IT
  Set Variable ALLUSERS to $UAC_USER_CHECKING$
  Set Variable TARGETDIR to $UAC_TARGET_CHECKING$
  Delete Files $UAC$UAC_CHECK/uac_user_status.txt (when installing)
  Delete Files $UAC$UAC_CHECK/uac_destination.txt (when installing)
  Delete Files $UAC$UAC_CHECK/uac_status.txt (when installing)
  GoTo Label: Main Install
end
 
[DEFINE REGION: Check/Install Application Pre-Requisites]
 
[DEFINE REGION: Check Application Pre-Requisites]
Comment: Check Setup Prereqs
Set Variable PREREQ to FALSE
Set Variable PRELIST to 
Set Variable RECOMMENDEDUPGRADE to FALSE
if Variable RECOMMENDEDUPGRADE Equals TRUE
  Set Variable PREREQ to TRUE
  Set Variable PRELIST to $PRELIST$$NEWLINE$Previous Version Removal
end
[END REGION]
 
[DEFINE REGION: Install Application Pre-Requisites]
Comment: Install Setup Prereqs
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)
  if Variable RECOMMENDEDUPGRADE Equals TRUE
    Comment: Bind to external setup log
    Set Variable NATIVE_LOGGING to $NATIVE_OLDLOG$
    Apply Uninstall (get result into variable NATIVE_UNINSTALL)
    if Variable NATIVE_UNINSTALL 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
    else
      if Variable NATIVE_UNINSTALL not Equals COMPLETE
        MessageBox: $TITLE$ Setup, Unable to uninstall old version of $TITLE$. It is strongly recommended that you uninstall it yourself using Control Panel Add-Remove Programs before attempting to install this product.$NEWLINE$$NEWLINE$$LASTERROR$$NEWLINE$$NEWLINE$Click OK to quit $TITLE$ Setup.$NEWLINE$$NEWLINE$Click Cancel to continue $TITLE$ Setup anyways (not recommended).$NEWLINE$$NEWLINE$
        if Variable NATIVE_UNINSTALL Equals OK
          Terminate Installation
        end
      end
    end
    Comment: Bind to internal setup log
    Set Variable NATIVE_LOGGING to 
  end
  Hide Dialog
end
[END REGION]
 
[END REGION]
 
[DEFINE REGION: Define Setup Globals]
Comment: Define Setup Features
Define Component: InstallawareSupport
 
Comment: Initialize Setup Variables
Get Folder Location Other->Local Application Data into LOCALAPPDATA
Get Common Folder Location System->Application Data Directory into SYSTEMAPPDATA
Get Folder Location System->Application Data Directory into USERAPPDATA
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 STARTMENUALL
Get Folder Location Start Menu->Programs Group into STARTMENU
Get Folder Location System->Desktop Directory into DESKTOP
Get Common Folder Location My->My Documents into DOCUMENTS
if Variable MAINTENANCE Equals TRUE
  GoTo Label: Maintenance
end
[END REGION]
 
[DEFINE REGION: Setup User Interview]
Comment: Setup User Interview
label: Introduction
Display Dialog: welcome, wait for dialog to return (modal)
if Variable WIZARD Equals CANCEL
  GoTo Label: Main Install
end
label: Read Me
Display Dialog: readme, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Introduction
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: License Agreement
Display Dialog: licensecheck, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Read Me
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Destination Select
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: License Agreement
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
label: Installation Type
Display Dialog: setuptype, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Destination Select
else
  if Variable WIZARD Equals STANDARD
    Select Component: InstallawareSupport
  end
  Parse String $TARGETDIR$ into Variables CORRECTPATH and  (Split at first occurrence of pattern)
  Write into Text File $CORRECTPATH$\UACCHECKFILE.txt from Value CHECKING UAC (at start of file)
  Does File Exist $CORRECTPATH$\UACCHECKFILE.txt (get result into variable UACFOLDER)
  MessageBox: , $UACFOLDER$
  Delete Files $UAC$UAC_CHECK/uac_user_status.txt (when installing)
  Delete Files $UAC$UAC_CHECK/uac_destination.txt (when installing)
  Delete Files $CORRECTPATH$/UACCHECKFILE.txt (when installing)
  if Variable UACFOLDER Equals FALSE
    Comment: DESINATION UAC CHECK----------------------
    Run Program elevated  $EXEFILE$ 
    if Variable YES not Equals 0
      Terminate Installation
    else
      Write into Text File $UAC$UAC_CHECK\uac_status.txt from Value ENABLED (at start of file)
      Write into Text File $UAC$UAC_CHECK\uac_destination.txt from Value $TARGETDIR$ (at start of file)
      Write into Text File $UAC$UAC_CHECK\uac_user_status.txt from Value $ALLUSERS$ (at start of file)
      Terminate Installation
    end
    MessageBox: , $YES$
  end
  GoTo Label: Main Install
end
 
label: Maintenance
Display Dialog: maintenance, wait for dialog to return (modal)
if Variable WIZARD Equals REMOVE
  Set Variable REMOVE to TRUE
end
[END REGION]
 
[DEFINE REGION: Process (Un)Installation]
label: Main Install
if Variable WIZARD Equals CANCEL
  Terminate Installation
end
 
Comment: Process (Un)Installation
Set Variable SUCCESS to 
Set Variable LASTERROR to 
if Variable PLATFORM Equals MACOS
  Set Variable PLATFORMMENU to /Applications
else
  if Variable ALLUSERS Equals TRUE
    Set Variable PLATFORMMENU to $STARTMENUALL$
  else
    Set Variable PLATFORMMENU to $STARTMENU$
  end
end
Display Dialog: progress, use as progress dialog (non-modal)
[DEFINE REGION: Perform Uninstallation]
if Variable REMOVE Equals TRUE
  Set Variable PROGRESSTEXT to Removing $TITLE$
  Apply Uninstall (get result into variable SUCCESS)
  Set Variable PROGRESS to 100
else
  [END REGION]
  [DEFINE REGION: Perform First Time or Maintenance Installation]
  Set Variable PROGRESSTEXT to Installing $TITLE$
  if Variable MAINTENANCE Equals TRUE
    Comment: Facilitate removal of deselected features and repair of remaining ones
    Apply Uninstall (get result into variable SUCCESS)
    if Variable SUCCESS Equals CANCEL
      Terminate Installation
    end
  end
  [OFFLINE CONTENT]
  Create Shortcut $PLATFORMMENU$/$TITLE$ Maintenance to $UNINSTALLLINK$
  Install Files #PROJDIR#\logooo (1).png to $TARGETDIR$
  Comment: Install Files C:\Users\VaibhavDubey\Downloads\AgentData 13\AgentData\Plugins\Web\* to $TARGETDIR$\Web, include subfolders
  [DEFINE WEB MEDIA InstallawareSupport #PLATFORM#]
  Get Component InstallawareSupport Selection State into Variable SELECTED
  if Variable SELECTED Equals TRUE
  end
  Apply Install (get result into variable SUCCESS)
  Set Variable PROGRESS to 100
end
[END REGION]
[END REGION]
 
[DEFINE REGION: Finish Setup]
Comment: Finish Setup
Hide Dialog
Display Dialog: finish, wait for dialog to return (modal)
if Variable RUNAPP Equals TRUE
  if Variable REMOVE Equals FALSE
    if Variable SUCCESS Equals COMPLETE
      Run Program $TARGETDIR$/InstallawareSupport$APPEXTENSION$ 
    end
  end
end
[END REGION]
 
