View Single Post
  #4  
Old 18-10-2015, 18:56
rinaldo's Avatar
rinaldo rinaldo is offline
Registered User
 
Join Date: Sep 2015
Location: Rome
Posts: 433
Thanks: 101
Thanked 696 Times in 191 Posts
rinaldo is on a distinguished road
Quote:
Originally Posted by y_thelastknight View Post
yes but he just need red marked font as changeable using tedit.
english language help me

Another example but do not quite understand sorry
Code:
#define GameName "Car Mechanic Simulator 2015 Gold EditionS"
#define DvD "1x DVD5"

[Setup]
AppName=RinaCompress
AppVersion=1.0.0.0
CreateAppDir=No
OutputBaseFileName=Compressor
OutputDir=.
;SetupIconFile=Icon.ico
Compression=none


[CustomMessages]
en.SelectMsg=Select Game to Compress
en.CompBtn=Compress

[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"

[Code ]
var
Lbl   : array [1..6] of TLabel;
CompressBtn: TButton;
FolderTreeView: TFolderTreeView;
CustomDirEdit, CustomOutputEdit: TNewEdit;
List: TStringList;
Dirs,batfile: string;
res: Integer;

procedure DirFolderChange(Sender: TObject);
Begin
CustomDirEdit.Text:=FolderTreeView.Directory;
end;

procedure ConvertOnClick(Sender: TObject);
begin
wizardForm.Close;
 Dirs:=WizardForm.DirEdit.Text;
  batfile:= ExpandConstant('{src}\Comp.bat');
  List:= TStringList.Create;
  List.Add('@echo off');
  List.Add('arc a DVD\Data1.arc -mx "'+Dirs+'\*"');
  List.Add('pause');
  List.Add('del Comp.bat');
  List.SaveToFile(batfile);
  List.Free;
  Exec(batfile, '', '', SW_SHOW, ewNoWait, Res);
end;

procedure CW;
begin
WizardForm.Caption := ExpandConstant('Bat Creating Compress Tool');

Lbl[1] := TLabel.Create(WizardForm);
Lbl[1].Parent := WizardForm.WelcomePage;
Lbl[1].Alignment := taCenter;
Lbl[1].Caption := '{#GameName}';
Lbl[1].Font.Height := -14;
Lbl[1].Font.Name := 'Arial Black';
Lbl[1].SetBounds(0,0,480,23);

Lbl[2] := TLabel.Create(WizardForm);
Lbl[2].Parent := WizardForm.WelcomePage;
Lbl[2].Alignment := taCenter;
Lbl[2].Caption := '{#DvD}';
Lbl[2].Font.Height := -12;
Lbl[2].Font.Name := 'Arial Black';
Lbl[2].SetBounds(0,20,480,23);


Lbl[3] := TLabel.Create(WizardForm);
Lbl[3].Parent := WizardForm.WelcomePage;
Lbl[3].Caption := ExpandConstant('{cm:SelectMsg}:');
Lbl[3].Font.Size := 8;
Lbl[3].Font.Name:='Lucida Console'
Lbl[3].SetBounds(5,46,480,23);

Lbl[4] := TLabel.Create(WizardForm);
Lbl[4].Parent := WizardForm.WelcomePage;
Lbl[4].Font.Size := 8;
Lbl[4].Font.Name:='Lucida Console'
Lbl[4].SetBounds(8,280,480,23);

Lbl[5] := TLabel.Create(WizardForm);
Lbl[5].Parent := WizardForm.WelcomePage;
Lbl[5].Font.Size := 8;
Lbl[5].Font.Name:='Lucida Console';

CompressBtn := TButton.Create(WizardForm);
CompressBtn.Parent := WizardForm.WelcomePage;
CompressBtn.SetBounds(410,57,73,25);
CompressBtn.Caption := ExpandConstant('{cm:CompBtn}');
CompressBtn.OnClick := @ConvertOnClick;

CustomDirEdit := TNewEdit.Create(WizardForm);
CustomDirEdit.Parent := WizardForm.WelcomePage;
CustomDirEdit.Text:= ExpandConstant('{pf}\{#GameName}');
CustomDirEdit.SetBounds(5,60,400,20);

FolderTreeView := TFolderTreeView.Create(WizardForm);
FolderTreeView.Parent := WizardForm.WelcomePage;
FolderTreeView.SetBounds(5,90,400,100);
FolderTreeView.OnChange:= @DirFolderChange;

CustomOutputEdit := TNewEdit.Create(WizardForm);
CustomOutputEdit.Parent := WizardForm.WelcomePage;
CustomOutputEdit.Text:= ExpandConstant('{src}\{#GameName}');
CustomOutputEdit.SetBounds(5,124,400,21);
CustomOutputEdit.Hide;
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin Confirm:=False;
end;

procedure InitializeWizard();
begin
WizardForm.WelcomePage.Color := $00FFCA41;
WizardForm.BorderStyle := bsSizeToolWin;
WizardForm.ClientHeight:=200;
WizardForm.CancelButton.Left:=9999;
WizardForm.NextButton.Left:=9999;
WizardForm.WizardBitmapImage.Visible:=False
WizardForm.WelcomeLabel1.Visible:=False;
WizardForm.WelcomeLabel2.Visible:=False;
CW();
end;
Script 2:
Code:
#define GameName "Car Mechanic Simulator 2015 Gold EditionS"
#define DvD "1x DVD5"
#define GameSize "10000"

[Setup]
AppName=Bat_Compress
AppVersion=1.0.0.0
CreateAppDir=No
OutputBaseFileName=Bat_Compress
OutputDir=.
SetupIconFile=Include\Icon.ico
Compression=none
AppCopyright=Rinaldo


[CustomMessages]
en.SelectMsg=Select Game to Compress
en.ResetBtn=Reset
en.CompBtn=Compress
en.FreeSpace=Free Space:

[Languages]               
Name: "en"; MessagesFile: "compiler:Default.isl"

[Code ]
var
Lbl   : array [1..6] of TLabel;
ResetBtn,CompressBtn: TButton;
FolderTreeView: TFolderTreeView;
CustomDirEdit, CustomOutputEdit: TNewEdit;
List: TStringList;
Drive,Dirs,BatFile: string;
res: Integer;
FreeMB, TotalMB: Cardinal;

procedure DirFolderChange(Sender: TObject);
Begin
CustomDirEdit.Text:=FolderTreeView.Directory;
end;

procedure ResetOnClick(Sender: TObject);
Begin
CustomDirEdit.Text:=ExpandConstant('{pf}\{#GameName}');
end;

procedure ConvertOnClick(Sender: TObject);
begin
wizardForm.Close;
 Dirs:=WizardForm.DirEdit.Text;
  BatFile:= ExpandConstant('{src}\Comp.bat');
  List:= TStringList.Create;
  List.Add('@echo off');
  List.Add('arc a DVD\Data1.arc -mx "'+Dirs+'\*"');
  List.Add('pause');
  List.Add('del Comp.bat');
  List.SaveToFile(BatFile);
  List.Free;
  Exec(BatFile, '', '', SW_SHOW, ewNoWait, Res);
end;

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(Float: Extended): String;
begin
if Float < 1024 then Result:= NumToStr(Float)+' MB' else
if Float/1024 < 1024 then Result:= NumToStr(Float/1024)+' GB' else
Result:= NumToStr(Float/(1024*1024))+' TB';
end;

procedure SpaceControls(Sender: TObject);
Begin
Drive:= ExtractFileDrive(CustomDirEdit.Text);
GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
Lbl[5].Caption:=ExpandConstant('{cm:FreeSpace} ')+MbOrTb(FreeMB)+' ('+IntToStr(round(FreeMB*100/TotalMB))+'%)';
CompressBtn.Enabled:= (FreeMB>{#GameSize});
if (FreeMB>{#GameSize}) then begin
end else begin
CustomDirEdit.Enabled:=False;
FolderTreeView.Enabled:=False
end;
end;

procedure CW;
begin
WizardForm.Caption := ExpandConstant('Bat Creating Compress Tool');

Lbl[1] := TLabel.Create(WizardForm);
Lbl[1].Parent := WizardForm.WelcomePage;
Lbl[1].Alignment := taCenter;
Lbl[1].Caption := '{#GameName}';
Lbl[1].Font.Height := -14;
Lbl[1].Font.Name := 'Arial Black';
Lbl[1].SetBounds(0,0,480,23);

Lbl[2] := TLabel.Create(WizardForm);
Lbl[2].Parent := WizardForm.WelcomePage;
Lbl[2].Alignment := taCenter;
Lbl[2].Caption := '{#DvD}';
Lbl[2].Font.Height := -12;
Lbl[2].Font.Name := 'Arial Black';
Lbl[2].SetBounds(0,20,480,23);


Lbl[3] := TLabel.Create(WizardForm);
Lbl[3].Parent := WizardForm.WelcomePage;
Lbl[3].Caption := ExpandConstant('{cm:SelectMsg}:');
Lbl[3].Font.Size := 8;
Lbl[3].Font.Name:='Lucida Console'
Lbl[3].SetBounds(5,46,480,23);

Lbl[4] := TLabel.Create(WizardForm);
Lbl[4].Parent := WizardForm.WelcomePage;
Lbl[4].Font.Size := 8;
Lbl[4].Font.Name:='Lucida Console'
Lbl[4].SetBounds(8,280,480,23);

Lbl[5] := TLabel.Create(WizardForm);
Lbl[5].Parent := WizardForm.WelcomePage;
Lbl[5].Font.Size := 8;
Lbl[5].Font.Name:='Lucida Console';
Lbl[5].Font.Color:=$00FFFFFF;
Lbl[5].Font.Style := [fsBold];
Lbl[5].SetBounds(5,200,400,17);

CompressBtn := TButton.Create(WizardForm);
CompressBtn.Parent := WizardForm.WelcomePage;
CompressBtn.SetBounds(410,58,73,25);
CompressBtn.Caption := ExpandConstant('{cm:CompBtn}');
CompressBtn.OnClick := @ConvertOnClick;

ResetBtn := TButton.Create(WizardForm);
ResetBtn.Parent := WizardForm.WelcomePage;
ResetBtn.SetBounds(410,150,73,25);
ResetBtn.Caption := ExpandConstant('{cm:ResetBtn}');
ResetBtn.OnClick := @ResetOnClick;

CustomDirEdit := TNewEdit.Create(WizardForm);
CustomDirEdit.Parent := WizardForm.WelcomePage;
CustomDirEdit.Text:= ExpandConstant('{pf}\{#GameName}');
CustomDirEdit.SetBounds(5,60,400,20);


FolderTreeView := TFolderTreeView.Create(WizardForm);
FolderTreeView.Parent := WizardForm.WelcomePage;
FolderTreeView.SetBounds(5,90,400,100);
FolderTreeView.OnChange:= @DirFolderChange;

CustomOutputEdit := TNewEdit.Create(WizardForm);
CustomOutputEdit.Parent := WizardForm.WelcomePage;
CustomOutputEdit.Text:= ExpandConstant('{src}\{#GameName}');
CustomOutputEdit.SetBounds(5,124,400,21);
CustomOutputEdit.Hide;
end;

procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin Confirm:=False;
end;

procedure InitializeWizard();
begin
WizardForm.WelcomePage.Color := $00FF9D41;
WizardForm.BorderStyle := bsSizeToolWin;
WizardForm.ClientHeight:=220;
WizardForm.CancelButton.Left:=9999;
WizardForm.NextButton.Left:=9999;
WizardForm.WizardBitmapImage.Visible:=False
WizardForm.WelcomeLabel1.Visible:=False;
WizardForm.WelcomeLabel2.Visible:=False;
CW();
CustomDirEdit.OnChange := @SpaceControls;
end;

Last edited by rinaldo; 19-10-2015 at 13:38.
Reply With Quote