Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8058121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:15:09+00:00 2026-06-05T09:15:09+00:00

I want to install files in different folders, depending on whether the user has

  • 0

I want to install files in different folders, depending on whether the user has selected to install for all users or just the current user.

I have added used CreateInputOptionPage() to create an option page with two radio buttons.

However, my installer is now littered with lots of duplicate lines, like these two:

Source: {#ProjectRootFolder}\License.txt; DestDir: {userdocs}\{#MyAppName}; Check: NOT IsAllUsers
Source: {#ProjectRootFolder}\License.txt; DestDir: {commondocs}\{#MyAppName}; Check:IsAllUsers

Is there a more elegant way to do the above? Can Pascal code, for example, create a variable like #define does so I can use it in place of {userdocs} and {commondocs} above?

Further details:

The IsAllUsers() function above calls this code:

function IsAllUsers: Boolean;
begin
#ifdef UPDATE
  Result := AllUsersInRegistryIsTRUE;
#else
  Result := AllUsersOrCurrentUserPage.Values[1]; // wizard page second radio button
#endif
end; 

and:

function AllUsersInRegistryIsTRUE: Boolean;  // True if preceding install was to all users' documents 
var
  AllUsersRegValue: AnsiString;
begin
  if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\MyApp', 'AllUsers', AllUsersRegValue) then
    Result := (UpperCase(AllUsersRegValue) = 'YES')
  else
    Result := FALSE;
end; 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:15:12+00:00Added an answer on June 5, 2026 at 9:15 am

    Will something like this suit?

    [Files]
    Source: {#ProjectRootFolder}\License.txt; DestDir: {code:GetDir}\{#MyAppName};
    
    ...
    
    [Code]
    var
      OptionsPage: TInputOptionWizardPage;
    
    procedure InitializeWizard;
    begin
      OptionsPage := CreateInputOptionPage(wpUserInfo, 
                  'please select', 'the kind of installation', 'and continue..', 
                  True, False);
      OptionsPage.Add('All users');
      OptionsPage.Values[0] := True;
      OptionsPage.Add('This user');
    end;
    
    function GetDir(Dummy: string): string;
    begin
      if OptionsPage.Values[0] then
        Result := ExpandConstant('{commondocs}')
      else
        Result := ExpandConstant('{userdocs}');
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple config files (for different environments). During install user get to select
Should I wrap all the files I want to install in individual components? What
I have a Visual Basic 6.0 application that I want to install for All
I have a vendor supplied MSI file, and we want to automate the install
I want install Android version 1.6 SDK. I already have Android development setup with
I want to install Rad Studio 2010 on a machine that already has installed
I want to install MSI package under user level and set several registry keys
I have some .py files I wrote that I want to run on a
So I have a php application with lots of different files, the code is
Is there any way to override admin templates with different files depending on Django

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.