Conditional Build Events possible in the Project Options/Settings?

Got a problem you cannot solve? Try here.
Post Reply
BartWilson
Posts: 40
Joined: Mon Mar 01, 2021 9:01 am

Conditional Build Events possible in the Project Options/Settings?

Post by BartWilson »

I haven't seen in the forum any mention of the question I have:

Is it possible to create conditional Build Events in the project Settings or do these dialogs only allow for calling commands? I'm asking this as I've been adding a couple of items do the Pre-Compress and Post-Compress events in which I realized I don't want the items to run if my program is still in developmental phase, only for Release.

It seems like I would have to write a custom script (powershell or bat) that accepts a conditional item passed through the miabuild command line. I was hoping to not have to write another script to work around things.

I guess that comes to the second question if the first is no, can the Pre-Compress and Post-Compress Events call powershell or bat scripts?
FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Conditional Build Events possible in the Project Options/Settings?

Post by FrancescoT »

From build events you can run custom applications, or scripts as an integral part of your build process.

In other words, anything that can be invoked via "command prompt", it can be executed via build events as well.

hope this helps you.
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
BartWilson
Posts: 40
Joined: Mon Mar 01, 2021 9:01 am

Re: Conditional Build Events possible in the Project Options/Settings?

Post by BartWilson »

Thanks for the confirmation. It took a bit for me to get a powershell script command line call to work. There is definitely some funny business about spaces in arguments and also the way you have to quote things in the arguments for this to work. But I was finally able to get a script to run with the desired outcome.
JohnGaver
Posts: 265
Joined: Mon Feb 05, 2024 6:15 pm

Re: Conditional Build Events possible in the Project Options/Settings?

Post by JohnGaver »

Interesting discovery.

What were you able to find out about spaces and the quotes that you might be able to potentially share?

Basically was there any divergence from the standard pattern of double quoting any parameters with spaces in them?
John Gaver
InstallAware Skunkworks
InstallAware Multi Platform - Liberating DEB/RPM/PKG/MSI(X) into universal native setups!
Get your free copy today - https://www.installaware.com/installawa ... atform.htm
BartWilson
Posts: 40
Joined: Mon Mar 01, 2021 9:01 am

Re: Conditional Build Events possible in the Project Options/Settings?

Post by BartWilson »

Code: Select all

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe $env:VALUE='"true"'; $env:VALUE2='"#VALUE2#"'; $env:VALUE3='"#VALUE3#"'; . """#PROJDIR#\..\PowerShell.ps1""" arg """#PROJDIR#\somefile.ext"""
You can see there are different level of quotes that I had to add when trying to run a powershell script that exists in the PROJDIR
Post Reply