lmodern1878
09-10-2018, 01:56 AM
Hello
Everyone, I was wondering if I had the script logic right to optionally do a completely clean uninstall.
The goal: run the regular uninstall, after processing the uninstall cue ask the user if they wish to remove any remaining files (such as user-created items not included in the original install). if the user answers "yes" to the question, remove any remaining items then remove the install directory itself. here's what I came up with:
! //////////////////////////////////////////////////////////////////////////////////////////////////
! //
! // SSSS S BBBBBB
! // S SS B B
! // S S B B
! // S B B
! // SSS BBBBB SetupBuilder Uninstall Project Script
! // SS B B
! // S B B Created with build: 10.0.5710
! // S S B B
! // SS S B B
! // S SSSS BBBBBB
! //
! //////////////////////////////////////////////////////////////////////////////////////////////////
#pragma UNINSTALL = "1"
If %_SB_INSTALLERFLAG% Does Not Equal "1" on Position "$SB_SILENTMODEFLAG$" Then
Display Message Box ("#UNINST_CONFIRM#", "#UNINST_HEADING#")
Else
Set Variable %_SB_RETURN% to "$IDYES$"
End
If %_SB_RETURN% Equals "$IDYES$" Then
! --- Process uninstall queue ---
Process Uninstall Queue
! Display message box confirming a complete removal
Display Message Box ("Would you like to remove ALL files and folders which were added AFTER the initial installation?
**** NOTE: VERY IMPORTANT! ****
ANSWERING "YES" TO THIS QUESTION WILL REMOVE ALL FILES AND FOLDERS THAT WERE NOT INSTALLED INITIALLY WITH THE PROGRAM!
THESE ARE USUALLY FILES CREATED BY THE USER AND SHOULD BE BACKED UP TO AVOID DATA LOSS.", "Remove User Information?") [Noisy]
If %_SB_RETURN% Equals "$IDYES$" Then
! Delete all items in the installation folder then delete the folder itself if the user answers "YES" to the question above
Delete File(s) ("%_SB_INSTALLDIR%\*.*")
Delete Folder ("%_SB_INSTALLDIR%")
End
If %_SB_ERRORCODE% Equals "0" And %_SB_INSTALLERFLAG% Does Not Equal "1" on Position "1" Then
Display Message Box ("#UNINST_FINISH#", "#UNINST_HEADING#")
End
End
Did I get the logic right?
This is my first time experimenting with customizing the uninstaller, so given enough tine of doing this, and I'm sure it'll be second nature to me like check box dialogs.
Thanks for any help.
Everyone, I was wondering if I had the script logic right to optionally do a completely clean uninstall.
The goal: run the regular uninstall, after processing the uninstall cue ask the user if they wish to remove any remaining files (such as user-created items not included in the original install). if the user answers "yes" to the question, remove any remaining items then remove the install directory itself. here's what I came up with:
! //////////////////////////////////////////////////////////////////////////////////////////////////
! //
! // SSSS S BBBBBB
! // S SS B B
! // S S B B
! // S B B
! // SSS BBBBB SetupBuilder Uninstall Project Script
! // SS B B
! // S B B Created with build: 10.0.5710
! // S S B B
! // SS S B B
! // S SSSS BBBBBB
! //
! //////////////////////////////////////////////////////////////////////////////////////////////////
#pragma UNINSTALL = "1"
If %_SB_INSTALLERFLAG% Does Not Equal "1" on Position "$SB_SILENTMODEFLAG$" Then
Display Message Box ("#UNINST_CONFIRM#", "#UNINST_HEADING#")
Else
Set Variable %_SB_RETURN% to "$IDYES$"
End
If %_SB_RETURN% Equals "$IDYES$" Then
! --- Process uninstall queue ---
Process Uninstall Queue
! Display message box confirming a complete removal
Display Message Box ("Would you like to remove ALL files and folders which were added AFTER the initial installation?
**** NOTE: VERY IMPORTANT! ****
ANSWERING "YES" TO THIS QUESTION WILL REMOVE ALL FILES AND FOLDERS THAT WERE NOT INSTALLED INITIALLY WITH THE PROGRAM!
THESE ARE USUALLY FILES CREATED BY THE USER AND SHOULD BE BACKED UP TO AVOID DATA LOSS.", "Remove User Information?") [Noisy]
If %_SB_RETURN% Equals "$IDYES$" Then
! Delete all items in the installation folder then delete the folder itself if the user answers "YES" to the question above
Delete File(s) ("%_SB_INSTALLDIR%\*.*")
Delete Folder ("%_SB_INSTALLDIR%")
End
If %_SB_ERRORCODE% Equals "0" And %_SB_INSTALLERFLAG% Does Not Equal "1" on Position "1" Then
Display Message Box ("#UNINST_FINISH#", "#UNINST_HEADING#")
End
End
Did I get the logic right?
This is my first time experimenting with customizing the uninstaller, so given enough tine of doing this, and I'm sure it'll be second nature to me like check box dialogs.
Thanks for any help.