Hello,
in our setup we'd like to call a web service when the user cancels the setup. This is no problem when the user cancels during the modal dialogs of the setup interview; I've just set the Action of the Cancel button to 'Return from Dialog' and handle the answer accordingly.
However I've found no way to achive a similar behavior with the (non-modal) progress dialogs that are shown during the installation of (for example) the SQL-Server Express. If I set the cancel button to 'Cancel Setup' then setup is cancelled immediately without any possibility to call my web service. If I set the Action to 'Return from Dialog' then nothing happens when I press the cancel button.
Is there any way to achieve this behavior:
SQL-Server Express Setup is running in the background, non-modal dialog is shown during this process.
User clicks Cancel button on this dialog.
Messagebox asks if he is sure to cancel the setup.
If the user confirms, a web service is called and setup exits.
If the user denies, setup continues.
Thanks in advance for any suggestions.
How to perform a custom action on user cancel?
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: How to perform a custom action on user cancel?
Dear Ohali,
if I haven't missed your question, you may use the ABORT pre-define variable at such purpose.
"ABORT: TRUE if the Cancel button has been clicked, FALSE if not. Setting this variable has no effect on the state of the Cancel button"
Example;
Hope this helps you.
Regards
if I haven't missed your question, you may use the ABORT pre-define variable at such purpose.
"ABORT: TRUE if the Cancel button has been clicked, FALSE if not. Setting this variable has no effect on the state of the Cancel button"
Example;
Code: Select all
Apply Install (get result into variable SUCCESS)
if Variable ABORT Equals TRUE
MessageBox: , ABORT=$ABORT$
end
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: How to perform a custom action on user cancel?
Thanks for your reply. The following code snippet should clarify my issue:
The script setupsql2014 is obviously a long running job. During the execution of the script my setup is displaying the dialog "progress", which has a Cancel Button. If I set the Action of this button to "Cancel Setup" then IA displays a build-in Messagebox and quits setup immediately, I have no chance to display my own MessageBox (even if I check ABORT instead of WIZARD). If I set the Action of the Button to "Return from Dialog" then nothing happens when I press the Cancel Button, the click is simply ignored.
Regards
Code: Select all
Set Variable PROGRESSTEXT to Installing SQL-Server 2014 Express Edition
Display Dialog: progress, use as progress dialog (non-modal)
Include Script: setupsql2014
if Variable WIZARD Equals CANCEL
MessageBox: $TITLE$ Setup, Are you really sure that you want to cancel setup?
if Variable MSGBOXRESULT Equals YES
Download File https://setup.xyz.net/Web/InstallationCancelled?Text=CANCEL_SQL_SETUP into
GoTo Label: Main Install
end
end
Hide Dialog
The script setupsql2014 is obviously a long running job. During the execution of the script my setup is displaying the dialog "progress", which has a Cancel Button. If I set the Action of this button to "Cancel Setup" then IA displays a build-in Messagebox and quits setup immediately, I have no chance to display my own MessageBox (even if I check ABORT instead of WIZARD). If I set the Action of the Button to "Return from Dialog" then nothing happens when I press the Cancel Button, the click is simply ignored.
Regards
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: How to perform a custom action on user cancel?
Dear Ohali,
you should consider that you are dealing with a modeless Dialog and due of this, the Cancel button selection doesn't close the dialog as it happens with a Modal Dialog. A modeless dialog remains active until this doesn't get effectively terminated (..."Hide Dialog" command) and consequently, it cannot return the button ID unless an asynchronous process handles the specific message from the button (... which is quite difficult if not impossible to do via script).
You may use the "ABORTONERROR" pre-defined variable and if you intend to use it, this has to be defined at the very beginning of your script along with the "Cancel Setup" action defined with the cancel button.
"ABORTONERROR: Initially TRUE. Set this variable to FALSE if you still need the MSIcode script to continue executing in order to perform any custom logic when a low-level setup error (such as a web media block download error) or a user abort occurs."
However, you should exercise care in overriding the default value of this variable. For instance, when a web media block download fails, setup normally aborts; if setup is permitted to continue after a web media block download failure, certain plug-in calls in the corresponding web media block region may fail, violating any assumptions you may have made about script execution. This variable is distinct from the variable ABORT in that while ABORT exclusively signals user cancellation, this variable signals any kind of setup cancellation or error, including low-level setup errors that are innate to the setup engine.
That said, the "ABORTONERROR" cannot be easy to implement and due of this, I may suggest you to consider a totally different approach for your problem.
For example, you may embed your setup.exe in a wrapper installer. From the wrapper you can execute your "effective Installer" via RUN PROGRAM and then to execute your Custom Action based on the value returned by the setup.exe. In order to return a value from your effective installer, you need to use the "Terminate with Exit Code" command. To simplify things I suggest you to return a value (say 100) when your setup.exe completes successfully and then to execute your custom action when the returned value is not equal to 100.
The wrapper can be easily created from the Blank project template and this kind of project doesn't include any pre-defined dialog resource or MSI script statement. To embed your setup.exe into the wrapper add it to SUPPORTDIR.
To find out how to use the SUPPORTDIR, please search for "Modifying Support Files" with the included IA documentation (just press F1 in IA IDE).
Hope this helps you.
Regards
you should consider that you are dealing with a modeless Dialog and due of this, the Cancel button selection doesn't close the dialog as it happens with a Modal Dialog. A modeless dialog remains active until this doesn't get effectively terminated (..."Hide Dialog" command) and consequently, it cannot return the button ID unless an asynchronous process handles the specific message from the button (... which is quite difficult if not impossible to do via script).
You may use the "ABORTONERROR" pre-defined variable and if you intend to use it, this has to be defined at the very beginning of your script along with the "Cancel Setup" action defined with the cancel button.
"ABORTONERROR: Initially TRUE. Set this variable to FALSE if you still need the MSIcode script to continue executing in order to perform any custom logic when a low-level setup error (such as a web media block download error) or a user abort occurs."
However, you should exercise care in overriding the default value of this variable. For instance, when a web media block download fails, setup normally aborts; if setup is permitted to continue after a web media block download failure, certain plug-in calls in the corresponding web media block region may fail, violating any assumptions you may have made about script execution. This variable is distinct from the variable ABORT in that while ABORT exclusively signals user cancellation, this variable signals any kind of setup cancellation or error, including low-level setup errors that are innate to the setup engine.
That said, the "ABORTONERROR" cannot be easy to implement and due of this, I may suggest you to consider a totally different approach for your problem.
For example, you may embed your setup.exe in a wrapper installer. From the wrapper you can execute your "effective Installer" via RUN PROGRAM and then to execute your Custom Action based on the value returned by the setup.exe. In order to return a value from your effective installer, you need to use the "Terminate with Exit Code" command. To simplify things I suggest you to return a value (say 100) when your setup.exe completes successfully and then to execute your custom action when the returned value is not equal to 100.
The wrapper can be easily created from the Blank project template and this kind of project doesn't include any pre-defined dialog resource or MSI script statement. To embed your setup.exe into the wrapper add it to SUPPORTDIR.
To find out how to use the SUPPORTDIR, please search for "Modifying Support Files" with the included IA documentation (just press F1 in IA IDE).
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: How to perform a custom action on user cancel?
Dear Francesco,
thank you for the hint with the wrapper installer, this could possibly solve my problem with the web service call. I'll try it out, but I have to re-write quite some logic, because the wrapper needs some information from the inner setup for making his call.
It would a nice feature for a future version of IA to add an internal variable ABORTONCANCEL that behaves similar to ABORTONERROR, and does not end the whole setup if the user presses Cancel.
Regards
thank you for the hint with the wrapper installer, this could possibly solve my problem with the web service call. I'll try it out, but I have to re-write quite some logic, because the wrapper needs some information from the inner setup for making his call.
It would a nice feature for a future version of IA to add an internal variable ABORTONCANCEL that behaves similar to ABORTONERROR, and does not end the whole setup if the user presses Cancel.
Regards
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: How to perform a custom action on user cancel?
Dear Ohali,
probably something similar already exists with the ABORT pre-defined variable. However as I said previously, it's not easy to handle low level abort conditions due the fact that this may occur or fail at any time, violating any assumptions you may have made about script execution.
"ABORT: TRUE if the Cancel button has been clicked, FALSE if not. Setting this variable has no effect on the state of the Cancel button. Setting this variable back to FALSE when setup has been cancelled will permit the installation to continue executing tasks which normally check for setup cancellation and abort when setup is cancelled."
Regards
probably something similar already exists with the ABORT pre-defined variable. However as I said previously, it's not easy to handle low level abort conditions due the fact that this may occur or fail at any time, violating any assumptions you may have made about script execution.
"ABORT: TRUE if the Cancel button has been clicked, FALSE if not. Setting this variable has no effect on the state of the Cancel button. Setting this variable back to FALSE when setup has been cancelled will permit the installation to continue executing tasks which normally check for setup cancellation and abort when setup is cancelled."
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: How to perform a custom action on user cancel?
Dear Francesco,
I'm not sure, if I got it right: The pre-defined variable ABORT can only be used if ABORTONERROR is set to FALSE. Is that correct?
If so, then ABORTONCANCEL would be a helpful enhancement, because I can leave ABORTONERROR=TRUE. I don't want to handle low-level errors myself, but I really want to handle cancellation by the user.
Another possibility could be something like
ON ERROR GOTO <Label>
and/or
ON CANCEL GOTO <Label>
which would make custom actions easy to implement.
Regards
I'm not sure, if I got it right: The pre-defined variable ABORT can only be used if ABORTONERROR is set to FALSE. Is that correct?
If so, then ABORTONCANCEL would be a helpful enhancement, because I can leave ABORTONERROR=TRUE. I don't want to handle low-level errors myself, but I really want to handle cancellation by the user.
Another possibility could be something like
ON ERROR GOTO <Label>
and/or
ON CANCEL GOTO <Label>
which would make custom actions easy to implement.
Regards
Who is online
Users browsing this forum: Google [Bot] and 108 guests