View Full Version : How do I set a dynamic destination folder from a lua script
hughg
12-15-2009, 05:46 PM
Please help, I have created a lua script that determines the target folders for a number of data files based on some registry settings and other information from previously installed third party products. Based on this information I have set a number of Public Properties to the paths that the install needs to use. I know the properties are being set from my script as I can see them on both the client and server side in the detailed MSI logs.
I need to set target folders based on these but without providing a user interface to change the paths, so no dialog publish events can be used as far as I can see.
I have tried to set folder values to my properties, using the Custom Actions, Set Folder editor but they do not seem to stick, when I look at the MSI logs the server side values of the folders are the literal property names rather than their values.
I'm evaluating MSI Factory and so far it looks great! There must be a simple way to do this! Can someone provide me with the steps to create a Folder (or just target it if it already exists) based on the value a public property?
Thanks
Hugh
hughg
12-16-2009, 04:43 PM
Does nobody use MSI Factory? I'm trying to decide if this is a product that will do what I need, but I really need to know how to set a folder name to a property value to continue my evaluation? Sorry if this is a dumb question.
Is there a better place to ask this type of pre sales support question?
Thanks for any assistance in advance.
Hi hughg,
I'm slightly unclear about what you are doing. Would it be possible to post some more details about how are trying to accomplish the results you want?
e.g. The code you are using and your folder structure?
I was able to change the installation directory for my files using the following action in my LUA custom action:
MSI.SetTargetPath(_hInstall, "INSTALLDIR", "C:\\Temp\\");
I have the action scheduled to run during the InstallUISequence Before the WelcomeDlg relative action.
hughg
12-22-2009, 05:45 PM
I'm not trying to change the INSTALLDIR using the script. I have a collection of folders that contain data (templates and documents) that need to be installed in paths that are determined by checking a number of conditions in the registry to see what version of MS Word as well as existing folder and file tests. I am doing this in a lua script and setting a number of Public Properties with the full paths that I need to use as the target folders for these files.
What I was unclear about was how to use these Public Properties to set a Destination Folder. For example in my project I have created a Public Property [Word_PROG_PATH]. I assumed I could go to Project, Folders, Add and enter [Word_PROG_PATH] as the Folder Name and then use it's folder id as the Destination for files. This does not appear to work as it does not take the value of the property "D:\Program Files\Microsoft Office\OFFICE11\" it uses it as a literal [Word_PROG_PATH]. It would be useful in the help docs to have a cross ref under the Folder Properties page to an example of using the Set Folder custom action and why you need it to set a destination path that is not fixed when creating the project!
After trying the above I went back to adding a Custom Action of type 'Set Folder', to set the Folder name of a Folder ID I had created in Project, Folders to my Public Property. The trick here I found to get things to work both in the install and un-install is to make sure that the custom action timing is set to InstallExecuteSequence or things don't seem to work when doing a silent install.
It would be realy great if there were more examples of how to do this kind of thing for beginners.
Thanks
Hugh
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.