MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

Skip multiple dialogs based on conditions

Hi,

I want to use a PowerShell script to decide to which dialog the Next-button on a dialog goes forward to. I essentially want to skip specific dialogs when certain criteria's are fulfilled.
My problem now is that depending on the conditions I want to skip either dialog X, Y, and Z, two of them, or all of them. The back buttons of the later dialogs also shall skip those dialogs when going back.
Thus, to achieve this, I wanted to use PowerShell to solve this in a way that does not clutter all the next/back buttons. Because in the future we will add even more dialogs that we want to skip depending on our conditions.
But, is there a way to go to a specific dialog using a custom action? I only could find the hard-coded way where I select in advance at the custom action to which dialog it should navigate when a condition is fulfilled. But instead, I need a single custom action that navigates to dialog X or Y or Z depending on e.g. a property. Otherwise I would need to add to each Next- and Back-button as many events as there are dialogs to be skipped, which is just not maintainable in the long term as will keep expanding this.

I tried implementing this using a property per dialog, that I set to either "0" or "1" and then using the "Show Only If.." option. But that does only work well if there is just a single dialog to skip. It is just not programmed to be used for multiple dialogs it seems. I need to able to skip two or more dialogs too.

Best regards,
Johannes
Liviu
Posts: 1273
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Skip multiple dialogs based on conditions

Hello Johannes,
But, is there a way to go to a specific dialog using a custom action? I only could find the hard-coded way where I select in advance at the custom action to which dialog it should navigate when a condition is fulfilled. But instead, I need a single custom action that navigates to dialog X or Y or Z depending on e.g. a property. Otherwise I would need to add to each Next- and Back-button as many events as there are dialogs to be skipped, which is just not maintainable in the long term as will keep expanding this.
I'm afraid you cannot control the dialogs from custom actions. The only thing you can do to condition a dialog using a PowerShell script will be to return a property and, based on that property, skip or not the dialog using the Published Events tab (Display a specific dialog event).
I tried implementing this using a property per dialog, that I set to either "0" or "1" and then using the "Show Only If.." option. But that does only work well if there is just a single dialog to skip. It is just not programmed to be used for multiple dialogs it seems. I need to able to skip two or more dialogs too.
You can skip more dialogs with the Show only if... option. Just drag & drop the desired dialogs under this condition:
show only if.png
show only if.png (29.17 KiB) Viewed 7585 times

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MGS
Posts: 128
Joined: Tue Oct 04, 2022 9:52 am

Re: Skip multiple dialogs based on conditions

Hello Liviu,
Liviu wrote: Tue Aug 29, 2023 2:46 pm I'm afraid you cannot control the dialogs from custom actions. The only thing you can do to condition a dialog using a PowerShell script will be to return a property and, based on that property, skip or not the dialog using the Published Events tab (Display a specific dialog event).
That is exactly how I thought this could work. I created a feature request for that: viewtopic.php?f=1&t=51615
Liviu wrote: Tue Aug 29, 2023 2:46 pm You can skip more dialogs with the Show only if... option. Just drag & drop the desired dialogs under this condition:

The Show-If feature does not correctly set the Next/Back button conditions correctly for me as far as I could see when having a different condition per dialog that I want to skip specified.

So I have dialogs A, B, C, D, E and conditions b, c, d.
I want dialog B to be skipped when condition b is met, dialog C to be skipped when condition c is met, and likewise for D and d.
So when b is fulfilled, the next button of A should go to C, and the back button of C should go to A.
When b and c are fulfilled, the next of A should go to D, and the back button of D should go to A.
When a and c are fulfilled, the next of A should go to B, the next button of B to D, and the back button of D should go to B, and the back button of B should go to A.
Basically all different possible cases (in this case there are just 8) should be covered.

In the future, we will get more dialogs and conditions. When having e.g. 5 dialogs, this will end up in 32 such cases already. Currently, it will be a hassle to implement with the given tools as far as I can see. With my feature request implemented this is straightforward to implement using e.g. a PowerShell script.

I will try to again with the Show-If option though and will let you know how that goes. As a programmer, I would still prefer this way nonetheless: viewtopic.php?f=1&t=51615, mainly because we can't change the conditions of the Show-If once it is created, which makes it really user-unfriendly.

Best regards,
Johannes
Liviu
Posts: 1273
Joined: Tue Jul 13, 2021 11:29 am
Contact: Website

Re: Skip multiple dialogs based on conditions

Hello Johannes,

Thank you for sharing your detailed feedback and observations regarding the Show-If feature. Your input is highly valuable to us as it helps us understand the challenges you're facing and the specific requirements you have for your project.

It's clear that you've put a lot of thought into the scenarios and conditions you want to manage in your dialogs, and I appreciate your efforts in explaining the complexities involved. It's great to hear that you're considering giving the Show-If option another try to see how it works in your context.

Please don't hesitate to keep us updated on your experiences with the Show-If option or any other aspects of our product. Your insights are instrumental in helping us refine our tools and provide the best solutions for our users.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”