Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Забанен


Сообщения: 34
Благодарности: 0

Профиль | Цитировать


Может у кого-то было ,при прописке создания иконки в меню пуск, предлагает (Default),вместо имени при инсталляции.
Код: Выделить весь код
 Name: "{group}\{#MyAppDisplayName}";       Filename: "{app}\{#MyAppExeName}"; MinVersion: 0.0,5.0; Check: PuskIconCheck and InstallerCheck;
 Name: "{group}\Удалить {#MyAppDisplayName}";   Filename: "{uninstallexe}"; MinVersion: 0.0,5.0; Check: PuskIconCheck and InstallerCheck;
 Name: "{commondesktop}\{#MyAppDisplayName}"; Filename: "{app}\{#MyAppExeName}"; MinVersion: 0.0,5.0; Check: DesktopIconCheck and InstallerCheck;
В частности при попытке упаковать два .exe (стационарную и portable версии) в один инсталлятор.При инсталяции обычной версии пишет (Default) вместо имени.При распаковке портабл тоже предлагает сделать иконку в меню пуск с этим же именем (Default),хотя здесь он вообще не должен этого предлагать.Check работает нормально на установку файлов, а с иконками что-то не так...
Весь код:

Код: Выделить весь код
 #define MyAppName "Моя стационарная программа"
 #define MyAppNamePortable "Моя программа Portable"

 #define MyAppExeName "MyProg1.exe"
 #define MyAppDisplayName "MyProg1"

 #define MyAppDirName "Моя стационарная программа"
 #define MyAppConstantName "{pf}"

