Archive: No Uninstall Confirm Page


No Uninstall Confirm Page
The code below compiles and runs but does not show the UNCONFIRM page:

;create the uninstaller
!define MUI_WELCOMEPAGE_TITLE "Uninstall: ${PRODUCT} ${VERSION}"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the uninstall process for \
${COMPANY}'s ${PRODUCT} software.\r\n\r\n\Click Next to begin."
!insertmacro MUI_UNPAGE_WELCOME
!define MUI_UNCONFIRMPAGE_TEXT '"This process will uninstall ${PRODUCT} ${VERSION} from the folder shown below:"\
"Note: The ${PRODUCT} data files are NOT deleted by this process.$\r$\n$\r$\nPlease delete them $\"manually$\"."'
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE "Uninstall: ${PRODUCT} ${VERSION}"
!define MUI_FINISHPAGE_TEXT "Thank you for using ${company}'s\
${PRODUCT} software."
!insertmacro MUI_UNPAGE_FINISH

Furthermore, it I try to use:

!define MUI_UNCONFIRMPAGE_TEXT_TOP (as described in the MUI read me) the compiler halts with an error on that line. What am I doing wrong here?

JAS


Works fine for me. Using the latest version? Can you attach the entire script?


OK. Here is the whole thing. (I ran the update today, so it ought to be the latest version. Do you get an compile error with MUI_UNCONFIRMPAGE_TEXT_TOP?)

;NSIS Modern User Interface version 1.66
;--------------------------------
;Include Modern UI

!include "MUI.nsh"

;--------------------------------
;Configuration

;General

Name "Teaching Assistant"
var DATAINSTDIR
!define VERSION "v. 4.0"
!define PRODUCT "Teaching Assistant"
!define ADDRESS "PO Box 267870 Chicago, IL 60626-7870"
!define SHORT_PRODUCT_NAME "TA"
!define COMPANY "WiseWare"
!define COPYRIGHT "Copyright © 2003 by ${COMPANY}"
!define MUI_HEADERBITMAP "wwOWL.bmp"
!define MUI_HEADERBITMAP_RIGHT
!define MUI_ICON "..\ta.ico"
!define MUI_UNICON "..\unta.ico"
Caption "${PRODUCT} ${VERSION} ${COPYRIGHT}"
OutFile "SetUp${SHORT_PRODUCT_NAME}.exe"

;Folder selection page

InstallDir "$PROGRAMFILES\WiseWare\${PRODUCT}"

;Get install folder from registry if available

InstallDirRegKey HKCU "Software\WiseWare\${PRODUCT}" ""

;--------------------------------
;Modern UI Configuration

!define MUI_ABORTWARNING

;--------------------------------
;Variables

Var STARTMENU_FOLDER
Var MUI_TEMP

;--------------------------------
;Pages

;create Welcome Page
!define MUI_WELCOMEPAGE_TITLE "SetUp: ${PRODUCT} ${VERSION}"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of \
${company}'s ${PRODUCT} software.\r\n\r\n\Click Next to begin the installation process."
!insertmacro MUI_PAGE_WELCOME
;create License Page
!define MUI_LICENSEPAGE_CHECKBOX
!define MUI_LICENSEPAGE_CHECKBOX_TEXT "I accept all the terms of the License Agreement."
!define MUI_LICENSEPAGE_TEXT_TOP "Please review the all terms of the License Agreement: "
!define MUI_LICENSEPAGE_TEXT '"If you accept all the terms of the License Agreement, \
check the box below and then click CONTINUE \
to proceed with the installation." "CONTINUE"'
!define MUI_PAGE_HEADER_TEXT "License Agreement"
!define MUI_PAGE_HEADER_SUBTEXT "${COMPANY} ${ADDRESS}"
!insertmacro MUI_PAGE_LICENSE "taLicense.txt"
;create Program Install Page
!define MUI_PAGE_HEADER_TEXT "Program Install Location"
!define MUI_DIRECTORYPAGE_TEXT '"SetUp will install ${PRODUCT} in the Destination Folder \
shown below.$\r$\n$\r$\nTo select a different Destination Folder, Click Browse..." \
"Destination Folder: "'
!insertmacro MUI_PAGE_DIRECTORY
!define MUI_DIRECTORYPAGE_VARIABLE $DATAINSTDIR
!define MUI_PAGE_HEADER_TEXT "Data Install Location"
!define MUI_PAGE_HEADER_SUBTEXT "Choose the folder in which to install the ${PRODUCT} data files."
!define MUI_DIRECTORY_PAGE_TEXT_TOP "SetUp will install the ${PRODUCT} data files in the Destination Folder \
shown below.$\r$\n$\r$\nTo select a different Destination Folder, Click Browse..."
!insertmacro MUI_PAGE_DIRECTORY

