Автор: FunnyRabbit
Дата сообщения: 29.11.2010 07:19
InHead
Sherogat не раз выкладывал скрипт ...Учимся пользоваться поиском...
[more]
#define NeedSize "15000"
[Setup]
AppName=Napoleon. Total War
AppVerName=Napoleon. Total War
DefaultDirName={pf}\Napoleon. Total War
DisableReadyPage=true
[Languages]
Name: Rus; MessagesFile: "compiler:Languages\Russian.isl";
[Files]
Source: compiler:ISSkin.dll; DestDir: {tmp}; Flags: dontcopy;
Source: Tiger.cjstyles; DestDir: {tmp}; Flags: dontcopy;
Source: Image1.bmp; DestDir: {tmp}; Flags: dontcopy;
Source: Image2.bmp; DestDir: {tmp}; Flags: dontcopy;
Source: Image3.bmp; DestDir: {tmp}; Flags: dontcopy;
Source: Image4.bmp; DestDir: {tmp}; Flags: dontcopy;
[CustomMessages]
Rus.Welcome=Вас приветствует Мастер установки {#SetupSetting("AppName")}.%nПрограмма установит {#SetupSetting("AppName")} на Ваш компьтер.
Rus.SelectDir=Программа установит игру {#SetupSetting("AppName")} в следующую папку.%nЕсли вы хотите выбрать другую папку, нажмите «Обзор».%nНажмите «Установить», чтобы начать установку игры {#SetupSetting("AppName")}.
Rus.Installing=Пожалйуста, подождите, пока игра {#SetupSetting("AppName")} утсновится на Ваш компьютер.
Rus.Finished=Установка игры {#SetupSetting("AppName")} завершена.%nВы можете запустить игру с помощью%n соответствующего ярлыка на «Рабочем столе» или из меню «Пуск».
Rus.FreeSize=Доступно места на диске:
Rus.NeedSize=Требуется места на диске:
[code]
var
BackPanel, WizardPanel, StatusPanel, ImagePanel: TPanel;
CaptionLabel: TLabel; BmpFile: TBitmapImage;
NeedSpaceLabel,FreeSpaceLabel: TLabel;
FreeMB, TotalMB: Cardinal; NeedSize: Integer;
procedure LoadSkin(lpszPath: String; lpszIniFileName: String); external 'LoadSkin@files:isskin.dll stdcall';
procedure UnloadSkin(); external 'UnloadSkin@files:isskin.dll stdcall';
function ShowWindow(hWnd: Integer; uType: Integer): Integer; external 'ShowWindow@user32.dll stdcall';
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;
procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB > 1024 then
FreeSpaceLabel.Caption := ExpandConstant('{cm:FreeSize} ')+ NumToStr(round(FreeMB/1024*100)/100) + ' Гб' else
FreeSpaceLabel.Caption := ExpandConstant('{cm:FreeSize} ')+ IntToStr(FreeMB)+ ' Мб';
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True;
end;
procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := ExpandConstant('{cm:NeedSize} ')+ NumToStr(round(NeedSize/1024*100)/100) + ' Гб' else
NeedSpaceLabel.Caption := ExpandConstant('{cm:NeedSize} ')+ IntToStr(NeedSize)+ ' Мб';
end;
function InitializeSetup(): Boolean;
begin
ExtractTemporaryFile('Tiger.cjstyles');
LoadSkin(ExpandConstant('{tmp}\Tiger.cjstyles'), '');
Result := True;
end;
procedure DeinitializeSetup();
begin
ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
end;
procedure InitializeWizard();
begin
NeedSize:= {#NeedSize};
ExtractTemporaryFile('Image1.bmp')
ExtractTemporaryFile('Image2.bmp')
ExtractTemporaryFile('Image3.bmp')
ExtractTemporaryFile('Image4.bmp')
WizardForm.ClientWidth:= ScaleX(800);
WizardForm.ClientHeight:= ScaleY(620);
WizardForm.Position:= poScreenCenter;
WizardForm.InnerNotebook.Hide;
WizardForm.OuterNotebook.Hide;
WizardForm.Font.Name:= 'Georgia';
BackPanel:= TPanel.Create(WizardForm)
BackPanel.SetBounds(ScaleX(0), ScaleY(0), ScaleX(800), ScaleY(618))
BackPanel.Color:= clWhite
BackPanel.BorderStyle:= bsNone
BackPanel.ParentBackground:= False
BackPanel.ParentColor:= False
BackPanel.Parent:= WizardForm
StatusPanel:= TPanel.Create(WizardForm)
StatusPanel.SetBounds(ScaleX(2), ScaleY(2), ScaleX(796), ScaleY(18))
StatusPanel.BorderStyle:= bsNone
StatusPanel.ParentBackground:= False
StatusPanel.ParentColor:= False
StatusPanel.Font.Color:= clWhite
StatusPanel.Font.Size:= 12
StatusPanel.Font.Style:= [fsBold]
StatusPanel.Font.Name:= 'Times New Roman'
StatusPanel.Alignment:= taCenter
StatusPanel.Parent:= WizardForm
ImagePanel:= TPanel.Create(WizardForm)
ImagePanel.SetBounds(ScaleX(2), ScaleY(21), ScaleX(796), ScaleY(484))
ImagePanel.BorderStyle:= bsNone
ImagePanel.ParentBackground:= False
ImagePanel.ParentColor:= False
ImagePanel.Parent:= WizardForm
BmpFile:= TBitmapImage.Create(WizardForm)
BmpFile.Stretch:= True;
BmpFile.SetBounds(ScaleX(0),ScaleY(0), ScaleX(796), ScaleY(484))
BmpFile.Parent:= ImagePanel
WizardPanel:= TPanel.Create(WizardForm)
WizardPanel.SetBounds(ScaleX(2), ScaleY(506), ScaleX(796), ScaleY(110))
WizardPanel.Alignment:= taCenter;
WizardPanel.BorderStyle:= bsNone
WizardPanel.ParentBackground:= False
WizardPanel.ParentColor:= False
WizardPanel.Parent:= WizardForm
CaptionLabel:= TLabel.Create(WizardForm);
CaptionLabel.SetBounds(ScaleX(100), ScaleY(5), ScaleX(590), ScaleY(100));
CaptionLabel.AutoSize:= False;
CaptionLabel.WordWrap:= True;
CaptionLabel.Transparent:= True;
CaptionLabel.Font.Color:= $5F8BA2
CaptionLabel.Font.Size:= 11
CaptionLabel.Font.Style:= [fsBold]
CaptionLabel.Alignment:= taCenter;
CaptionLabel.Parent:= WizardPanel;
NeedSpaceLabel:= TLabel.Create(WizardForm);
NeedSpaceLabel.SetBounds(ScaleX(5),ScaleY(70),ScaleX(300),ScaleY(20))
NeedSpaceLabel.Transparent:= True;
NeedSpaceLabel.Font.Style:= [fsBold]
NeedSpaceLabel.Parent:= WizardPanel
FreeSpaceLabel:= TLabel.Create(WizardForm);
FreeSpaceLabel.SetBounds(ScaleX(250), ScaleY(70), ScaleX(300),ScaleY(20))
FreeSpaceLabel.Transparent:= True;
FreeSpaceLabel.Font.Style:= [fsBold]
FreeSpaceLabel.Parent:= WizardPanel
WizardForm.DirEdit.OnChange:= @GetFreeSpaceCaption;
WizardForm.DirEdit.Text:= WizardForm.DirEdit.Text + #0;
WizardForm.DirBrowseButton.Parent:= WizardForm
WizardForm.DirBrowseButton.Left:= ScaleX(455)
WizardForm.DirBrowseButton.Top:= ScaleY(590)
WizardForm.DirBrowseButton.Font.Size:= 8
WizardForm.DirBrowseButton.Font.Style:= [fsBold]
WizardForm.DirEdit.Parent:= WizardForm
WizardForm.DirEdit.Left:= ScaleX(5)
WizardForm.DirEdit.Top:= ScaleY(590)
WizardForm.DirEdit.Width:= ScaleX(445)
WizardForm.DirEdit.Font.Size:= 8
WizardForm.DirEdit.Font.Style:= [fsBold]
WizardForm.ProgressGauge.Parent:= WizardForm
WizardForm.ProgressGauge.Left:= ScaleX(5)
WizardForm.ProgressGauge.Top:= ScaleY(590)
WizardForm.ProgressGauge.Width:= ScaleX(450)
WizardForm.StatusLabel.Parent:= WizardPanel
WizardForm.StatusLabel.SetBounds(ScaleX(5), ScaleY(52), ScaleX(300), ScaleY(20))
WizardForm.StatusLabel.Font.Style:= [fsBold]
WizardForm.FilenameLabel.Parent:= WizardPanel
WizardForm.FilenameLabel.SetBounds(ScaleX(5), ScaleY(68), ScaleX(450), ScaleY(20))
WizardForm.FilenameLabel.Font.Style:= [fsBold]
WizardForm.CancelButton.BringToFront;
WizardForm.CancelButton.Left:= ScaleX(715)
WizardForm.CancelButton.Top:= ScaleY(590)
WizardForm.CancelButton.Font.Size:= 8
WizardForm.CancelButton.Font.Style:= [fsBold]
WizardForm.NextButton.BringToFront;
WizardForm.NextButton.Left:= ScaleX(630)
WizardForm.NextButton.Top:= ScaleY(590)
WizardForm.NextButton.Font.Size:= 8
WizardForm.NextButton.Font.Style:= [fsBold]
WizardForm.BackButton.BringToFront;
WizardForm.BackButton.Left:= ScaleX(545)
WizardForm.BackButton.Top:= ScaleY(590)
WizardForm.BackButton.Font.Size:= 8
WizardForm.BackButton.Font.Style:= [fsBold]
end;
procedure CurPageChanged(CurPageID: Integer);
begin
WizardForm.DirEdit.Hide; WizardForm.DirBrowseButton.Hide;
WizardForm.Progressgauge.Hide; WizardForm.StatusLabel.Hide;
WizardForm.FilenameLabel.Hide; FreeSpaceLabel.Hide;
NeedSpaceLabel.Hide;
case CurPageID of
wpWelcome:
begin
CaptionLabel.Caption:= ExpandConstant('{cm:Welcome}')
StatusPanel.Caption:= 'Приветствие'
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image1.bmp'))
end;
wpSelectDir:
begin
WizardForm.DirEdit.Show; WizardForm.DirBrowseButton.Show;
FreeSpaceLabel.Show; NeedSpaceLabel.Show;
CaptionLabel.Caption:= ExpandConstant('{cm:SelectDir}')
StatusPanel.Caption:= 'Подготовка к установке'
WizardForm.NextButton.Caption:= 'Установить'
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image2.bmp'))
GetNeedSpaceCaption; if FreeMB < NeedSize then WizardForm.NextButton.Enabled:=False;
end;
wpInstalling:
begin
WizardForm.Progressgauge.Show; WizardForm.StatusLabel.Show;
WizardForm.FilenameLabel.Show;
CaptionLabel.Caption:= ExpandConstant('{cm:Installing}')
StatusPanel.Caption:= 'Установка'
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image3.bmp'))
end;
wpFinished:
begin
CaptionLabel.Caption:= ExpandConstant('{cm:Finished}')
StatusPanel.Caption:= 'Завершение'
BmpFile.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image4.bmp'))
end;
end;
end;[/more]