Вопрос How mix the scripts?

nizcoz

Участник
Hi! i wish add a percentage, time elapse, etc to my script (progress bar). And mix this script with my script:
Код:
[Code]
function GetTickCount: DWORD;
  external 'GetTickCount@kernel32.dll stdcall';

var
  StartTick: DWORD;
  PercentLabel: TNewStaticText;
  ElapsedLabel: TNewStaticText;
  RemainingLabel: TNewStaticText;

function TicksToStr(Value: DWORD): string;
var
  I: DWORD;
  Hours, Minutes, Seconds: Integer;
begin
  I := Value div 1000;
  Seconds := I mod 60;
  I := I div 60;
  Minutes := I mod 60;
  I := I div 60;
  Hours := I mod 24;
  Result := Format('%.2d:%.2d:%.2d', [Hours, Minutes, Seconds]);
end;

procedure InitializeWizard;
begin
  PercentLabel := TNewStaticText.Create(WizardForm);
  PercentLabel.Parent := WizardForm.ProgressGauge.Parent;
  PercentLabel.Left := 0;
  PercentLabel.Top := WizardForm.ProgressGauge.Top +
  WizardForm.ProgressGauge.Height + 12;

  ElapsedLabel := TNewStaticText.Create(WizardForm);
  ElapsedLabel.Parent := WizardForm.ProgressGauge.Parent;
  ElapsedLabel.Left := 0;
  ElapsedLabel.Top := PercentLabel.Top + PercentLabel.Height + 4;

  RemainingLabel := TNewStaticText.Create(WizardForm);
  RemainingLabel.Parent := WizardForm.ProgressGauge.Parent;
  RemainingLabel.Left := 0;
  RemainingLabel.Top := ElapsedLabel.Top + ElapsedLabel.Height + 4;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpInstalling then
  StartTick := GetTickCount;
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
  if CurPageID = wpInstalling then
  begin
  Cancel := False;
  if ExitSetupMsgBox then
  begin
  Cancel := True;
  Confirm := False;
  PercentLabel.Visible := False;
  ElapsedLabel.Visible := False;
  RemainingLabel.Visible := False;
  end;
  end;
end;

procedure CurInstallProgressChanged(CurProgress, MaxProgress: Integer);
var
  CurTick: DWORD;
begin
  CurTick := GetTickCount;
  PercentLabel.Caption :=
  Format('Done: %.2f %%', [(CurProgress * 100.0) / MaxProgress]);
  ElapsedLabel.Caption :=
  Format('Elapsed: %s', [TicksToStr(CurTick - StartTick)]);
  if CurProgress > 0 then
  begin
  RemainingLabel.Caption :=
  Format('Remaining: %s', [TicksToStr(
  ((CurTick - StartTick) / CurProgress) * (MaxProgress - CurProgress))]);
  end;
end;
But this code interfere with my script, not show the TotalSpaceLabel, FreeSpaceLabel and InstallSpacelabel.

This is the script to add TotalSpaceLabel, FreeSpaceLabel, InstallSpacelabel:

Код:
var
  TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, InstallSpaceLabel: TLabel;
  FreeMB, TotalMB: Cardinal;

function MbOrTb(Float: Extended): String;
begin
if Float < 1024 then Result:= FormatFloat('0', Float)+ ExpandConstant(' {cm:Mb}') else
if Float/1024 < 1024 then Result:= format('%.2n', [Float/1024])+ ExpandConstant(' {cm:Gb}') else
Result:= format('%.2n', [Float/(1024*1024)])+ ExpandConstant(' {cm:Tb}'); StringChange(Result, ',', '.');
end;

