Ветеран
Сообщения: 649
Благодарности: 444
|
Профиль
|
Отправить PM
| Цитировать
SatHan,
сделал(ответ на твой вопрос - секция Files, не более) и позволил себе размахнуться(вся секция кода - расширение возможностей (опционально)) ещё дальше 
(надеюсь не зря!)
пример 1:
читать дальше »
Код: 
[Setup]
AppName=Reg_Path_Demo
AppVerName=Reg_Path_Demo
DefaultDirName={pf}\Reg_Path_Demo
// для теста
appid=Application1
//appid=Application2
[Files]
/// первый пример (для наглядности)
/////////////////// путь:........................................через ключ реестра(корневой каталог установленной программы)\Section1 (в эту папку в корневом каталоге) - это путь только через реестр
Source: "File\1\*"; DestDir: "{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application1_is1,InstallLocation}\Section1"; Flags: ignoreversion recursesubdirs createallsubdirs
/// второй пример (как ты хотел)
/////////////////// путь:.......................................через ключ реестра(корневой каталог установленной программы)|(если ключа нет в {app})\Section2 (в эту папку в корневом каталоге) - это путь через реестр и в {app}(в {app} если нет ключа)
Source: "File\2\*"; DestDir: "{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application2_is1,InstallLocation|{app}}\Section2"; Flags: ignoreversion recursesubdirs createallsubdirs
[ code]
function Key_Exist: Integer;
var
Key_1_Exist, Key_2_Exist: boolean;
begin
Key_1_Exist := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application1_is1');
Key_2_Exist := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application2_is1');
if Key_1_Exist and Key_2_Exist then Result := 3 else
if Key_1_Exist then Result := 1 else
if Key_2_Exist then Result := 2 else
Result := 0;
end;
procedure Create_Labels(Param: Integer);
begin
if Param <> 0 then
begin
with WizardForm do
begin
with TLabel.Create(nil) do
begin
Parent := SelectDirPage;
case Param of
1:
begin
SelectDirBrowseLabel.Caption := 'Путь установки 2:';
DirEdit.Top := DirEdit.Top + ScaleY(30);
DirBrowseButton.Top := DirEdit.Top - ScaleY(1);
Caption := 'Путь установки 1: ' + RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application1_is1,InstallLocation}'));
SetBounds(DirEdit.Left, DirEdit.Top - ScaleX(60), DirEdit.Width, ScaleY(90));
end;
2:
begin
SelectDirBrowseLabel.Caption := 'Путь установки 1:';
Caption := 'Путь установки 2: ' + RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application2_is1,InstallLocation}'));
SetBounds( DirEdit.Left, DirEdit.Top + ScaleX(60), DirEdit.Width, ScaleY(90));
end;
3:
begin
Caption := 'Путь установки 1: ' + RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application1_is1,InstallLocation}')) + #13#10 + #13#10 + #13#10 + #13#10 +
'Путь установки 2: ' + RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application2_is1,InstallLocation}'));
SetBounds( DirEdit.Left, DirEdit.Top, DirEdit.Width, ScaleY(90));
end;
end;
end;
SelectDirBrowseLabel.Height := ScaleY(16);
SelectDirBrowseLabel.Top := DirEdit.Top - SelectDirBrowseLabel.Height;
end;
end;
end;
procedure InitializeWizard();
var
a: Integer;
begin
a := Key_Exist;
with WizardForm do
begin
DirEdit.Visible := a <> 3;
if not DirEdit.Visible then
begin
DirBrowseButton.Visible := DirEdit.Visible;
SelectDirBrowseLabel.Visible := DirEdit.Visible;
end;
end;
Create_Labels(a);
end;
обрати внимание на это символ |
пример 2(сделал как для себя бы хотел). Рекомендую:
читать дальше »
Код: 
#define Section_1 "Section1"
#define Section_2 "Section2"
[Setup]
AppName=Reg_Path_Demo
AppVerName=Reg_Path_Demo
DefaultDirName={pf}\Reg_Path_Demo
// для теста
appid=Application1
//appid=Application2
[Files]
Source: "File\1\*"; DestDir: "{code:Get_Path_0}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "File\2\*"; DestDir: "{code:Get_Path_1}"; Flags: ignoreversion recursesubdirs createallsubdirs
[ code]
var
Page: TInputDirWizardPage;
function Get_Path_0(Param: String): String;
begin
Result := Page.Values[0];
end;
function Get_Path_1(Param: String): String;
begin
Result := Page.Values[1];
end;
function Key_Exist: Integer;
var
Key_1_Exist, Key_2_Exist: boolean;
begin
Key_1_Exist := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application1_is1');
Key_2_Exist := RegKeyExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application2_is1');
if Key_1_Exist and Key_2_Exist then Result := 3 else
if Key_1_Exist then Result := 1 else
if Key_2_Exist then Result := 2 else
Result := 0;
end;
procedure InitializeWizard();
begin
Page:=CreateInputDirPage(wpWelcome,'копирование файлов', 'Укажите каталоги','',False,'NewFolder');
with Page do
begin
Add('путь 1:');
Add('путь 2:');
case Key_Exist of
1:
begin
Values[0] := RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application1_is1,InstallLocation}')) + '\{#Section_1}';
Values[1] := 'C:\{#Section_2}';
end;
2:
begin
Values[0] := 'C:\{#Section_1}';
Values[1] := RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application2_is1,InstallLocation}')) + '\{#Section_2}'; //
end;
3:
begin
Values[0] := RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application1_is1,InstallLocation}')) + '\{#Section_1}';
Values[1] := RemoveBackslash(ExpandConstant('{reg:HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Application2_is1,InstallLocation}')) + '\{#Section_2}'; //
end;
0:
begin
Values[0] := 'C:\{#Section_1}';
Values[1] := 'C:\{#Section_1}';
end;
end;
end;
end;
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
Result := 'путь 1:' + NewLine + Space + Page.Values[0] + NewLine + NewLine + 'путь 2:' + NewLine + Space + Page.Values[1];
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := PageID = wpSelectDir;
end;
MogilShik2007,
по ошибке трудно(для меня даже невозможно) определить косяк
покажи лучше код с файлами
может смогу исправить!
|
Последний раз редактировалось Johny777, 10-09-2012 в 13:57.
Отправлено: 23:47, 09-09-2012
| #870
|