Вопрос Текст на страницах

Socolino

Новичок
Код:
[Setup]
AppVersion=1.5
AppName=My Prog
DefaultDirName=.\My Prog
OutputDir=.
Uninstallable=false
CreateUninstallRegKey=false
SetupStyleFile="compiler:.\Styles\Carbon.vsf"
DisableWelcomePage=false
//RawDataResource=Resredist>compiler:Resource\redist.txt, Resmiles>compiler:Resource\miles.txt

// тут путь к idp.iss
#include "C:\Users\ADMIN\Documents\My ISO Files\idpsetup-1.5.1\{app}\idp.iss"


[Messages]
ButtonNext=Accept
ButtonCancel=Bay
ButtonBack=Prev
ButtonInstall=Go
ButtonFinish=Chao

[Files]
Source: compiler:Resource\redist.txt; Flags: ignoreversion dontcopy noencryption
Source: compiler:Resource\miles.txt; Flags: ignoreversion dontcopy noencryption


[Run]
Filename: "{app}\license.txt"; Description: "Перейти на сайт"; Flags: postinstall shellexec unchecked
Filename: "{app}\license.txt"; Description: "Запустить обновление"; Flags: postinstall shellexec unchecked
Filename: "{app}\license.txt"; Description: "Войти на сервер с модом"; Flags: postinstall shellexec unchecked
Filename: "{app}\license.txt"; Description: "Войти на сервер без модом"; Flags: postinstall shellexec unchecked

[Code]
#define AW = (Defined UNICODE) ? "W" : "A"
#include "copymoveEx.iss"
//const
//  RT_RCDATA = 10;

var
  i: Integer;
  FinishedHeadingLabel: TLabel;
  redist, miles: TArrayOfString;

procedure CheckMod(Sender: TObject);
begin
  case WizardForm.RunList.ItemIndex of
    2: WizardForm.RunList.Checked[3] := False;
    3: WizardForm.RunList.Checked[2] := False;
    4: WizardForm.RunList.ItemIndex
  end;
end;
// тут нужно чет дорабатывать
function FormatFloat(Value: LongInt): string;
var
mr, dr: longint;
begin
dr:=value mod (1024*1024)
mr:=Trunc(value/(1024*1024))
result:=IntToStr(mr)+'.'+Copy(IntToStr(dr),0,3) + ' Mb';
end;

procedure restructuring();
begin
    //WizardForm.Width:=800
    //WizardForm.Height:=640
    WizardForm.WizardSmallBitmapImage.Hide;
    WizardForm.WizardBitmapImage.Hide;
    WizardForm.WizardBitmapImage2.Hide;
    WizardForm.DiskSpaceLabel.Caption:='Required:' +'  '+ FormatFloat(16672358);
    WizardForm.DirEdit.AutoSelect:=False
    WizardForm.WelcomeLabel1.Left:=ScaleX(100)
    WizardForm.WelcomeLabel2.Left:=ScaleX(100)
    WizardForm.FinishedHeadingLabel.Hide;
    WizardForm.FinishedLabel.Left :=ScaleX(130)
    WizardForm.RunList.Left:=ScaleX(150)
 

    FinishedHeadingLabel:= TLabel.Create(WizardForm);
     FinishedHeadingLabel.AutoSize:= False;
     with WizardForm.FinishedHeadingLabel do
     FinishedHeadingLabel.SetBounds(WizardForm.FinishedHeadingLabel.Left-ScaleX(50), WizardForm.FinishedHeadingLabel.Top, WizardForm.FinishedHeadingLabel.Width, WizardForm.FinishedHeadingLabel.Height);
     FinishedHeadingLabel.Font:= WizardForm.FinishedHeadingLabel.Font
     FinishedHeadingLabel.Font.Color:= clGreen;
     FinishedHeadingLabel.Transparent:= True;
     FinishedHeadingLabel.WordWrap:= true;
     FinishedHeadingLabel.Caption:= WizardForm.FinishedHeadingLabel.Caption;
     FinishedHeadingLabel.Parent:= WizardForm.FinishedPage
     FinishedHeadingLabel.Caption:= WizardForm.FinishedHeadingLabel.Caption
end;

