sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Merge Module Custom Action With NOT Property Condition

Wed Jul 01, 2020 8:32 pm

I wanted to run a Custom Action, defined in a merge module, only if a global property was NOT defined.

e.g. take "NOCHROME"

I did not define it in "Module Details" -> "Properties" section.

For the "Execution Stage" condition I entered "NOT NOCHROME".

When I did a command-line install without any parameters the CA ran. When I ran a command-line install with "NOCHROME=1" the CA still ran.

I'm confused why?
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Merge Module Custom Action With NOT Property Condition

Wed Jul 01, 2020 9:28 pm

I switched to defining NOCHROME set to 0 in my merge module details and changed the condition to NOCHROME=0 but the CA still runs when passing in NOCHROME=1

We're on A.I. 15.9
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Merge Module Custom Action With NOT Property Condition

Wed Jul 01, 2020 9:36 pm

For the last scenario I think I got bit by Merge Module defined properties, i.e. the Merge Module defined:

Property(S): NOCHROME.1774B61E_82C4_4E8C_8FBA_A705BBC46365 = 0

and I need to copy the Session One to this "local" one, e.g.:

Session.Property("NOCHROME.1774B61E_82C4_4E8C_8FBA_A705BBC46365") = Session.Property("NOCHROME")
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Merge Module Custom Action With NOT Property Condition

Thu Jul 02, 2020 12:06 am

These are jogging my memory now:


viewtopic.php?t=28352
viewtopic.php?t=21179
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Merge Module Custom Action With NOT Property Condition

Thu Jul 02, 2020 12:57 am

I used the "Set Installer Property" as mentioned in:

viewtopic.php?t=3159#p71219

And pass in NOCHROME=1 on command line (NOTE: Not silent command line, still using UI) and my condition is NOCHROME <> "1" so it should fail and not do the CA but it still does :-(

I've never put PROP.GUID into a merge module condition before.

So I'm confused
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Merge Module Custom Action With NOT Property Condition

Thu Jul 02, 2020 1:06 am

Ahhh don't think Set Installer Property CA picked up Main Project Prop, can both be named the same?

MSI (s) (34:98) [18:49:02:903]: Doing action: SetProperty_NOCHROME.1774B61E_82C4_4E8C_8FBA_A705BBC46365
Action 18:49:02: SetProperty_NOCHROME.1774B61E_82C4_4E8C_8FBA_A705BBC46365.
Action start 18:49:02: SetProperty_NOCHROME.1774B61E_82C4_4E8C_8FBA_A705BBC46365.
Action ended 18:49:02: SetProperty_NOCHROME.1774B61E_82C4_4E8C_8FBA_A705BBC46365. Return value 1.
MSI (s) (34:98) [18:49:02:903]: Doing action: SetProperty_NOEDGE.1774B61E_82C4_4E8C_8FBA_A705BBC46365

I defined SET CA as:
Capture_SET.jpg
Capture_SET.jpg (41.79 KiB) Viewed 7669 times
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

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

Re: Merge Module Custom Action With NOT Property Condition

Fri Jul 03, 2020 1:12 pm

Hello Scott,

In order to achieve what you want, please follow these steps:

Let's consider our property is named MY_PROP

1. open your Advanced Installer's MSM project

2. go to "Module Details" page and copy the "Module GUID". In my case, the module GUID is:

Code: Select all

FFA5E2FB_23E1_4824_A672_BB60D048DA0F
3. now please go to "Custom Actions" page and condition your custom action using the name of the property and the merge module's guid, e.g.:

Code: Select all

MY_PROP.FFA5E2FB_23E1_4824_A672_BB60D048DA0F = "1"
MergeModCA.png
MergeModCA.png (105.55 KiB) Viewed 7647 times

4. now please open your main project

5. go to "Custom Actions" page and create a "Set Property" custom action, as it follows:
MainProjCA.png
MainProjCA.png (109.53 KiB) Viewed 7647 times

Now, you can launch your MSI file as it follows:
CMDLaunch.png
CMDLaunch.png (26.96 KiB) Viewed 7647 times

In the first run, the custom action should be executed, while in the second run, the custom action should not be executed.

Additionally, please find attached a .ZIP archive containing the two .AIP files (for the MSM and the main project).

Scott Sample Project.zip
(3.72 KiB) Downloaded 222 times

Hope this helps.

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

sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Merge Module Custom Action With NOT Property Condition

Fri Sep 10, 2021 9:31 pm

This answer didn't complete address my question as I want the CA to run ONLY if MY_PROP=1 and not run if it's anything else or NOT provided on the command line.

This answer did point me in the right direction I hope. If so I will post what I did here for history purposes :D
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

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

Re: Merge Module Custom Action With NOT Property Condition

Mon Sep 13, 2021 12:39 pm

Hello Scott,

I am glad to hear the solution helped you (even though not completely).

Please let us know if everything is working as expected in the end. :)

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

sjeslis
Posts: 308
Joined: Mon Aug 22, 2011 11:40 pm
Contact: Website

Re: Merge Module Custom Action With NOT Property Condition

Thu Sep 16, 2021 4:45 pm

I made MY_PROP "optional" by adding MY_PROP to parent installer's "Install Parameters" and set it 0.

In the MSM I made the condition check MY_PROP.[guid] = "0" so NOT having it on the command line will run the CA by default, passing in MY_PROP=1 will cause it to be skipped.

Also worth mentioning in the parent installer you should copy the SetProperty to the Install Execution Stage as well if you support command line/silent installs ;)
Scott Jeslis
Senior Software Engineer
Cicero, Inc.

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

Re: Merge Module Custom Action With NOT Property Condition

Fri Sep 17, 2021 12:44 pm

Thank you for your followup on this, Scott!

I am glad to hear everything is working as expected now.

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

Return to “Common Problems”