How to install files to "All Users" Folder - 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!

glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

How to install files to "All Users" Folder

Hello,

I am using the Advanced Installer Version 7.1.3 (Enterprise) to build a setup. This setup should create a folder and copy some files into this system defined Path "C:\Documents and Settings\All Users\Documents\".

My folder should be named as "GLM" and the files are "File1.bmp", "File2.bmp" ...

So at the end I want to have this path to the files: "C:\Documents and Settings\All Users\Documents\GLM\File[n].bmp"

I have set the Installation Type to "Per-machine only (fails if user is not administrator)" and the files are stored into the Folder "GLM" which I have placed into the "My Documents" folder on the "Files an Folders" page.

To prevent the ICE 38 Error I have created a dummy Entry in the registry ("HKEY_CURRENT_USER/Software/[Manufacturer]/[ProductName]/DummyFolder") and moved this resource to the folder component. This registry resource is set as the key member of the folder component.

But I still get the ICE 91 warning. If I ignore this warning, the files are installed into the Admin folder and not into the "All Users" folder. If I run this setup as normal user the UAC asks me for the Admin password. After this the files are stored into the "normal user" documents folder. I have tested this with Windows7.

Now my question: Where is my error? How can I install Files into the "shared documents" folder (All Users\Documents).

Creating this folder manually is difficult, because the Setup should run on different languages and differen OS (WinXP/Vista/Windows 7).

Kind regards,
Christof Konstantinopoulos
glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

Re: How to install files to "All Users" Folder

I know that the folders are different in Vista and Windows7:
Under these OS the Path should be "C:\Users\Public\Documents"

Kind regards,
Christof Konstantinopoulos
Germany
glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

Re: How to install files to "All Users" Folder

Sorry, I didn't found this Entry before : http://www.advancedinstaller.com/forums ... 20&start=0

But I think this function should be included into the Advanced Installer. Just insert a folder "public documents" into the "Files and Folders" page and handle this scripts internally.

Kind regards,
Christof Konstantinopoulos
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to install files to "All Users" Folder

Hello,

Thank you for your suggestion. We have added this on our TODO list and will be available in a future version of Advanced Installer.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

Re: How to install files to "All Users" Folder

A few minutes ago I have found the predefined Custom Action "Resolve Known Folder". It will only work on Vista and above. Unfortunately my setup should work on XP and above. So I had to implement two different cases.

I am not very good in working with custom Actions.

How can I manage this (see first posting, too) ?


Kind regards,
Christof
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to install files to "All Users" Folder

Hello,

The %ALLUSERSPROFILE% environment variable contains the path to the "All users" folder. This variable works both on Windows XP and Vista. Use the "Property Set With Formatted" custom action to assign the contents of ALLUSERSPROFILE to the property you are using with your Property Based Folder.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

Re: How to install files to "All Users" Folder

Thank you for your answer,

but it didn't solve my problem completely. On an english operating system it will work. A test with Windows 7 was sucessful! Only an ICE 48 warning is shown ("Directory 'ALL_USERS_DOC' appears to be hardcoded in the property table to a local drive.").

As I mentioned above the path should have the following structure:
"C:\Documents and Settings\All Users\Documents\GLM\File[n].bmp"

To create this I have defined a custom Action of type "Set Property with Formatted". As formatted text I use the string
"[%ALLUSERSPROFILE]\Documents"

But our Setup should run in different countries and on Windows XP I need to translate the Part "Documents". In german the folder is called "Dokumente".

So I think I have to use a different way.


Kind regards,
Christof Konstantinopoulos
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: How to install files to "All Users" Folder

Hi,

Here is what you can try:
-- in the Property Set with Formatted custom action set the field "Formatted Text" to :

Code: Select all

 [%ALLUSERSPROFILE]\[DOCUMENTS] 
-- where [DOCUMENTS] is a property you define in the Install Parameters
-- after defining the property you can localize it like this:
--- right click in the Value field of the Edit Property dialog -> Localize
--- in the Localization dialog select the "Always translate this string" and "Use specified localization identifier"radio buttons
--- please note that these setting can be done only if you selected multiple languages in the Translations page
--- now you will go to Translations page and create a new dictionary using the [Create] button and following the Wizard
--- now edit the new generated dictionary file (.ail) using a text editor and set the value of the identifier of your property from Install Parameters page coresponding to the language

Here is a tutorial that may help you.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

Re: How to install files to "All Users" Folder

Many Thanks to all for the answers, I have found a solution! :D

It works with XP, Vista (not tested) and Windows 7 and doesn't need any translations. Manual translations are bad, because I don't know how the "Documents" folder is called in different countries. I take the Idea of posting http://www.advancedinstaller.com/forums ... t=0#p23259. But my solution do not need any external VB Script.

Here a short description:
  • Create a Property under "Install Parameters" with a dummy value. It is Important to use an existing folder as dummy value. If not, you get an error during install. I called this Property "ALL_DOC_FOLDER" and set the dummy value to "C:\".
  • Create a new search. Call it "PUBLIC_DOCUMENTS" and add the location "registry"
  • Set the Registry Location Properties of this new search item to:
    • Root = HKEY_LOCAL_MACHINE
    • Key = SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
    • Name = Common Documents
    • Type = 'The value contains a path to a directory'
  • Create a "new property based folder" on the 'Files an Folders' page. Select the property "ALL_DOC_FOLDER" from the property picker dialog.
    I have named this folder "PUBLIC_DOC".
  • On the Custom Actions Page create a New Custom Action "Property Set with Formatted" and place it under "InstallExecuteSequence / Begin".
  • Set the General Properties of this custom action to:
    • Property Name = ALL_DOC_FOLDER
      Formatted Text = [PUBLIC_DOCUMENTS]
Now all files in the folder "PUBLIC_DOC" are installed into the <ALL USER>/Documents folder of windows. It works with Windows XP and Windows 7. I have not tested Vista, but I think it should work, too.

But one disadvantage still remains. The validation tool will create the warning ICE48 "Directory 'ALL_DOC_FOLDER' appears to be hardcoded in the property table to a local drive". In fact this is true. So you should ignore this warning, because the validation tool could not know, that the used Registry Key" is localized automaticly by Windows.

I hope this information is helpful for you.

Kind regards,

Christof Konstantinopoulos,
Germany
wyzerd
Posts: 75
Joined: Tue Mar 27, 2007 3:54 am
Location: St. Louis, MO
Contact: Website

Re: How to install files to "All Users" Folder

Very elegant solution for a problem that really shouldn't exist if Microsoft had done their job.

kudos!
glmdev
Posts: 14
Joined: Thu Aug 06, 2009 4:07 am
Location: Witten, Germany

Re: How to install files to "All Users" Folder

I have tested this today in a MergeModule. It works fine!

Kind regards,
Christof Konstantinopoulos

Return to “Common Problems”