;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PRODUCT}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"

!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER

!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

;create the uninstaller
!define MUI_WELCOMEPAGE_TITLE "Uninstall: ${PRODUCT} ${VERSION}"
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the uninstall process for \
${COMPANY}'s ${PRODUCT} software.\r\n\r\n\Click Next to begin."
!insertmacro MUI_UNPAGE_WELCOME
!define MUI_UNCONFIRMPAGE_TEXT '"This process will uninstall ${PRODUCT} ${VERSION} from the folder shown below:"\
"Note: The ${PRODUCT} data files are NOT deleted by this process.$\r$\n$\r$\nPlease delete them $\"manually$\"."'
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!define MUI_FINISHPAGE_TITLE "Uninstall: ${PRODUCT} ${VERSION}"
!define MUI_FINISHPAGE_TEXT "Thank you for using ${company}'s\
${PRODUCT} software."
!insertmacro MUI_UNPAGE_FINISH

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Functions

Function .onInit
ClearErrors
ReadRegStr $0 HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" Personal
StrCpy $DATAINSTDIR "$0\${PRODUCT}"
ClearErrors
BringToFront
FunctionEnd

;--------------------------------
;Installer Sections

Section "Install"

; SetRebootFlag True

;Establish the Program/Help folder

SetOutPath "$INSTDIR"

;Extract the program

File "..\${SHORT_PRODUCT_NAME}.exe"
File "..\HTML Help\${SHORT_PRODUCT_NAME}.chm"

;Establish the Data folder

SetOutPath "$DATAINSTDIR"

;Extract the data files

IfFileExists "$DATAINSTDIR\ASGNMNTS.FF2" querycopydatafiles
copydatafiles:
File "..\ASGNMNTS.FF2"
File "..\CALENDAR.FF2"
File "..\COURSES.FF2"
File "..\HOLIDAYS.FF2"
File "..\PERSONS.FF2"
File "..\SCHEDULE.FF2"
File "..\SECTIONS.FF2"
File "..\STUDENTS.FF2"
File "..\SUBMSSNS.FF2"
File "..\TERMS.FF2"
dontcopydatafiles:

;Write the Registry Keys

WriteRegStr HKCU "Software\WiseWare\${PRODUCT}" "" $INSTDIR
WriteRegDWord HKCU "Software\${COMPANY}\${PRODUCT}" "defaultLeft" 0
WriteRegDWord HKCU "Software\${COMPANY}\${PRODUCT}" "defaultTop" 0
WriteRegDWord HKCU "Software\${COMPANY}\${PRODUCT}" "ATTENDANCECURSOR" 0
WriteRegDWord HKCU "Software\${COMPANY}\${PRODUCT}" "GRADESCURSOR" 0
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "TERMSTART" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "dataPath" $DATAINSTDIR
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "backupPath" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERID" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERRANK" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERLASTNAME" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERFIRSTNAME" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERINITIAL" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USEROFFICE" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERHOURS" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERPHONE" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USEREMAIL" ''
WriteRegStr HKCU "Software\${COMPANY}\${PRODUCT}" "USERWEBSITE" ''


;Add Application to Add/Remove Programs

WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" "DisplayName" '${PRODUCT}'
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" "UninstallString" '"$INSTDIR\uninstall${SHORT_PRODUCT_NAME}.exe"'
WriteRegDWord HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" "NoModify" 1
WriteRegDWord HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}" "NoRepair" 1

goto done

;Extract the data files

