PDA

View Full Version : Custom Uninstall failure



instrumentally
04-06-2017, 07:43 PM
All I wish to do is instruct the uninstaller to remove a few files that will exist in a folder which were not present during the installation. These would be scratch files that did not exist during the install. I am used to Wise Install permitting the developer to insert a line of code into the install.log which would easily perform this task, but with SetupBuilder, the task seems overly complex.

As per the sbuilder.pdf, I tried to follow the instructions on creating a custom uninstall script. The instructions seem lacking in detail.

I can't even get the following script to compile. SB10Dev generates a "Unable to compile an Include script" message with the following code:



#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 ---
/* Delete Files "%_CSIDL_LOCAL_APPDATA%\[PRODUCTNAME]\zipcodes.ndx" */
/* Delete Files "%_CSIDL_LOCAL_APPDATA%\[PRODUCTNAME]\zipdiffs.ndx" */
/* Delete Files "%_CSIDL_LOCAL_APPDATA%\[PRODUCTNAME]\zipdiffs.dbf" */
Process Uninstall Queue

If %_SB_ERRORCODE% Equals "0" And %_SB_INSTALLERFLAG% Does Not Equal "1" on Position "1" Then
Display Message Box "#UNINST_FINISH#" -- "#UNINST_HEADING#"
End
Else
/* Display Message Box "SKIPPED\n\n%_CSIDL_LOCAL_APPDATA%\[PRODUCTNAME]\zi..." -- "SKIPPED" */
End



The sbuilder.pdf makes no mention whether variables defined in the install script are accessible in the uninstall script. I don't know if [PRODUCTNAME] is valid, even if I were to un-comment the commented out lines above. Moreover, the sbuilder.pdf file does explain how a custom uninstall script (even if it were to compile successfully) gets linked to the install project. How does the install project know that a separately compiled uninstall script is supposed to be relevant and linked to the final deployment?

linder
04-07-2017, 06:26 AM
Hello,

You have to add your uninstall (.sbi) script to your MAIN .sbp project and then compile. Or send me your main .sbp and I'll do it for you.

Does this help?

Friedrich

linder
04-07-2017, 06:32 AM
IMO, the task is not complex at all. "New Project..." | "Uninstall Include Script...". Then add whatever you would like to do in your custom uninstall. The IDE generates all the default script lines for you in the standard custom uninstall. Add this newly created uninstall .sbi to your main script, compile and you are done.

Very often, adding lines to the uninstall .log is simply not enough. You can use ALL script functions (except Install Files of course) in a custom uninstall. Similar to the attached...

Just let me know if you need more help.

Friedrich

instrumentally
04-07-2017, 12:50 PM
Does this help?

Yes, your instructions helped. Thank you.