procedure downloadfiles(const url, filename: string);
begin
  idpAddFile(url + filename, ExpandConstant('{tmp}\') + filename);
end;

procedure InitializeWizard();
var
i:integer;
begin
    restructuring;

    ExtractTemporaryFile('redist.txt')
    ExtractTemporaryFile('miles.txt')

    LoadStringsFromFile(ExpandConstant('{tmp}\redist.txt'), redist);
    DeleteFile(ExpandConstant('{tmp}\redist.txt'));

    LoadStringsFromFile(ExpandConstant('{tmp}\miles.txt'), miles);
    DeleteFile(ExpandConstant('{tmp}\miles.txt'));

     (* тут сервер то доступен то нет
    for i := 0 to Length(redist)-1 do
    downloadfiles('http://188.120.240.106:8080/188_120_240_106_28960/Redist/',redist[i]);
         *)

    for i := 0 to Length(miles)-1 do
    downloadfiles('http://188.120.240.106:8080/188_120_240_106_28960/miles/',miles[i]);


    //MsgBox('Size файлov: ' + FormatFloat(16672358), mbInformation, MB_OK);

    WizardForm.RunList.OnClick := @CheckMod;
    idpSetOption('DetailedMode',   '1');
    idpSetOption('DetailsButton',  '0');
    idpDownloadAfter(wpPreparing);
end;


procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
    CreateBackup(ExpandConstant('{tmp}'), ExpandConstant('{app}\mods'), 'move:*.flt');
    //CreateBackup(ExpandConstant('{tmp}'), ExpandConstant('{app}'), 'move:*.exe');
end;
ну и доделывай по тихоньку.
Благодарен! Постараюсь, делов много с этим. :morning:
 

Socolino

Новичок
Как запретить растягивать установщик до определённого размера?
12345.PNG
 

Socolino

Новичок
Ребята подскажет кто-нибудь, как запретить запускать один установщик дважды ?
Это будет полезно для того, чтобы нагрузки на сервер не было.
 

ZVSRus

Участник
Socolino. Ребята подскажет кто-нибудь, как запретить запускать один установщик дважды ?
 

Andreo Fadio

Ветеран
Ребята подскажет кто-нибудь, как запретить запускать один установщик дважды ?
в справке inno setup в разделе "Setup" почитать про параметр AppMutex и сделать что требуется в процедуре InitializeWizard() прописав 1 строчку на создание
 

Crachlow

Старожил
может кому пригодится
Код:
const
oneGb=(1024*1024*1024);
oneMb=(1024*1024);
oneKb=1024;

#ifdef IS_ENHANCED
function FormatSize(Value: Extended): string;
var
  GB, MB, KB: Extended;
  FormattedSize: string;
begin
  if (Value >= oneGb) then
  begin
    GB := Value / oneGb;
    FormattedSize := FormatFloat('#.###', GB) + ' GB';
  end
  else if (Value >= oneMb) then
  begin
    MB := Value / oneMb;
    FormattedSize := FormatFloat('#.###', MB) + ' MB';
  end
  else
  begin
    KB := Value / oneKb;
    FormattedSize := FormatFloat('#.###', KB) + ' KB';
  end;
  Result := FormattedSize;
end;
#endif

#if !defined IS_ENHANCED
// +- точность
function FormatSize(Value: Extended): string;
var
  IntPart: LongInt;
  FracPart: Extended;
  FracPartStr, GMKb: String;
begin
  if Value >= oneGb then
  begin
    IntPart := Trunc(Value / oneGb);
    FracPart := (Value - (IntPart * oneGb)) / oneGb;
    GMKb := ' GB';
  end
  else if Value >= oneMb then
  begin
    IntPart := Trunc(Value / oneMb);
    FracPart := (Value - (IntPart * oneMb)) / oneMb;
    GMKb := ' MB';
  end
  else
  begin
    IntPart := Trunc(Value / oneKb);
    FracPart := Value - (IntPart * oneKb)/oneKb;
    GMKb := ' KB';
  end;
  FracPartStr := IntToStr(Round(FracPart * oneKb));
  while Length(FracPartStr) < 3 do
    FracPartStr := '0' + FracPartStr;

  if Length(FracPartStr) > 3 then
    FracPartStr := Copy(FracPartStr, 1, 3);
  Result := IntToStr(IntPart) + ',' + FracPartStr + GMKb;
end;
 #endif
 ...............
 WizardForm.DiskSpaceLabel.Caption:='Required:' +'  '+ FormatSize(595253527);
 

Socolino

Новичок
Подскажите. Как изменить функции для кнопок, например: Вместо кнопки далее, запустить определенный файл exe ?
 

Yaroslav950

Участник
@Socolino,вам никто не отвечает, потому что писать одно и тоже на форуме никто не будет. Вы в поисковике найдете все, есть не которые моменты, допустим человек, хотел на каждой странице сделать разные картинки это другое, или как я задавал вопрос с таймером.

Код:
var
  CustomButton: TButton;

procedure CustomButtonClick(Sender: TObject);
var
  ResultCode: Integer;
begin
  if not Exec(ExpandConstant('{tmp}\YourExecutableFile.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
  begin
    MsgBox('Ошибка запуска программы!', mbError, MB_OK);
  end;
end;

procedure InitializeWizard;
begin
  CustomButton := TButton.Create(WizardForm);
  CustomButton.Parent := WizardForm;
  CustomButton.Caption := 'Запустить программу';
  CustomButton.Left := 200;
  CustomButton.Top := 220;
  CustomButton.Width := 120;
  CustomButton.OnClick := @CustomButtonClick; // Обработчик события нажатия кнопки
end;

[/SPOILER]
 
Сверху