valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

how to Abort the Install on message box response

I've created a custom action to display a message box during the install. It's a YES/NO message box. I've assigned the response to a User Defined property. Now the big question:
If the user clicks the NO button, how do I abort the install?
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: how to Abort the Install on message box response

Hi,

When you create a "Display message box" custom action you can set a property based on the button the user presses (in your case YES or NO). Then based on the value of the property you set, the installation of your application must continue or stop.

Unfortunately, Advanced Installer does not have this feature, but you can create a simple custom action which will run only if the NO button was pressed and that custom action stops the installation.

I attached to this post a simple VBScript custom action which you can run right under your "Display message box" custom action with the following settings:
- create a "Launch attached file" custom action and choose the VBScript I attached here
- in the "Function" text field write the function found in that VBScript (in this case ExitSetupFromVBS)
- in the "Condition" text field write the property you set with the return value of the "Display message box" custom action (i.e. MYPROP = "IDNO")

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Attachments
exit.rar
Stop Installation custom action
(203 Bytes) Downloaded 879 times
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

Re: how to Abort the Install on message box response

Doesn't seem to work.
Here's the dialog text:
2013-02-13_1811.png
2013-02-13_1811.png (24.18 KiB) Viewed 11771 times
Here's your suggestion:
2013-02-13_1812.png
2013-02-13_1812.png (107.04 KiB) Viewed 11771 times
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: how to Abort the Install on message box response

Hi,

The only error I can see is that you written [BTN_PRESSED] instead of BTN_PRESSED in the "Action Data" text field of the "Display message box" custom action.

Let us know if this helped.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
valiot
Posts: 77
Joined: Tue Dec 04, 2012 1:41 am

Re: how to Abort the Install on message box response

Thanks! That was the problem. It works now.
Eusebiu
Posts: 4931
Joined: Wed Nov 14, 2012 2:04 pm

Re: how to Abort the Install on message box response

You're welcome. I'm glad you got this working.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ppep
Posts: 5
Joined: Thu Feb 04, 2021 10:25 pm

Re: how to Abort the Install on message box response

Hello,

I know this is an old post, but it matches my situation so I though I would continue it.

I am using 17.8 and set up a MessageBox custom action like so:

MessageBoxCustomAction.png
MessageBoxCustomAction.png (82.5 KiB) Viewed 6351 times

and then I am calling the same exit.vbs script if the CONTINUE_BTN_PRESSED = "IDNO"

ExitUninstallCustomAction.png
ExitUninstallCustomAction.png (166.62 KiB) Viewed 6351 times

My problem is that the exit.vbs script runs successfully, but the uninstall continues. Is this script still usable in the latest versions?

Thanks,

Peter
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: how to Abort the Install on message box response

Hello Peter,

From what I can see, your VBS custom action has the "Fail installation if custom action returns an error" option unchecked.

Please note that this is the whole ideea of this.

The VBScript custom action will return a value of 3:

Code: Select all

Const IDABORT = 3
A return code that is different than 0 will be interpreted by Windows Installer as failure.

Basically, your setup will try to uninstall --> the user will press "No" --> the VBScript custom action will be executed --> it will return 3 --> Windows Installer will interpret that as a failure --> the uninstall will not go any further --> the application is not uninstalled.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ppep
Posts: 5
Joined: Thu Feb 04, 2021 10:25 pm

Re: how to Abort the Install on message box response

Hi Catalin,

Thank you for the explanation - that makes total sense now that you spelled it out. We want to force an error condition so it will quit the installer.

I checked the box for 'Fail installation if custom action returns an error' and it works great.

Cheers,

Peter
Catalin
Posts: 6586
Joined: Wed Jun 13, 2018 7:49 am

Re: how to Abort the Install on message box response

You are always welcome, Peter!

I am glad everything works as expected now and that my explanation helped.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”