procedure DirEditOnChange(Sender: TObject);
var Drive: String;
begin
  Drive:= ExtractFileDrive(WizardForm.DirEdit.Text);
  GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
  TotalSpaceLabel.Caption:= ExpandConstant('{cm:TotalSpaceLabel} ')+MbOrTb(TotalMB);
  FreeSpaceLabel.Caption:= ExpandConstant('{cm:FreeSpaceLabel} ')+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
  InstallSpacelabel.Caption:= ExpandConstant('{cm:InstallSpacelabel} ')+MbOrTb({#NeedInstallSize});
  NeedSpaceLabel.Caption:= ExpandConstant('{cm:NeedSpaceLabel} ')+MbOrTb({#NeedSize});
  WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize})and(FreeMB>{#NeedSize});
end;

procedure InitializeWizard();
begin
  TotalSpaceLabel:= TLabel.Create(WizardForm);
  TotalSpaceLabel.AutoSize:= False;
  TotalSpaceLabel.SetBounds(0, 120, 300, 20);
  TotalSpaceLabel.Parent:= WizardForm.SelectDirpage;

  FreeSpaceLabel:= TLabel.Create(WizardForm);
  FreeSpaceLabel.AutoSize:= False;
  FreeSpaceLabel.SetBounds(0, 140, 300, 20);
  FreeSpaceLabel.Parent:= WizardForm.SelectDirpage;

  InstallSpacelabel:= TLabel.Create(WizardForm);
  InstallSpacelabel.AutoSize:= False;
  InstallSpacelabel.SetBounds(0, 160, 300, 20);
  InstallSpacelabel.Parent:= WizardForm.SelectDirpage;
  NeedSpaceLabel:= TLabel.Create(WizardForm);
  NeedSpaceLabel.AutoSize:= False;
  NeedSpaceLabel.SetBounds(0, 180, 300, 20);
  NeedSpaceLabel.Parent:= WizardForm.SelectDirpage;
  WizardForm.DirEdit.OnChange:=@DirEditOnChange;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID=wpSelectDir then begin
  DirEditOnChange(nil)
  end;
end;


Modificado por mí y agregado que se vea en rojo cuando no hay espacio disponible:

#define NeedInstallSize 100

[Languages]
Name: "eng"; MessagesFile: "Idiomas\English.isl"
Name: "spa"; MessagesFile: "Idiomas\Spanish.isl"

[CustomMessages]
eng.Finished=The installation is completed.
spa.Finished=La instalación se ha completado.

eng.TotalSpaceLabel=Total disk space:
eng.FreeSpaceLabel=Available disk space:
eng.InstallSpacelabel=Required space for installation:

spa.TotalSpaceLabel=Espacio total en disco:
spa.FreeSpaceLabel=Espacio disponible:
spa.InstallSpacelabel=Espacio necesario para la instalación:


[code]
[Code]

var
  TotalSpaceLabel, FreeSpaceLabel, InstallSpaceLabel: TLabel;
  FreeMB, TotalMB: Cardinal;

Function NumToStr(Float: Extended): String;
Begin
  Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.');
  while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
  SetLength(Result, Length(Result)-1);
End;

Function MbOrTb(Byte: Extended): String;
begin
if Byte < 1024 then Result:= NumToStr(Byte) + ' Mb' else
  if Byte/1024 < 1024 then Result:= NumToStr(round(Byte/1024*100)/100) + ' Gb' else
  Result:= NumToStr(round((Byte/(1024*1024))*100)/100) + ' Tb'
end;

procedure DirEditOnChange(Sender: TObject);
var Drive: String;
begin
  Drive:= ExtractFileDrive(WizardForm.DirEdit.Text);
  GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
  TotalSpaceLabel.Caption:= ExpandConstant('{cm:TotalSpaceLabel} ')+MbOrTb(TotalMB);
  FreeSpaceLabel.Caption:= ExpandConstant('{cm:FreeSpaceLabel} ')+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
  InstallSpacelabel.Caption:= ExpandConstant('{cm:InstallSpacelabel} ')+MbOrTb({#NeedInstallSize});
  if (FreeMB<{#NeedInstallSize}) then
  InstallSpacelabel.Font.Color:=clRed
  else
  InstallSpacelabel.Font.Color:=InstallSpacelabel.Font.Color;
  WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize})
end;

procedure InitializeWizard;
begin
  TotalSpaceLabel:= TLabel.Create(WizardForm);
  TotalSpaceLabel.AutoSize:= False;
  TotalSpaceLabel.SetBounds(0, 140, 300, 20);
  TotalSpaceLabel.Parent:= WizardForm.SelectDirpage;

  FreeSpaceLabel:= TLabel.Create(WizardForm);
  FreeSpaceLabel.AutoSize:= False;
  FreeSpaceLabel.SetBounds(0, 160, 300, 20);
  FreeSpaceLabel.Parent:= WizardForm.SelectDirpage;

  InstallSpacelabel:= TLabel.Create(WizardForm);
  InstallSpacelabel.AutoSize:= False;
  InstallSpacelabel.SetBounds(0, 180, 300, 20);
  InstallSpacelabel.Parent:= WizardForm.SelectDirpage;

  WizardForm.DirEdit.OnChange:=@DirEditOnChange;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID=wpSelectDir then begin
  DirEditOnChange(nil)
  end;
end;
 

nizcoz

Участник
I use TotalSpaceLabel, FreeSpaceLabel, NeedSpacelabel, InstallSpaceLabel in my script and work fine. But i add the other function (add porcentage,etc to progress bar) and no work and no show more the first (totalspace, etc).

Possible error with CurPageChanged duplicated? Problem with the order of the functions?

Sorry, bad english.
 

nizcoz

Участник
Another progress bar, porcentage, no work for me:

Код:
[Setup]
AppName=AppName
AppVerName=AppVerName
DefaultDirName={pf}\My Program

[Files]
Source: files\*; DestDir: {app}; AfterInstall: ExtLog(); Flags: recursesubdirs

[Code]
var
  ProgressLabel: TLabel;

procedure ExtLog();
begin
  with WizardForm.ProgressGauge do begin
  ProgressLabel.Caption:=IntToStr((Position-Min)/((Max - Min)/100)) + '%'
  if (Position-Min)/((Max - Min)/100) > 50 then ProgressLabel.Font.Color:= clWhite
  end
end;

procedure InitializeWizard;
begin
  ProgressLabel:=TLabel.Create(WizardForm)
  ProgressLabel.Top:= 4
  ProgressLabel.Left:= 200
  ProgressLabel.Caption:= '0%'
  ProgressLabel.AutoSize:= True
  ProgressLabel.Font.Color:= clBlue
  ProgressLabel.Font.Style:= [fsBold]
  ProgressLabel.Transparent:= True
  ProgressLabel.Parent:= WizardForm.ProgressGauge
end;
 

vint56

Ветеран
Проверенный
nizcoz, Нужна версия для работы Inno Setup 5.5.9
#define NeedInstallSize 100
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
Compression=none

[Languages]
Name: "eng"; MessagesFile: "compiler:Default.isl"
Name: "spa"; MessagesFile: "compiler:Languages\Spanish.isl"

[CustomMessages]
eng.Finished=The installation is completed.
spa.Finished=La instalación se ha completado.

eng.TotalSpaceLabel=Total disk space:
eng.FreeSpaceLabel=Available disk space:
eng.InstallSpacelabel=Required space for installation:

spa.TotalSpaceLabel=Espacio total en disco:
spa.FreeSpaceLabel=Espacio disponible:
spa.InstallSpacelabel=Espacio necesario para la instalación:


[Files]
Source: "C:\Program Files (x86)\ACD Systems\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; AfterInstall: ExtLog();

Код:
var
  ProgressLabel: TLabel;

procedure ExtLog();
begin
  with WizardForm.ProgressGauge do begin
  ProgressLabel.Caption:=IntToStr((Position-Min)/((Max - Min)/100)) + '%'
  if (Position-Min)/((Max - Min)/100) > 50 then ProgressLabel.Font.Color:= clWhite
  end
end;

procedure Progress;
begin
  ProgressLabel:=TLabel.Create(WizardForm)
  ProgressLabel.Top:= 4
  ProgressLabel.Left:= 200
  ProgressLabel.Caption:= '0%'
  ProgressLabel.AutoSize:= True
  ProgressLabel.Font.Color:= clBlue
  ProgressLabel.Font.Style:= [fsBold]
  ProgressLabel.Transparent:= True
  ProgressLabel.Parent:= WizardForm.ProgressGauge
end;

var
  TotalSpaceLabel, FreeSpaceLabel, InstallSpaceLabel: TLabel;
  FreeMB, TotalMB: Cardinal;

Function NumToStr(Float: Extended): String;
Begin
  Result:= Format('%.2n', [Float]); StringChange(Result, ',', '.');
  while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Pos('.', Result) > 0) do
  SetLength(Result, Length(Result)-1);
End;

Function MbOrTb(Byte: Extended): String;
begin
if Byte < 1024 then Result:= NumToStr(Byte) + ' Mb' else
  if Byte/1024 < 1024 then Result:= NumToStr(round(Byte/1024*100)/100) + ' Gb' else
  Result:= NumToStr(round((Byte/(1024*1024))*100)/100) + ' Tb'
end;

procedure DirEditOnChange(Sender: TObject);
var Drive: String;
begin
  Drive:= ExtractFileDrive(WizardForm.DirEdit.Text);
  GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
  TotalSpaceLabel.Caption:= ExpandConstant('{cm:TotalSpaceLabel} ')+MbOrTb(TotalMB);
  FreeSpaceLabel.Caption:= ExpandConstant('{cm:FreeSpaceLabel} ')+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
  InstallSpacelabel.Caption:= ExpandConstant('{cm:InstallSpacelabel} ')+MbOrTb({#NeedInstallSize});
  if (FreeMB<{#NeedInstallSize}) then
  InstallSpacelabel.Font.Color:=clRed
  else
  InstallSpacelabel.Font.Color:=InstallSpacelabel.Font.Color;
  WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize})
end;

procedure TotalSpace;
begin
  Progress;
  TotalSpaceLabel:= TLabel.Create(WizardForm);
  TotalSpaceLabel.AutoSize:= False;
  TotalSpaceLabel.SetBounds(0, 140, 300, 20);
  TotalSpaceLabel.Parent:= WizardForm.SelectDirpage;

  FreeSpaceLabel:= TLabel.Create(WizardForm);
  FreeSpaceLabel.AutoSize:= False;
  FreeSpaceLabel.SetBounds(0, 160, 300, 20);
  FreeSpaceLabel.Parent:= WizardForm.SelectDirpage;

  InstallSpacelabel:= TLabel.Create(WizardForm);
  InstallSpacelabel.AutoSize:= False;
  InstallSpacelabel.SetBounds(0, 180, 300, 20);
  InstallSpacelabel.Parent:= WizardForm.SelectDirpage;

  WizardForm.DirEdit.OnChange:=@DirEditOnChange;
end;

function GetTickCount: DWORD;
  external 'GetTickCount@kernel32.dll stdcall';

var
  StartTick: DWORD;
  PercentLabel: TNewStaticText;
  ElapsedLabel: TNewStaticText;
  RemainingLabel: TNewStaticText;

function TicksToStr(Value: DWORD): string;
var
  I: DWORD;
  Hours, Minutes, Seconds: Integer;
begin
  I := Value div 1000;
  Seconds := I mod 60;
  I := I div 60;
  Minutes := I mod 60;
  I := I div 60;
  Hours := I mod 24;
  Result := Format('%.2d:%.2d:%.2d', [Hours, Minutes, Seconds]);
end;

procedure InitializeWizard;
begin
  TotalSpace;
  PercentLabel := TNewStaticText.Create(WizardForm);
  PercentLabel.Parent := WizardForm.ProgressGauge.Parent;
  PercentLabel.Left := 0;
  PercentLabel.Top := WizardForm.ProgressGauge.Top +
    WizardForm.ProgressGauge.Height + 12;

  ElapsedLabel := TNewStaticText.Create(WizardForm);
  ElapsedLabel.Parent := WizardForm.ProgressGauge.Parent;
  ElapsedLabel.Left := 0;
  ElapsedLabel.Top := PercentLabel.Top + PercentLabel.Height + 4;

  RemainingLabel := TNewStaticText.Create(WizardForm);
  RemainingLabel.Parent := WizardForm.ProgressGauge.Parent;
  RemainingLabel.Left := 0;
  RemainingLabel.Top := ElapsedLabel.Top + ElapsedLabel.Height + 4;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID=wpSelectDir then begin
  DirEditOnChange(nil)
  if CurPageID = wpInstalling then
  StartTick := GetTickCount;
  end;
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
  if CurPageID = wpInstalling then
  begin
    Cancel := False;
    if ExitSetupMsgBox then
    begin
      Cancel := True;
      Confirm := False;
      PercentLabel.Visible := False;
      ElapsedLabel.Visible := False;
      RemainingLabel.Visible := False;
    end;
  end;
end;

procedure CurInstallProgressChanged(CurProgress, MaxProgress: Integer);
var
  CurTick: DWORD;
begin
  CurTick := GetTickCount;
  PercentLabel.Caption :=
    Format('Done: %.2f %%', [(CurProgress * 100.0) / MaxProgress]);
  ElapsedLabel.Caption :=
    Format('Elapsed: %s', [TicksToStr(CurTick - StartTick)]);
  if CurProgress > 0 then
  begin
    RemainingLabel.Caption :=
      Format('Remaining: %s', [TicksToStr(
        ((CurTick - StartTick) / CurProgress) * (MaxProgress - CurProgress))]);
  end;
end;
[/SPOILER]
 

nizcoz

Участник
@vint56 !Hi! That code not work for me, i use inno 5.5.1.ee2 (u) build 121216. If i use 5.5.9 no work for me others functions of my script (language selection error).

This is my script, all work ok. I would like to add porcentage, timeelapsed, etc to progress bar and if possible, the code of isdone_example (external compress method, data.rar),
But with the first I conform, is possible? Thanks.

Код:
[code]
// Import the LoadVCLStyle function from VclStylesInno.DLL
procedure LoadVCLStyle(VClStyleFile: String); external 'LoadVCLStyleW@files:VclStyles.dll stdcall setuponly';
procedure LoadVCLStyle_UnInstall(VClStyleFile: String); external 'LoadVCLStyleW@{#VCLStylesSkinPath}\VclStyles.dll stdcall uninstallonly';
// Import the UnLoadVCLStyles function from VclStylesInno.DLL
procedure UnLoadVCLStyles; external 'UnLoadVCLStyles@files:VclStyles.dll stdcall setuponly';
procedure UnLoadVCLStyles_UnInstall; external 'UnLoadVCLStyles@{#VCLStylesSkinPath}\VclStyles.dll stdcall uninstallonly';


function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('skin.vsf');
  LoadVCLStyle(ExpandConstant('{tmp}\skin.vsf'));
  Result := True;
end;
{ RedesignWizardFormBegin } // Don't remove this line!
// Don't modify this section. It is generated automatically.
procedure LangChange(Sender : TObject);
var
i : integer;
begin
  i := SelectLanguageForm.LangCombo.ItemIndex;
  case TNewComboBox(Sender).ItemIndex of
  0: begin
  with SelectLanguageForm do begin

  SelectLabel.Caption := 'Select language, which will use at installing process:';
  CancelButton.Caption := 'Cancel';

  end;
  end;
  1: begin
  with SelectLanguageForm do begin

  SelectLabel.Caption := 'Selecciona el idioma a utilizar durante la instalación:';
  CancelButton.Caption := 'Cancelar';

  end;
  end;
  end;
end;

function InitializeLanguageDialog(): Boolean;
begin
with SelectLanguageForm do begin
  ExtractTemporaryFile('skin.vsf');
  LoadVCLStyle(ExpandConstant('{tmp}\skin.vsf'));
  Result := True;
  BorderIcons:=[];
  ClientHeight := ScaleY(110);
  ClientWidth := SelectLabel.Width + ScaleX(20);
  SelectLabel.Left := ScaleX(10);
  LangCombo.SetBounds(SelectLabel.Left, SelectLabel.Top + SelectLabel.Height, SelectLabel.Width, LangCombo.Height);
  LangCombo.OnChange := @LangChange;
  OKButton.SetBounds(SelectLabel.Left, LangCombo.Top + LangCombo.Height + ScaleY(5), ScaleX(100), OKButton.Height);
  CancelButton.SetBounds(LangCombo.Width - OKButton.Width + ScaleX(10), OKButton.Top, ScaleX(100), CancelButton.Height);
  IconBitmapImage.Hide;
end;
Result := True;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  case CurStep of
  ssDone : MsgBox(CustomMessage('Finished'), mbInformation, MB_OK);
// If DisableFinishedPage=yes in [Setup] section you can replace ssDone to ssPostInstall
  end;
end;




procedure RedesignWizardForm;
begin
  with WizardForm do
  begin
  Color := clWindow;
  AutoScroll := False;
  ClientHeight := ScaleY(349);
  end;

  with WizardForm.CancelButton do
  begin
  Top := ScaleY(319);
  end;

  with WizardForm.NextButton do
  begin
  Top := ScaleY(319);
  end;

  with WizardForm.BackButton do
  begin
  Top := ScaleY(319);
  end;

  with WizardForm.WizardBitmapImage do
  begin
  Width := ScaleX(500);
  end;

  with WizardForm.WelcomeLabel2 do
  begin
  Visible := False;
  end;

  with WizardForm.WelcomeLabel1 do
  begin
  Visible := False;
  end;

  with WizardForm.WizardSmallBitmapImage do
  begin
  Left := ScaleX(0);
  Width := ScaleX(500);
  Height := ScaleY(60);
  end;

  with WizardForm.PageDescriptionLabel do
  begin
  Visible := False;
  end;

  with WizardForm.PageNameLabel do
  begin
  Visible := False;
  end;

  with WizardForm.WizardBitmapImage2 do
  begin
  Width := ScaleX(500);
  ExtractTemporaryFile('WizardForm.WizardBitmapImage2.bmp');
  Bitmap.LoadFromFile(ExpandConstant('{tmp}\WizardForm.WizardBitmapImage2.bmp'));
  end;

  with WizardForm.FinishedLabel do
  begin
  Visible := False;
  end;

  with WizardForm.FinishedHeadingLabel do
  begin
  Visible := False;
  end;

{ ReservationBegin }
  // This part is for you. Add your specialized code here.

{ ReservationEnd }
end;
// Don't modify this section. It is generated automatically.
{ RedesignWizardFormEnd } // Don't remove this line!

procedure ShowSplashScreen(p1:HWND;p2:AnsiString;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer);
external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';

var
  TotalSpaceLabel, FreeSpaceLabel, InstallSpaceLabel: TLabel;
  FreeMB, TotalMB: Cardinal;

function MbOrTb(Float: Extended): String;
begin
if Float < 1024 then Result:= FormatFloat('0', Float)+ ExpandConstant(' {cm:Mb}') else
if Float/1024 < 1024 then Result:= format('%.2n', [Float/1024])+ ExpandConstant(' {cm:Gb}') else
Result:= format('%.2n', [Float/(1024*1024)])+ ExpandConstant(' {cm:Tb}'); StringChange(Result, ',', '.');
end;

procedure DirEditOnChange(Sender: TObject);
var Drive: String;
begin
  Drive:= ExtractFileDrive(WizardForm.DirEdit.Text);
  GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
  TotalSpaceLabel.Caption:= ExpandConstant('{cm:TotalSpaceLabel} ')+MbOrTb(TotalMB);
  FreeSpaceLabel.Caption:= ExpandConstant('{cm:FreeSpaceLabel} ')+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
  InstallSpacelabel.Caption:= ExpandConstant('{cm:InstallSpacelabel} ')+MbOrTb({#NeedInstallSize});
  WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize})
  if (FreeMB<{#NeedInstallSize}) then
  InstallSpacelabel.Font.Color:=clRed
  else
  InstallSpacelabel.Font.Color:=InstallSpacelabel.Font.Color;
  WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize})
end;




procedure InitializeWizard;
begin
  TotalSpaceLabel:= TLabel.Create(WizardForm);
  TotalSpaceLabel.AutoSize:= False;
  TotalSpaceLabel.SetBounds(0, 140, 300, 20);
  TotalSpaceLabel.Parent:= WizardForm.SelectDirpage;

  FreeSpaceLabel:= TLabel.Create(WizardForm);
  FreeSpaceLabel.AutoSize:= False;
  FreeSpaceLabel.SetBounds(0, 160, 300, 20);
  FreeSpaceLabel.Parent:= WizardForm.SelectDirpage;

  InstallSpacelabel:= TLabel.Create(WizardForm);
  InstallSpacelabel.AutoSize:= False;
  InstallSpacelabel.SetBounds(0, 180, 300, 20);
  InstallSpacelabel.Parent:= WizardForm.SelectDirpage;

  WizardForm.DirEdit.OnChange:=@DirEditOnChange;

  RedesignWizardForm;
  ExtractTemporaryFile('Splash.png');
  ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}\Splash.png'),1000,2000,1000,0,255,True,$FFFFFF,10);
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID=wpSelectDir then begin
  DirEditOnChange(nil)
  end;
end;

procedure DeinitializeSetup();
begin
  UnLoadVCLStyles;
end;
 
Последнее редактирование:

vint56

Ветеран
Проверенный
nizcoz, я лично проверил этот скрипт на версий Inno Setup 5.5.9 unicode работает в на версий inno 5.5.1.ee2 (u) build 121216 не работает
 

nizcoz

Участник
nizcoz, я лично проверил этот скрипт на версий Inno Setup 5.5.9 unicode работает в на версий inno 5.5.1.ee2 (u) build 121216 не работает
@vint56, in Inno Setup 5.5.9 unicode my script show error selectlanguageform (unknown identifier).




And if i delete this: (language selector)

procedure LangChange(Sender : TObject);
var
i : integer;
begin
i := SelectLanguageForm.LangCombo.ItemIndex;
case TNewComboBox(Sender).ItemIndex of
0: begin
with SelectLanguageForm do begin

SelectLabel.Caption := 'Select language, which will use at installing process:';
CancelButton.Caption := 'Cancel';

end;
end;
1: begin
with SelectLanguageForm do begin

SelectLabel.Caption := 'Selecciona el idioma a utilizar durante la instalación:';
CancelButton.Caption := 'Cancelar';

end;
end;
end;
end;

function InitializeLanguageDialog(): Boolean;
begin
with SelectLanguageForm do begin
ExtractTemporaryFile('skin.vsf');
LoadVCLStyle(ExpandConstant('{tmp}\skin.vsf'));
Result := True;
BorderIcons:=[];
ClientHeight := ScaleY(110);
ClientWidth := SelectLabel.Width + ScaleX(20);
SelectLabel.Left := ScaleX(10);
LangCombo.SetBounds(SelectLabel.Left, SelectLabel.Top + SelectLabel.Height, SelectLabel.Width, LangCombo.Height);
LangCombo_OnChange := @LangChange;
OKButton.SetBounds(SelectLabel.Left, LangCombo.Top + LangCombo.Height + ScaleY(5), ScaleX(100), OKButton.Height);
CancelButton.SetBounds(LangCombo.Width - OKButton.Width + ScaleX(10), OKButton.Top, ScaleX(100), CancelButton.Height);
IconBitmapImage.Hide;
end;
Result := True;
end;


Error:

 
Последнее редактирование:

SBalykov

Старожил
nizcoz,
Take you the example of a finished script that is on the forum and used it to your needs.
Pull fragments of different scripts will not help you but increase confusion and will add a lot of problems ...
P.S. And one question. What is your native language?
 

nizcoz

Участник
nizcoz,
Take you the example of a finished script that is on the forum and used it to your needs.
Pull fragments of different scripts will not help you but increase confusion and will add a lot of problems ...
P.S. And one question. What is your native language?
@SBalykov, Spanish (español). Ok. Thanks.

P.S. Intenté armar un script desde cero y lo estaba logrando. Pero parece que no estoy ordenando bien las funciones o estoy mezclando cosas que no son reconocidas por la version del inno setup que estoy utilizando.
 
Последнее редактирование:

vint56

Ветеран
Проверенный
nizcoz, SelectLanguageForm требуется расширенная версия inno 5.5.1.ee2 (u) build 121216 потому и ошибка
 

SBalykov

Старожил
nizcoz,
Es mucho más fácil de usar un listo guión. Todos los fragmentos tomados de diferentes secuencias de comandos, y por lo tanto no funcione listo guión. Esta incapacidad para conectar las piezas individuales, sólo conduciría a la confusión ...

vint56
,
Наверное, надо дать готовый скрипт и ссылку на расширенную InnoSetup?
По моему, дальнейшее выдергивание из разных скриптов, приведет к коллапсу мозгов ...
 
Последнее редактирование:
Сверху