Custom Action Condition - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

mikd
Posts: 42
Joined: Fri Aug 15, 2008 6:09 pm

Custom Action Condition

I've just started evaluating your product and I like it very much!
But I have some problems converting my existing installations.

My application installs some data to the folder CommonAppData\CompanyName\ProductName\FolderName and sets user rights for that folder (using Custom Action DLL) only when it is first created.This folder is not uninstalled. So if it already exists, no Custom Action should be taken.

How can I set the condition for the custom action correctly and where should I place it?

I added the action to InstallFinalize, set the condition for it, based on Custom Property. Then I tried to set this Property in PropertySource action in InstallInitialize, checking the state of the component, which installs the folder (?FolderComp = 2). But this doesn't work. What am I doing wrong? Or maybe there is another way to do what I need?

Best regards,
Mikhail
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action Condition

Hi,

Thank you for your interest in Advanced Installer.

I'm afraid that Windows Installer doesn't offer a direct way of conditioning a custom action based on the presence of a folder. However, there are several approaches you can try:

1) Use a search to find out if the folder exists. After the search is created, you can use its property to condition the custom action (if the property is empty, the folder doesn't exist).
2) Modify your custom action to find the folder. If it cannot find it then it should set the permissions, otherwise it should do nothing.

The custom action should be scheduled after the "CreateFolders" standard action. Therefore, you can schedule it under "InstallExecuteSequence" -> "InstallFinalize".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mikd
Posts: 42
Joined: Fri Aug 15, 2008 6:09 pm

Re: Custom Action Condition

Thank you for your answer!

I tried to do this, I searched for the folder [MY_DIR], which is resolved to the CommonAppDataFolder\[|Manufacturer]\MyDir. It returns always C:'\ all times, regardless of whether the folder exists.
I tried to produce Error Message before calling my custom action to see the resolved value of [MY_DIR] and the result of the search. The folder is resolved correctly and the results of the search are always the same: "C:\".
What am I doung wrong?

Best regards,
Mikhail
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Custom Action Condition

Hi,

I'm not sure why you are encountering this behavior. Can you please send us the AIP you are using (if it doesn't contain confidential information) or a small test case which shows this problem to support at advancedinstaller dot com so we can investigate it?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”