Examples/ExperienceUI/Realworld.nsi
changeset 0 d5ce4c64ef88
child 13 2ae1abe546fd
equal deleted inserted replaced
-1:000000000000 0:d5ce4c64ef88
       
     1 /*
       
     2 ExperienceUI for NSIS:
       
     3 "Windows Notepad"
       
     4 Real World Installation Script (9/24/05) version 1.1
       
     5 Structure:
       
     6 
       
     7 Start
       
     8   |
       
     9   +--Basic Info
       
    10   |
       
    11   +--XPUI: Pages
       
    12   |  |
       
    13   |  --XPUI Page Functions
       
    14   |
       
    15   +--Version Signature Info
       
    16   +--Callback Functions
       
    17   |  |
       
    18   |  +--.onInit
       
    19   |  +--.onInstSuccess
       
    20   |  +--.onUserAbort
       
    21   |
       
    22   +--Data Macros
       
    23   |  |
       
    24   |  +--Base Files
       
    25   |  +--Start Menu LNKs
       
    26   |
       
    27   +--Sections
       
    28   |  |
       
    29   |  +--SubSection: Files
       
    30   |     |
       
    31   |     +--Section: Base Files
       
    32   |     +--Section: Start Menu LNKs
       
    33   |
       
    34   +--Repair
       
    35   |  |
       
    36   |  +--Maintenance Selection Page
       
    37   |  +--Maintenance Selection Page Verifier
       
    38   |  +--Repair Comfirm Page
       
    39   |  |  |
       
    40   |  |  +--Copy Files "Page"
       
    41   |  |
       
    42   |  +--Repair Success Page
       
    43   |
       
    44   +--Uninstall
       
    45   |  |
       
    46   |  +--Pages
       
    47   |  |  |
       
    48   |  |  +--Page Table
       
    49   |  |  +--RMDir Notice
       
    50   |  |
       
    51   |  +--Uninstall Files Function
       
    52   |  +--Uninstall Section
       
    53   |
       
    54  End
       
    55 
       
    56 */
       
    57 
       
    58 CRCCheck off
       
    59 SetCompressor /FINAL lzma
       
    60 SetCompressorDictSize 32
       
    61 
       
    62 ######################################################
       
    63 #                     BASIC INFO                     #
       
    64 ######################################################
       
    65 
       
    66 !define NAME "Windows Notepad"
       
    67 !define VERSION 5.1.2600.2180
       
    68 !define EXECUTABLE "Notepad.exe"
       
    69 Name "${NAME}"
       
    70 Caption "$(^Name)"
       
    71 OutFile NotepadSampleSetup.exe
       
    72 InstallDir "$PROGRAMFILES\${NAME}"
       
    73 InstallDirRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) InstallDir
       
    74 
       
    75 MiscButtonText "Previous" "Next" "Cancel" "Close"
       
    76 CheckBitmap "${NSISDIR}\Contrib\Graphics\Checks\Modern.bmp"
       
    77 
       
    78 !define XPUI_SKIN "Orange"
       
    79 !define XPUI_DISABLEBG
       
    80 !define XPUI_LICENSEBKCOLOR ${XPUI_TEXT_BGCOLOR}
       
    81 !define XPUI_LICENSEPAGE_CHECKBOX
       
    82 !define XPUI_FINISHPAGE_RUN
       
    83 !define XPUI_FINISHPAGE_RUN_FILE "$INSTDIR\Notepad.exe"
       
    84 !define XPUI_FINISHPAGE_TEXT_USE_TOP_ALT
       
    85 !define MUI_ABORTWARNING
       
    86 !define XPUI_VERBOSE 4
       
    87 !include XPUI.nsh
       
    88 !include system.nsh
       
    89 
       
    90 ######################################################
       
    91 #                     XPUI: PAGES                    #
       
    92 ######################################################
       
    93 
       
    94 Page custom setrepair setrpverify " "
       
    95 Page custom repair rpverify " "
       
    96 Page custom repaircomplete "" " "
       
    97 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW WelSetTime
       
    98 !insertmacro XPUI_PAGE_WELCOME
       
    99 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW LicSetTime
       
   100 !insertmacro XPUI_PAGE_LICENSE "${NSISDIR}\Contrib\ExperienceUI\License.rtf"
       
   101 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW CmpSetTime
       
   102 !insertmacro XPUI_PAGE_COMPONENTS
       
   103 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW DirSetTime
       
   104 !insertmacro XPUI_PAGE_DIRECTORY
       
   105 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW ICSetTime
       
   106 !insertmacro XPUI_PAGE_INSTCONFIRM
       
   107 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW IFSetTime
       
   108 !insertmacro XPUI_PAGE_INSTFILES
       
   109 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW ISSetTime
       
   110 !insertmacro XPUI_PAGE_FINISH
       
   111 !define XPUI_PAGE_CUSTOMFUNCTION_SHOW ABSetTime
       
   112 !insertmacro XPUI_PAGE_ABORT
       
   113 
       
   114 ######################################################
       
   115 #                   PAGE FUNCTIONS                   #
       
   116 ######################################################
       
   117 
       
   118 Function WelSetTime
       
   119 BringToFront
       
   120 !insertmacro XPUI_LEFT_SETTIME "10 Minutes"
       
   121 FunctionEnd
       
   122 
       
   123 Function LicSetTime
       
   124 !insertmacro XPUI_LEFT_SETTIME "8 Minutes"
       
   125 FunctionEnd
       
   126 
       
   127 Function CmpSetTime
       
   128 !insertmacro XPUI_LEFT_SETTIME "6 Minutes"
       
   129 FunctionEnd
       
   130 
       
   131 Function DirSetTime
       
   132 !insertmacro XPUI_LEFT_SETTIME "4 Minutes"
       
   133 FunctionEnd
       
   134 
       
   135 Function ICSetTime
       
   136 !insertmacro XPUI_LEFT_SETTIME "2 Minutes"
       
   137 FunctionEnd
       
   138 
       
   139 Function IFSetTime
       
   140 !insertmacro XPUI_LEFT_SETTIME "1 Minute"
       
   141 FunctionEnd
       
   142 
       
   143 Function ISSetTime
       
   144 !insertmacro XPUI_LEFT_SETTIME "Less Than 1 Minute"
       
   145 SetAutoClose true
       
   146 FunctionEnd
       
   147 
       
   148 Function ABSetTime
       
   149 !insertmacro XPUI_LEFT_SETTIME "Not anytime soon..."
       
   150 FunctionEnd
       
   151 
       
   152 ######################################################
       
   153 #                  VERSION SIGNATURE                 #
       
   154 ######################################################
       
   155 
       
   156 VIProductVersion "1.0.0.1"
       
   157 VIAddVersionKey /LANG=1033 "FileVersion" "${VERSION}"
       
   158 VIAddVersionKey /LANG=1033 "ProductVersion" "${VERSION}"
       
   159 VIAddVersionKey /LANG=1033 "ProductName" "${NAME}"
       
   160 VIAddVersionKey /LANG=1033 "Comments" "This installer was written by Dan Fuhry using Nullsoft Scriptable Install System (http://nsis.sourceforge.net)"
       
   161 VIAddVersionKey /LANG=1033 "CompanyName" "Fuhry Computers, Inc."
       
   162 VIAddVersionKey /LANG=1033 "LegalTrademarks" "${NAME} by Dan Fuhry. Copyright © 2004-2005 Fuhry Computers, Inc."
       
   163 VIAddVersionKey /LANG=1033 "LegalCopyright" "Copyright © Dan Fuhry"
       
   164 VIAddVersionKey /LANG=1033 "FileDescription" "${NAME} Setup/Maintenance Program"
       
   165 VIAddVersionKey /LANG=1033 "SpecialBuild" "${NAME} Setup, built on ${__TIMESTAMP__}"
       
   166 
       
   167 ######################################################
       
   168 #                   INITIALIZATION                   #
       
   169 ######################################################
       
   170 
       
   171 Var WB
       
   172 Var WBUNLOADED
       
   173 
       
   174 Function .onInit
       
   175 ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\WindowBlinds InstallLocation
       
   176 IfFileExists $0\WBLoad.exe "" NoWB
       
   177 StrCpy $WB 1
       
   178 MessageBox MB_YESNO|MB_ICONQUESTION "Setup has found WindowBlinds on your system.  If WindowBlinds is loaded, it may cause visual problems with the Install Wizard.$\nDo you want to unload WindowBlinds now? (assuming it is loaded)" IDNO NoWB
       
   179 ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\WindowBlinds InstallLocation
       
   180 ExecWait '"$0\WBLoad.exe" UNLOAD'
       
   181 StrCpy $WBUNLOADED 1
       
   182 NoWB:
       
   183 InitPluginsDir
       
   184 FunctionEnd
       
   185 
       
   186 ######################################################
       
   187 #                INSTALLATION SUCCESS                #
       
   188 ######################################################
       
   189 
       
   190 Function .onInstSuccess
       
   191 HideWindow
       
   192 StrCmp $WBUNLOADED 1 "" NoWB
       
   193 MessageBox MB_YESNO|MB_ICONQUESTION "You unloaded WindowBlinds when you started Setup. Do you want to load it again now?" IDNO NoWB
       
   194 ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\WindowBlinds InstallLocation
       
   195 ExecWait "$0\WBLoad.exe"
       
   196 StrCpy $WB 1
       
   197 NoWB:
       
   198 FunctionEnd
       
   199 
       
   200 ######################################################
       
   201 #                     USER ABORT                     #
       
   202 ######################################################
       
   203 
       
   204 /*
       
   205 Function .onUserAbort
       
   206 StrCmp $NOABORTWARNING 1 NoWarn
       
   207 MessageBox MB_YESNO|MB_ICONQUESTION "Are you sure you want to cancel Setup?" IDYES NoWarn
       
   208 Abort:
       
   209 Abort
       
   210 NoWarn:
       
   211 StrCmp $WBUNLOADED 1 "" NoWB
       
   212 MessageBox MB_YESNOCANCEL|MB_ICONQUESTION "You unloaded WindowBlinds when you started Setup. Do you want to load it again now?" IDNO NoWB IDCANCEL Abort
       
   213 ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\WindowBlinds InstallLocation
       
   214 Exec $0\WBLoad.exe
       
   215 NoWB:
       
   216 FunctionEnd
       
   217 */
       
   218 
       
   219 ######################################################
       
   220 #                    INSTALL DATA                    #
       
   221 ######################################################
       
   222 
       
   223 Var INSTALLING_README
       
   224 
       
   225 !macro INSTALL_BASEFILES
       
   226 StrCpy $INSTALLING_README 0
       
   227 SetOutPath "$INSTDIR"
       
   228 File Data\Notepad.exe
       
   229 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
       
   230 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString "$INSTDIR\Uninst.exe"
       
   231 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" ModifyPath "$INSTDIR\Setup.exe"
       
   232 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon "$INSTDIR\${EXECUTABLE}"
       
   233 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" InstallDir "$INSTDIR"
       
   234 WriteUninstaller $INSTDIR\Uninst.exe
       
   235 Call GetInstallerEXEName
       
   236 Pop $0
       
   237 StrCmp $0 "" "" +3
       
   238 CopyFiles $CMDLINE $INSTDIR\Setup.exe
       
   239 Goto +2
       
   240 CopyFiles $0 $INSTDIR\Setup.exe
       
   241 !macroend
       
   242 
       
   243 !macro INSTALL_STARTLNK
       
   244 CreateDirectory $SMPROGRAMS\$(^Name)
       
   245 CreateShortcut "$SMPROGRAMS\$(^Name)\$(^Name).lnk" $INSTDIR\${EXECUTABLE}
       
   246 CreateShortcut $SMPROGRAMS\$(^Name)\Uninstall.lnk $INSTDIR\Uninst.exe
       
   247 !macroend
       
   248 
       
   249 ######################################################
       
   250 #                      SECTIONS                      #
       
   251 ######################################################
       
   252 
       
   253 ShowInstDetails show
       
   254 InstType "Standard Install"
       
   255 InstType "Standard Install (sans Start Menu Shortcuts)"
       
   256 
       
   257 SubSection "!$(^Name) - Files" SubFiles
       
   258 
       
   259 Section "Base Files (Required)" SecBase
       
   260 FindWindow $0 "#32770" "" $HWNDPARENT
       
   261 GetDlgItem $1 $0 1016
       
   262 ShowWindow $1 ${SW_HIDE}
       
   263 SetDetailsPrint textonly
       
   264 DetailPrint "Initializing Installation..."
       
   265 SetDetailsPrint listonly
       
   266 Sleep 1000
       
   267 FindWindow $0 "#32770" "" $HWNDPARENT
       
   268 GetDlgItem $1 $0 1016
       
   269 ShowWindow $1 ${SW_SHOW}
       
   270 SectionIn RO
       
   271 SectionIn 1 2
       
   272 SetDetailsPrint textonly
       
   273 DetailPrint "Installing Base Files..."
       
   274 SetDetailsPrint listonly
       
   275 !insertmacro INSTALL_BASEFILES
       
   276 SetAutoClose true
       
   277 SectionEnd
       
   278 
       
   279 Section "Start Menu Shortcuts" SecLNK
       
   280 SectionIn 1
       
   281 SetDetailsPrint textonly
       
   282 DetailPrint "Installing Start Menu Shortcuts..."
       
   283 SetDetailsPrint listonly
       
   284 !insertmacro INSTALL_STARTLNK
       
   285 SectionEnd
       
   286 
       
   287 SubSectionEnd
       
   288 
       
   289 Section "Review Installation Details After Setup" SecReview
       
   290 SectionIn 1 2
       
   291 SetAutoClose false
       
   292 SetDetailsPrint textonly
       
   293 DetailPrint "Installation Complete"
       
   294 SetDetailsPrint both
       
   295 SectionEnd
       
   296 
       
   297 Section -post
       
   298 !insertmacro XPUI_HEADER_TEXT "Installation Complete" "Setup has successfully installed $(^Name) on your computer."
       
   299 DetailPrint `SetBrandingImage /IMGID=1302 "$$PLUGINSDIR\Header.bmp"`
       
   300 DetailPrint "GetDlgItem $$0 $$HWNDPARENT 1037"
       
   301 DetailPrint `SendMessage $$0 0xC 0 "STR:Installation Complete"`
       
   302 DetailPrint "GetDlgItem $$0 $$HWNDPARENT 1038"
       
   303 DetailPrint `SendMessage $$0 0xC 0 "STR:Setup has successfully installed $(^Name) on your computer."`
       
   304 GetDlgItem $0 $HWNDPARENT 1
       
   305 SendMessage $0 0xC 0 "STR:Finish"
       
   306 SectionEnd
       
   307 
       
   308 !insertmacro XPUI_FUNCTION_DESCRIPTION_BEGIN
       
   309 !insertmacro XPUI_DESCRIPTION_TEXT ${SubFiles} "$(^Name) - Files to Install"
       
   310 !insertmacro XPUI_DESCRIPTION_TEXT ${SecBase} "$(^Name)'s Base Files"
       
   311 !insertmacro XPUI_DESCRIPTION_TEXT ${SecLNK} "Start Menu Shortcuts for easy access"
       
   312 !insertmacro XPUI_DESCRIPTION_TEXT ${SecReview} "Rewiew the installation log window after Setup completes"
       
   313 !insertmacro XPUI_FUNCTION_DESCRIPTION_END
       
   314 
       
   315 ######################################################
       
   316 #                       REPAIR                       #
       
   317 ######################################################
       
   318 
       
   319 Function setrepair
       
   320 
       
   321 FindWindow $0 "#32770" "$(^Name)"
       
   322 SendMessage $0 ${WM_SETFOCUS} 1 1
       
   323 ShowWindow $0 1
       
   324 BringToFront
       
   325 ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) DisplayName
       
   326 StrCmp $0 "" "" +2
       
   327 Abort
       
   328 !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "${NSISDIR}\Contrib\ExperienceUI\INI\Repair.ini" "Repair.ini"
       
   329 !insertmacro XPUI_HEADER_TEXT `Welcome to the $(^Name) Setup Wizard` `Select which maintenance action you wish to perform.`
       
   330 !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG "Repair.ini"
       
   331 Pop $1
       
   332 GetDlgItem $0 $1 1200
       
   333 SendMessage $0 ${WM_SETTEXT} 0 "STR:Repair $(^Name)"
       
   334 GetDlgItem $0 $1 1201
       
   335 SendMessage $0 ${WM_SETTEXT} 0 "STR:Remove $(^Name)"
       
   336 GetDlgItem $0 $1 1204
       
   337 SendMessage $0 ${WM_SETTEXT} 0 "STR:Select whether you want to repair or remove $(^Name),$\nor if you want to continue Setup normally."
       
   338 GetDlgItem $0 $1 1205
       
   339 GetDlgItem $0 $HWNDPARENT 1
       
   340 SendMessage $0 ${WM_SETTEXT} "" "STR:Repair"
       
   341 GetDlgItem $0 $HWNDPARENT 2
       
   342 SendMessage $0 ${WM_SETTEXT} "" "STR:Cancel"
       
   343 !insertmacro XPUI_INSTALLOPTIONS_SHOW
       
   344 FunctionEnd
       
   345 
       
   346 ######################################################
       
   347 #                  REPAIR: VERIFIER                  #
       
   348 ######################################################
       
   349 
       
   350 Function setrpverify
       
   351 ReadINIStr $0 $PLUGINSDIR\Repair.ini Settings State
       
   352 StrCmp $0 1 SetRepair
       
   353 StrCmp $0 2 SetRemove
       
   354 StrCmp $0 3 SetContinueSetup
       
   355 Return
       
   356 SetRepair:
       
   357 GetDlgItem $0 $HWNDPARENT 1
       
   358 SendMessage $0 ${WM_SETTEXT} "" "STR:Repair"
       
   359 Abort
       
   360 SetRemove:
       
   361 GetDlgItem $0 $HWNDPARENT 1
       
   362 SendMessage $0 ${WM_SETTEXT} "" "STR:Remove"
       
   363 Abort
       
   364 SetContinueSetup:
       
   365 GetDlgItem $0 $HWNDPARENT 1
       
   366 SendMessage $0 ${WM_SETTEXT} "" "STR:Next"
       
   367 Abort
       
   368 Functionend
       
   369 
       
   370 Function CopyFiles
       
   371 !insertmacro INSTALL_BASEFILES
       
   372 !insertmacro INSTALL_STARTLNK
       
   373 FunctionEnd
       
   374 
       
   375 ######################################################
       
   376 #              REPAIR: LOAD UNINSTALLER              #
       
   377 ######################################################
       
   378 
       
   379 Function Repair
       
   380 StrCmp $XPUI_ABORTED 1 "" +2
       
   381 Abort
       
   382 ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) DisplayName
       
   383 StrCmp $0 "" "" +3
       
   384 Delete $PLUGINSDIR\repair.ini
       
   385 Abort
       
   386 ReadINIStr $0 $PLUGINSDIR\Repair.ini "Field 1" State
       
   387 StrCmp $0 0 "" Repair
       
   388 ReadINIStr $0 $PLUGINSDIR\Repair.ini "Field 3" State
       
   389 StrCmp $0 1 ContinueNormally1
       
   390 HideWindow
       
   391 ReadRegStr $4 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) InstallDir
       
   392 Banner::show /NOUNLOAD "Please wait while setup loads the Uninstall wizard..."
       
   393 Banner::getWindow /NOUNLOAD
       
   394 Pop $1
       
   395 !insertmacro XPUI_CONTROL_SKIN $1
       
   396 SendMessage $1 0xC 0 STR:
       
   397 GetDlgItem $0 $1 1032
       
   398 !insertmacro XPUI_CONTROL_SKIN $0
       
   399 GetDlgItem $0 $1 1030
       
   400 !insertmacro XPUI_CONTROL_SKIN $0
       
   401 Sleep 500
       
   402 ExecWait $4\Uninst.exe
       
   403 Banner::destroy
       
   404 Quit
       
   405 Repair:
       
   406 !insertmacro XPUI_INSTALLOPTIONS_EXTRACT_AS "${NSISDIR}\Contrib\ExperienceUI\INI\confirm_rep.ini" "confirm_rep.ini"
       
   407 !insertmacro XPUI_INSTALLOPTIONS_WRITE Confirm_rep.ini "Settings" NextButtonText "Next"
       
   408 !insertmacro XPUI_INSTALLOPTIONS_WRITE Confirm_Rep.ini "Settings" BackEnabled 1
       
   409 !insertmacro XPUI_INSTALLOPTIONS_WRITE Confirm_Rep.ini "Field 2" Text "Setup is ready to repair $(^Name)."
       
   410 !insertmacro XPUI_INSTALLOPTIONS_WRITE Confirm_Rep.ini "Field 3" Text "Click 'Repair' to contunue."
       
   411 !insertmacro XPUI_INSTALLOPTIONS_WRITE Confirm_Rep.ini "Field 4" Top "-17"
       
   412 !insertmacro XPUI_INSTALLOPTIONS_WRITE Confirm_Rep.ini "Field 4" Bottom "-1"
       
   413 !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG confirm_rep.ini
       
   414 GetDlgItem $0 $HWNDPARENT 1
       
   415 EnableWindow $0 0
       
   416 !insertmacro XPUI_HEADER_TEXT "Confirm Repair" "Please confirm that you want to repair $(^Name)."
       
   417 !insertmacro XPUI_INSTALLOPTIONS_SHOW
       
   418 ContinueNormally1:
       
   419 FunctionEnd
       
   420 
       
   421 Function rpverify
       
   422 StrCmp $XPUI_ABORTED 1 "" +2
       
   423 Return
       
   424 ReadINIStr $0 $PLUGINSDIR\Repair.ini "Field 3" State
       
   425 StrCmp $0 1 ContinueNormally2
       
   426 Call CopyFiles
       
   427 GetDlgItem $0 $HWNDPARENT 2
       
   428 EnableWindow $0 0
       
   429 GetDlgItem $0 $HWNDPARENT 3
       
   430 EnableWindow $0 0
       
   431 
       
   432 ######################################################
       
   433 #                 REPAIR: COPY FILES                 #
       
   434 ######################################################
       
   435 
       
   436 !insertmacro XPUI_HEADER_TEXT `Repairing Installation` `Please wait while Setup repairs your installation of $(^Name).`
       
   437 GetDlgItem $0 $1 1201
       
   438 SendMessage $0 ${WM_SETTEXT} "" "STR:Setup is repairing your installation of $(^Name)"
       
   439 GetDlgItem $0 $1 1202
       
   440 SendMessage $0 ${WM_SETTEXT} "" "STR:This may take a few minutes. Please wait...$\n"
       
   441 Sleep 500
       
   442 GetDlgItem $0 $1 1202
       
   443 SendMessage $0 ${WM_SETTEXT} "" "STR:This may take a few minutes. Please wait...$\nCopying Files..."
       
   444 Sleep 5000
       
   445 GetDlgItem $0 $1 1202
       
   446 SendMessage $0 ${WM_SETTEXT} "" "STR:This may take a few minutes. Please wait...$\nWriting registry data..."
       
   447 Sleep 1000
       
   448 GetDlgItem $0 $1 1202
       
   449 SendMessage $0 ${WM_SETTEXT} "" "STR:This may take a few minutes. Please wait...$\nWriting Uninstaller..."
       
   450 Sleep 1000
       
   451 GetDlgItem $0 $1 1202
       
   452 SendMessage $0 ${WM_SETTEXT} "" "STR:This may take a few minutes. Please wait...$\nCopying Maintenance Program..."
       
   453 Sleep 1000
       
   454 GetDlgItem $0 $1 1202
       
   455 SendMessage $0 ${WM_SETTEXT} "" "STR:This may take a few minutes. Please wait...$\nRemoving Backup Files..."
       
   456 Sleep 500
       
   457 Call CopyFiles
       
   458 Sleep 1000
       
   459 StrCpy $7 1
       
   460 GetDlgItem $0 $HWNDPARENT 2
       
   461 EnableWindow $0 1
       
   462 BringToFront
       
   463 Return
       
   464 ContinueNormally2:
       
   465 BringToFront
       
   466 FunctionEnd
       
   467 
       
   468 ######################################################
       
   469 #                  REPAIR: FINISH UP                 #
       
   470 ######################################################
       
   471 
       
   472 Function RepairComplete
       
   473 StrCmp $XPUI_ABORTED 1 "" +2
       
   474 Abort
       
   475 StrCmp $7 1 RepairIt!
       
   476 HideWindow
       
   477 BringToFront
       
   478 Return
       
   479 Repairit!:
       
   480 ShowWindow $HWNDPARENT 5
       
   481 !ifmacrodef  XPUI_SET_BG
       
   482 !insertmacro XPUI_SET_BG
       
   483 !endif
       
   484 SetOutPath $PLUGINSDIR
       
   485 File "${NSISDIR}\Contrib\ExperienceUI\INI\Confirm.ini"
       
   486 !insertmacro XPUI_HEADER_TEXT `Repair Complete` `Setup has successfully repaired your installation of $(^Name).`
       
   487 WriteINIStr $PLUGINSDIR\Confirm.ini "Settings" NextButtonText "Finish"
       
   488 WriteINIStr $PLUGINSDIR\Confirm.ini "Settings" BackEnabled 0
       
   489 WriteINIStr $PLUGINSDIR\Confirm.ini "Field 1" Text "$(^Name) has been successfully repaired."
       
   490 WriteINIStr $PLUGINSDIR\Confirm.ini "Field 2" Text "Click $\"Finish$\" to exit."
       
   491 !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG Confirm.ini
       
   492 GetDlgItem $0 $HWNDPARENT 1
       
   493 EnableWindow $0 0
       
   494 SendMessage $0 ${WM_SETTEXT} "" "STR:Next"
       
   495 GetDlgItem $0 $HWNDPARENT 2
       
   496 SendMessage $0 ${WM_SETTEXT} "" "STR:Finish"
       
   497 StrCpy $XPUI_NOABORTWARNING 1
       
   498 InstallOptions::show
       
   499 Delete $PLUGINSDIR\Confirm.ini
       
   500 Delete $PLUGINSDIR\repair.ini
       
   501 Quit
       
   502 FunctionEnd
       
   503 
       
   504 ######################################################
       
   505 #                   UNINSTALL:PAGES                  #
       
   506 ######################################################
       
   507 
       
   508 !insertmacro XPUI_PAGEMODE_UNINST
       
   509 !insertmacro XPUI_PAGE_UNINSTCONFIRM_NSIS
       
   510 UninstPage custom un.DelConfirm un.DelConfirm.GetReturn
       
   511 !insertmacro XPUI_PAGE_INSTFILES
       
   512 UninstPage custom un.unsuccess
       
   513 
       
   514 SetPluginUnload alwaysoff
       
   515 Function un.unsuccess
       
   516 StrCmp $6 1 "" UninstGood
       
   517 SetOutPath $PLUGINSDIR
       
   518 File "${NSISDIR}\Contrib\ExperienceUI\INI\confirm.ini"
       
   519 !insertmacro XPUI_HEADER_TEXT `Uninstall Incomplete` `Setup encountered a problem while uninstalling $(^Name).`
       
   520 WriteINIStr $PLUGINSDIR\Confirm.ini "Settings" NextButtonText "Close"
       
   521 WriteINIStr $PLUGINSDIR\Confirm.ini "Field 2" Text "An error occured while uninstalling $(^Name)."
       
   522 WriteINIStr $PLUGINSDIR\Confirm.ini "Field 3" Text "Click $\"Close$\" to exit.\r\nError: The folder $0 is a nonexistent, system, or invalid directory, or Setup could not locate the file ${EXECUTABLE} in $0."
       
   523 WriteINIStr $PLUGINSDIR\Confirm.ini Settings BackEnabled No
       
   524 !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG Confirm.ini
       
   525 GetDlgItem $0 $HWNDPARENT 1
       
   526 EnableWindow $0 0
       
   527 SendMessage $0 ${WM_SETTEXT} 0 STR:Next
       
   528 GetDlgItem $0 $HWNDPARENT 2
       
   529 EnableWindow $0 1
       
   530 SendMessage $0 ${WM_SETTEXT} 0 STR:Close
       
   531 StrCpy $XPUI_NOABORTWARNING 1
       
   532 InstallOptions::show
       
   533 Delete $PLUGINSDIR\Confirm.ini
       
   534 Return
       
   535 UninstGood:
       
   536 SetOutPath $PLUGINSDIR
       
   537 File "${NSISDIR}\Contrib\ExperienceUI\INI\confirm.ini"
       
   538 !insertmacro XPUI_HEADER_TEXT `Uninstall Complete` `Setup has successfully uninstalled $(^Name) from your computer.`
       
   539 WriteINIStr $PLUGINSDIR\Confirm.ini "Settings" NextButtonText "Close"
       
   540 WriteINIStr $PLUGINSDIR\Confirm.ini "Field 1" Text "$(^Name) has been successfully uninstalled."
       
   541 WriteINIStr $PLUGINSDIR\Confirm.ini "Field 2" Text "Click $\"Close$\" to exit."
       
   542 WriteINIStr $PLUGINSDIR\Confirm.ini Settings BackEnabled No
       
   543 !insertmacro XPUI_INSTALLOPTIONS_INITDIALOG Confirm.ini
       
   544 GetDlgItem $0 $HWNDPARENT 1
       
   545 EnableWindow $0 0
       
   546 SendMessage $0 ${WM_SETTEXT} 0 STR:Next
       
   547 GetDlgItem $0 $HWNDPARENT 2
       
   548 EnableWindow $0 1
       
   549 SendMessage $0 ${WM_SETTEXT} 0 STR:Close
       
   550 StrCpy $XPUI_NOABORTWARNING 1
       
   551 InstallOptions::show
       
   552 Delete $PLUGINSDIR\Confirm.ini
       
   553 FunctionEnd
       
   554 
       
   555 ######################################################
       
   556 #               UNINSTALL: RMDIR NOTICE              #
       
   557 ######################################################
       
   558 
       
   559 Function un.DelConfirm
       
   560 !insertmacro XPUI_HEADER_TEXT "Uninstall Warning" "If you continue, any of your changes to $(^Name) will be lost!"
       
   561 !insertmacro XPUI_LEFT_MESSAGE "WARNING:" "This uninstaller deletes all of the files in the installation directory. If you have made any changes to $(^Name), they will be lost.  Continue?" 3
       
   562 FunctionEnd
       
   563 
       
   564 Function un.DelConfirm.GetReturn
       
   565 ReadINIStr "$R0" "$PLUGINSDIR\MBSide.ini" "Settings" "State"
       
   566 StrCmp $R0 2 Yes
       
   567 Quit
       
   568 Yes:
       
   569 FunctionEnd
       
   570 
       
   571 ######################################################
       
   572 #                     UNINSTFILES                    #
       
   573 ######################################################
       
   574 
       
   575 Function un.unin
       
   576 ReadRegStr $0 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name) InstallDir
       
   577 StrCmp $0 $WINDIR UnError
       
   578 StrCmp $0 $SYSDIR UnError
       
   579 StrCmp $0 $TEMP UnError
       
   580 StrCmp $0 $PROGRAMFILES UnError
       
   581 IfFileExists $0\${EXECUTABLE} "" UnError
       
   582 Delete $INSTDIR\Notepad.exe
       
   583 Delete $INSTDIR\Uninst.exe
       
   584 RMDir $INSTDIR
       
   585 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)
       
   586 Delete $SMPROGRAMS\$(^Name).lnk
       
   587 Delete $SMPROGRAMS\$(^Name)\$(^Name).lnk
       
   588 Delete $SMPROGRAMS\$(^Name)\Uninstall.lnk
       
   589 RMDir $INSTDIR
       
   590 RMDir $SMPROGRAMS\$(^Name)
       
   591 Return
       
   592 UnError:
       
   593 MessageBox MB_OK|MB_ICONEXCLAMATION|MB_TOPMOST "Setup was either unable to find a valid installation of $(^Name), or $(^Name) was installed in a system folder.  Uninstall incomplete."
       
   594 StrCpy $6 1
       
   595 FunctionEnd
       
   596 
       
   597 ######################################################
       
   598 #                  UNINSTALL SECTION                 #
       
   599 ######################################################
       
   600 
       
   601 Section Uninstall
       
   602 !insertmacro XPUI_HEADER_TEXT "Uninstalling" "Please wait while $(^Name) is being uninstalled."
       
   603 SetAutoClose true
       
   604 Call un.unin
       
   605 SectionEnd
       
   606 
       
   607 !insertmacro XPUI_LANGUAGE English
       
   608 
       
   609 ; EOF