querycopydatafiles:
MessageBox MB_YESNO|MB_ICONQUESTION "The TA data files already exists in:$\n$\r$\n$\r$DATAINSTDIR.$\n$\r$\n$\r\
Do you want to overwrite them?" IDYES copydatafiles
goto dontcopydatafiles

done:


;Create uninstaller

SetOutPath "$INSTDIR"

WriteUninstaller "$INSTDIR\Uninstall${SHORT_PRODUCT_NAME}.exe"

!insertmacro MUI_STARTMENU_WRITE_BEGIN Application

;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall${SHORT_PRODUCT_NAME}.lnk" "$INSTDIR\Uninstall${SHORT_PRODUCT_NAME}.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\${SHORT_PRODUCT_NAME}.lnk" "$INSTDIR\${SHORT_PRODUCT_NAME}.exe"

!insertmacro MUI_STARTMENU_WRITE_END

SectionEnd

;--------------------------------
;Uninstaller Section

Section "Uninstall"

;Delete the program

Delete "$INSTDIR\${SHORT_PRODUCT_NAME}.exe"

;Delete the Help File

Delete "$INSTDIR\${SHORT_PRODUCT_NAME}.CHM"

;Delete the uninstaller

Delete "$INSTDIR\Uninstall${SHORT_PRODUCT_NAME}.exe"

;Delete the install folder

RMDir "$INSTDIR"

!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall${SHORT_PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\${SHORT_PRODUCT_NAME}.lnk"

;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"

startMenuDeleteLoop:
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."

IfErrors startMenuDeleteLoopDone

StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:


;Delete the registry keys

DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT}"
DeleteRegKey /ifempty HKCU "Software\WiseWare\${PRODUCT}"
DeleteRegKey /ifempty HKCU "Software\WiseWare"

SectionEnd


Please attach large scripts next time.

It compiles fine and shows the uninstall confirm page (the page that shows the folder). This define for the top text also works fine.


Are you saying that when you run the uninstaller you see this text one one of the pages:

**********

Note: The Teaching Assistant data files are NOT deleted by this process.

Please delete them "manually".

**********

I see the welcome page, then the page with the folder, then the finish page, but on none of them do I see the text above (which appears in the script as: !define MUI_UNCONFIRMPAGE_TEXT '"This process will uninstall ${PRODUCT} ${VERSION} from the folder shown below:"\
"Note: The ${PRODUCT} data files are NOT deleted by this process.$\r$\n$\r$\nPlease delete them $\"manually$\"."')


JAS


The confirm page IS the page with the folder, that's how it's called. Make sure you set the define before the page macro.

There is no MUI_UNCONFIRMPAGE_TEXT, only MUI_UNCONFIRMPAGE_TEXT_TOP.


Now I am really confused. My script compiles with

MUI_UNCONFIRMPAGE_TEXT

though it does not show the text in question

If I use

MUI_UNCONFIRMPAGE_TEXT_TOP

the compiler gives the following error:

!insertmacro: MUI_UNPAGE_CONFIRM
UninstallText expects 1-2 parameters, got 17.
Usage: UninstallText Text_to_go_on_uninstall_page [subtext]
Error in macro MUI_UNPAGE_CONFIRM on macroline 22
Error in script "C:\Documents and Settings\James Schulz\My Documents\Code\Delphi\TEACHING ASSISTANT\NSIS\TeachingAssistant.nsi" on line 94 -- aborting creation process


It will always compile if you choose a random name, it just does nothing with that setting.

There are weird quotes in your MUI_UNCONFIRMPAGE_TEXT_TOP setting, try:

!define MUI_UNCONFIRMPAGE_TEXT_TOP "This process will uninstall ${PRODUCT} ${VERSION} from the folder shown below. Note: The ${PRODUCT} data files are NOT deleted by this process.$\r$\n$\r$\nPlease delete them $\"manually$\"."

Note: Because of a minor flaw, do not break this text up in multiple lines for now. This will be fixed soon.

OK. I understand now. I don't know much about compilers, and it never occurred to me that the NSIS compiler would simple ignore a line it didn't understand (without giving an error). Thanks,

JAS


It does understand that lines, it sets the define MUI_UNCONFIRMPAGE_TEXT.

However, the Modern UI does nothing with it.