Hi,
In order to read a path from the registry you can try using a
search. The name of the search is actually an installer property which can be used to set the installation folder. For example, if your files are in "Application Folder" from the "Files and Folders" page, you can create a
Property set with Formatted custom action under "InstallUISequence" -> "AppSearch". This custom action can set the APPDIR property to the property of the search.
To run the custom action only if a path is found in the registry, you can condition it with the property of the search (it shouldn't be empty). Also, while the SHIFT key is pressed you can drag the custom action over "InstallExecuteSequence" -> "AppSearch". This way it will run even if the installation doesn't use an UI.
Please note that the User Guide contains the
Install files in a custom folder how-to which may help you.
Regards,
Cosmin