Cancel installation by Inline Script Code - Advanced Installer Community
thorsten
Posts: 7
Joined: Thu Oct 30, 2014 11:29 am

Cancel installation by Inline Script Code

Hello All,

please give me a hint, how to gracefully cancel an installation as a result of a Custom Action (Inline Script Code).

Example:
- start setup
- showing: Language Selection Dialog, Welcome Wizard Page
- now, setup checks as Custom Action either with or without sequence for a special condition (both ways, I got working. Result is accessible as property)
- if this condition fails, setup should be cancelled ( :roll: don't know how to do it???)
- if not, setup continues

Regards,
Thorsten
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Cancel installation by Inline Script Code

Hello Thorsten,

In order to cancel an installation within a custom action you should return an error exit code within that custom action. However, please keep in mind that the "Execute inline script code" custom action always returns success. Please take a look on our "Forcing a silent installation to fail" thread which debates a similar issue.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
thorsten
Posts: 7
Joined: Thu Oct 30, 2014 11:29 am

Re: Cancel installation by Inline Script Code

Thank you Daniel.

I moved my Inline Script code to an vbs-file and included it to an "Launch attached file" custom action as suggested in the thread.
Now, I can control the cancellation with a return code of the specified "Function".

This works.... but....

I cannot access the session properties (specfied as "Action Data") in my vb-script via Session.Property( "MyProp" ) :x

Neither '-MyProp "some data"' nor "/MyProp="some data"' is working (empty string)

But Session.Property("APPDIR") returns a value.

What am I doing wrong?!

--- Update ---

Ok! I've got it! The key is:

Code: Select all

Session.Property("CustomActionData")
In this case "CustomActionData" ist not just an example property... Oh man!!

An example (How to, FAQ etc.) in Advanced Installers Help would be very helpful... 8-)

Regards,
Thorsten
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Cancel installation by Inline Script Code

Hello Throsten,

Indeed, if you are using a deferred custom action then the only way to access installer properties is by using the "CustomActionData" special property. We'll try to add an user guide article about the usage of "CustomActionData" property.

However, please keep in mind that if your custom action is scheduled as immediate you should be able to access any property value within your VBS custom action code.

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

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”