PDA

View Full Version : All Users\Documents



ajumple
05-14-2009, 12:32 PM
I'm probably missing the obvious...
I'd like to setup some directories in the All User\Documents folders so that anyone using the software has access to certain files...is there an easy way to do this with the installer or do I need to write a script to do it? I know about the "PersonalFolder" but that only works for the user doing the install...

Thanks.

Ulrich
05-14-2009, 08:37 PM
Hello,

the "common documents" folder is normally not available to MSI installers, and it doesn't appear on the list of system folders: http://msdn.microsoft.com/en-us/library/aa372057.aspx

This might not be the most elegant way, but it works.

1) Under Project > Folders, add a new folder. For example, click the SourceDir, and press the Ins key to insert a new folder with Folder name "CommonDocuments" and Folder ID set to "Folder_0001".

2) In the list of files of your project, set the destination to "CommonDocuments" for those files that are to be deployed in this folder.

3) Using a text editor like Notepad, TextPad, etc. create a file with these two lines (modify to fit your needs):

targetroot = Shell.GetFolder(SHF_COMMON_DOCUMENTS);
MSI.SetTargetPath(_hInstall, "Folder_0001", targetroot .. "\\MyFolder\\");

4) Save the file as SetCommonDocuments.lua.

5) You may edit the text "MyFolder" to your company's or product's name. This will be the name of the subfolder. In this example, on Vista, it would result in a folder named "C:\Users\Public Documents\MyFolder", on XP it would be something like "C:\Documents and Settings\All Users\Documents\MyFolder".

6) Now open System Editors > Custom Action, and Add the option "Run LuaScript".

7) Under Settings, browse to the SetCommonDocuments.lua file you created earlier.

8) Under Attributes, go to Timing, and click Add. Set InstallExecuteSequence, "After" and relative action "CostFinalize". Click OK.

9) Build your installer and run it.

I hope this helps.

Ulrich

ajumple
06-12-2009, 07:42 AM
Hi,

Thanks for the details on how to do this! I've been working hard on finalizing my software and finally got back to the installer so I could test this out and it works exactly like I was looking for.

Thanks again,

-AJ