Вопрос Изменение пути в зависимости от компонента

Xabib2302

Новичок
Доброе время суток. В моем репаке AIDA64 присутствуют 4 редакции т.е 4 программы и дело в том, что если использовать параметр установки
Код:
[Setup]
AppendDefaultDirName=yes
и этот код для изменение пути установки в зависимости от выбранного компонента
Код:
procedure CurPageChanged(CurPageID: Integer); 
begin 
  case CurPageID of 
    wpSelectComponents: 
    begin 
if IsComponentSelected('AIDA64\I\1') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA641}' 
    WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA641}' 
  end else 
  if IsComponentSelected('AIDA64\I\3') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA642}' 
    WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA642}' 
  end else 
  if IsComponentSelected('AIDA64\I\2') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA643}' 
    WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA643}' 
    end else 
      if IsComponentSelected('AIDA64\I\4') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA644}' 
    WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA644}' 
    end else 
      if IsComponentSelected('AIDA64\P\1') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA641} Portable' 
  end else 
  if IsComponentSelected('AIDA64\P\3') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA642} Portable' 
  end else 
  if IsComponentSelected('AIDA64\P\2') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA643} Portable' 
  end else 
    if IsComponentSelected('AIDA64\P\4') then 
  begin 
    WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA644} Portable' 
      end; 
    end; 
  end; 
end;
работать не будет если изменить путь установки через кнопку обзор

было так


а после выбора другого каталога стало так


http://rghost.ru/57153259
 

sergey3695

Ветеран
Модератор
Xabib2302, скрипт выкладывать не буду. вот на этот кусок замени часть скрипта
Код:
function CheckParam(s: string): boolean;
var
  i: integer;
begin
for i := 0 to ParamCount do begin
  Result := ParamStr(i) = s;
if Result then Break;
end;
end;

//... 
  if IsComponentSelected('AIDA64\I\1') then
  begin
  if CheckParam('/SILENT')  or  CheckParam('/VERYSILENT') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(WizardForm.DirEdit.Text) + '{#AIDA641}';
  WizardForm.GroupEdit.Text := AddBackslash(WizardForm.GroupEdit.Text) + '{#AIDA641}';
  end else begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA641}';
  WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA641}';
  end;
  end;
  if IsComponentSelected('AIDA64\I\3') then
  begin
  if CheckParam('/SILENT')  or  CheckParam('/VERYSILENT') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(WizardForm.DirEdit.Text) + '{#AIDA642}';
  WizardForm.GroupEdit.Text := AddBackslash(WizardForm.GroupEdit.Text) + '{#AIDA642}';
  end else begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA642}';
  WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA642}';
  end;
  end;
  if IsComponentSelected('AIDA64\I\2') then
  begin
  if CheckParam('/SILENT')  or  CheckParam('/VERYSILENT') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(WizardForm.DirEdit.Text) + '{#AIDA643}';
  WizardForm.GroupEdit.Text := AddBackslash(WizardForm.GroupEdit.Text) + '{#AIDA643}';
  end else begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA643}';
  WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA643}';
  end;
  end;
  if IsComponentSelected('AIDA64\I\4') then
  begin
  if CheckParam('/SILENT')  or  CheckParam('/VERYSILENT') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(WizardForm.DirEdit.Text) + '{#AIDA644}';
  WizardForm.GroupEdit.Text := AddBackslash(WizardForm.GroupEdit.Text) + '{#AIDA644}';
  end else begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultDirName")}')) + '{#AIDA644}';
  WizardForm.GroupEdit.Text := AddBackslash(ExpandConstant('{#SetupSetting("DefaultGroupName")}')) + '{#AIDA644}';
  end;
  end;
  if IsComponentSelected('AIDA64\P\1') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA641} Portable';
  end;
  if IsComponentSelected('AIDA64\P\3') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA642} Portable';
  end;
  if IsComponentSelected('AIDA64\P\2') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA643} Portable';
  end;
  if IsComponentSelected('AIDA64\P\4') then
  begin
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#AIDA644} Portable';
  end;
  if IsComponentSelected('AIDA64\P') then
  begin
  WizardForm.NextButton.Caption:= SetupMessage(msgButtonInstall);
  end;
 
Последнее редактирование:
Сверху