[Setup]
 AppName={#MyAppName}
 AppVerName=1.7
 DefaultDirName={code:GetInstallDir|{#MyAppConstantName}\{#MyAppDirName}}

 OutputDir=.

 Uninstallable=not PortableCheck

 DisableDirPage=no
 DisableWelcomePage=no

 UsePreviousAppDir=no

[Icons]
 Name: "{group}\{#MyAppDisplayName}";       Filename: "{app}\{#MyAppExeName}"; MinVersion: 0.0,5.0; Check: PuskIconCheck and InstallerCheck;
 Name: "{group}\Удалить {#MyAppDisplayName}";   Filename: "{uninstallexe}"; MinVersion: 0.0,5.0; Check: PuskIconCheck and InstallerCheck;
 Name: "{commondesktop}\{#MyAppDisplayName}"; Filename: "{app}\{#MyAppExeName}"; MinVersion: 0.0,5.0; Check: DesktopIconCheck and InstallerCheck;


[Files]
 Source: compiler:Examples\MyProg1.exe; DestDir: {app}; Check: InstallerCheck; Flags: ignoreversion;
 Source: compiler:Examples\MyProg2.exe; DestDir: {app}; Check: PortableCheck; Flags: ignoreversion;

[Code ]
var
  ComponentPage: TWizardPage;
  InstallerGroupBox: TNewGroupBox;
  Installer: TNewRadioButton;
  Portable: TNewRadioButton;
  IconGroupBox: TNewGroupBox;
  PuskIcon: TNewCheckBox;
  DesktopIcon: TNewCheckBox;
  PanelZadash: TNewCheckBox;


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;                                                    
//--------------------------------------------------------//
function GetInstallDir(S: String): String;                
 begin                                                    
  if CheckParam('/P') then                                
    Result:= ExpandConstant('{src}\{#MyAppNamePortable}') 
  else                                                    
    Result:= ExpandConstant(S);                          
 end;                                                    


function InstallerCheck: Boolean;                        
 begin                                                    
   Result := Installer.Checked or CheckParam('/I');       
 end;                                                     
//--------------------------------------------------------//
function PortableCheck: Boolean;                          
 begin                                                    
   Result := Portable.Checked or CheckParam('/P');        
 end;                                                     


function DesktopIconCheck: Boolean;                       
 begin                                                    
   Result:= DesktopIcon.Checked;                          
 end;                                                     
//--------------------------------------------------------//
function PuskIconCheck: Boolean;                          
 begin                                                    
   Result:= PuskIcon.Checked;                             
 end;                                                     
//--------------------------------------------------------//
function PanelZadashCheck: Boolean;                       
 begin                                                   
   Result:= PanelZadash.Checked;                          
 end;                                                    


procedure CompClick(Sender: TObject);                     
begin                                                     
 case TNewRadioButton(Sender) of                          
  Portable:                                              
 begin
//--------------------------------------------------------//
  DesktopIcon.Checked     := False;                       
  DesktopIcon.Enabled     := DesktopIcon.Checked;         
  PuskIcon.Checked        := False;                       
  PuskIcon.Enabled        := PuskIcon.Checked;            
  PanelZadash.Checked     := False;                       
  PanelZadash.Enabled     := PanelZadash.Checked;         
//--------------------------------------------------------//
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{src}')) + '{#MyAppNamePortable}';
  WizardForm.Caption      := FmtMessage(ExpandConstant('Распаковка — %1'), [ExpandConstant('Моя программа Portable')]);
 end;                                                     

  Installer:                                              
 begin                                                    
//--------------------------------------------------------//
  DesktopIcon.Checked     := True;                        
  DesktopIcon.Enabled     := DesktopIcon.Checked;         
  PuskIcon.Checked        := True;                        
  PuskIcon.Enabled        := PuskIcon.Checked;            
  PanelZadash.Checked     := False;                       
  PanelZadash.Enabled     := True;                        
//--------------------------------------------------------//
  WizardForm.DirEdit.Text := AddBackslash(ExpandConstant('{#MyAppConstantName}')) + '{#MyAppDirName}';
  WizardForm.Caption      := FmtMessage(SetupMessage(msgSetupWindowTitle), [ExpandConstant('{#SetupSetting("AppName")}')]);
  end;                                                    
 end;                                                     
end;                                                     


procedure InitializeWizard();
begin
  ComponentPage := CreateCustomPage(wpUserInfo, 'Выбор типа установки', '. . .');
  WizardForm.DirEdit.Text:= ExpandConstant('{code:GetInstallDir|{#MyAppConstantName}\{#MyAppDirName}}');

  InstallerGroupBox := TNewGroupBox.Create(WizardForm);
  with InstallerGroupBox do
  begin
    Parent := ComponentPage.Surface;
    Left := ScaleX(0);
    Top := ScaleY(10);
    Width := ScaleX(210);
    Height := ScaleY(60);
    Caption := 'Тип установки:';
  end;

  Portable := TNewRadioButton.Create(WizardForm);
  with Portable do
  begin
    Parent := InstallerGroupBox;
    Left := ScaleX(10);
    Top := ScaleY(35);
    Width := ScaleX(210);
    Height := ScaleY(17);
    Caption := 'Распаковка портативной версии';
    Checked    := CheckParam('/P');
    OnClick := @CompClick;
  end;

  IconGroupBox := TNewGroupBox.Create(WizardForm);
  with IconGroupBox do
  begin
    Parent := ComponentPage.Surface;
    Left := ScaleX(0);
    Top := ScaleY(80);
    Width := ScaleX(210);
    Height := ScaleY(80);
    Caption := 'Ярлыки программы:';
  end;

  PuskIcon := TNewCheckBox.Create(WizardForm);
  with PuskIcon do
  begin
    Parent := IconGroupBox;
    Left := ScaleX(10);
    Top := ScaleY(15);
    Width := ScaleX(210);
    Height := ScaleY(17);
    Caption := 'Ярлык(и) в меню «Пуск»';
    Checked := True;
    State := cbChecked;
  end;

  DesktopIcon := TNewCheckBox.Create(WizardForm);
  with DesktopIcon do
  begin
    Parent := IconGroupBox;
    Left := ScaleX(10);
    Top := ScaleY(35);
    Width := ScaleX(210);
    Height := ScaleY(17);
    Caption := 'Ярлык(и) на «Рабочем столе»';
    Checked := True;
    State := cbChecked;
  end;

  PanelZadash := TNewCheckBox.Create(WizardForm);
  with PanelZadash do
  begin
    Parent := IconGroupBox;
    Left := ScaleX(10);
    Top := ScaleY(55);
    Width := ScaleX(210);
    Height := ScaleY(17);
    Caption := 'Закрепить ярлык в «Панели задач»';
  end;

  Installer := TNewRadioButton.Create(WizardForm);
  with Installer do
  begin
    Parent := InstallerGroupBox;
    Left := ScaleX(10);
    Top := ScaleY(15);
    Width := ScaleX(210);
    Height := ScaleY(17);
    Caption := 'Установка стационарной версии';
    Checked := not CheckParam('/P');
    OnClick := @CompClick;
  end;
end;
Пробовал другой подобный код..тоже самое. С одним .exe нормально.
В чём может быть причина..

Последний раз редактировалось serg5, 19-07-2022 в 16:52.


Отправлено: 16:39, 19-07-2022 | #816