How to dynamically set users directory path

Request new features that you would like to see in the next version of Advanced Installer.

How to dynamically set users directory path

Postby javaquests » Mon Dec 13, 2010 3:37 pm

Hi,

I need to point my installation to users directory path. How do i dynamically set the users directory in install paramter property?
javaquests
 
Posts: 13
Joined: Tue Dec 07, 2010 2:50 pm

Re: How to dynamically set users directory path

Postby Cosmin » Mon Dec 13, 2010 4:52 pm

Hi,

Please note that the "Application Folder" combo in "Install Parameters" page contains multiple values. You can try selecting another one which better suits your needs. If none of the predefined values help you, you can define a custom path. If you don't know what path to set, can you please give me more details about the path you want to use?

Regards,
Cosmin
Cosmin Pirvu
Advanced Installer Team
http://www.advancedinstaller.com/
Cosmin
 
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm

Re: How to dynamically set users directory path

Postby javaquests » Mon Dec 13, 2010 4:58 pm

I need to point my installation directly under users directory. for eg: a user named "abc" installs the program, I want the installation path to point to "C:\Users\abc\" directory. I could not find one in application directory of this type. please let me know how to write custom parameter to dynamically know the users directory and point to that location.
javaquests
 
Posts: 13
Joined: Tue Dec 07, 2010 2:50 pm

Re: How to dynamically set users directory path

Postby Cosmin » Mon Dec 13, 2010 5:11 pm

Hi,

Unfortunately Windows Installer doesn't support this path directly. However, you can try this approach:
- set your default installation folder to:
Code: Select all
[DesktopFolder]
- in Custom Actions page create a custom action which trims the "Desktop" string from APPDIR property value
- after being trimmed the value should be something like this:
Code: Select all
C:\Users\<username>
- set this value back in APPDIR property
- schedule this custom action under "InstallUISequence" -> "Begin"
- share it with "InstallExecuteSequence" -> "Begin" by dragging it while SHIFT key is pressed
- make sure it uses the "Execute only once if present in both sequence tables" option in Custom Action Properties pane

This way the installation path starts with the Desktop path, but it's modified by your custom action to the user account root folder. To access installer properties you can use MsiGetProperty() and MsiSetProperty() in Win32 DLLs or Session.Property() in VBScript.

Regards,
Cosmin
Cosmin Pirvu
Advanced Installer Team
http://www.advancedinstaller.com/
Cosmin
 
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm

Re: How to dynamically set users directory path

Postby javaquests » Mon Dec 13, 2010 5:38 pm

I changed the app directory path to DesktopFolder. when i click on custom action from tool bar it opens a window to choose the custom action type. in my case which one should be selecting? Can be more more specific on how to create custom action to trim desktop?
javaquests
 
Posts: 13
Joined: Tue Dec 07, 2010 2:50 pm

Re: How to dynamically set users directory path

Postby Cosmin » Tue Dec 14, 2010 8:28 am

Hi,

First you need to create a C++ DLL or a VBScript which gets the APPDIR property value, modifies it and sets it back in APPDIR. For a sample C++ DLL custom action please read the Serial Number Validation DLL article. After creating the custom action file, you can add it as a "New Attached Custom Action" in "Custom Actions" page.

I'm afraid that we don't have sample code which trims a folder path.

Regards,
Cosmin
Cosmin Pirvu
Advanced Installer Team
http://www.advancedinstaller.com/
Cosmin
 
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm

Re: How to dynamically set users directory path

Postby javaquests » Wed Dec 15, 2010 11:55 am

Thank you so much, i tried setting the custom actions and also doing other settings and is now getting the installation path of my choice.
javaquests
 
Posts: 13
Joined: Tue Dec 07, 2010 2:50 pm


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 2 guests