Войти

Показать полную графическую версию : [архив] Скрипты Inno Setup. Помощь и советы [часть 2]


Страниц : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 [74] 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133

Lol2xD.
07-03-2010, 11:28
Serega, привет))я опять по тому скрипту))
Хотелось бы мой скрипт
#include "ExecAndWait.iss"

[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
Compression=lzma/ultra
InternalCompressLevel=ultra
SolidCompression=yes

[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl

[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
ExecAndWait(ExpandConstant('{sys}\notepad.exe'), '', '', SW_SHOW, True);
end;

объединить со скриптом FreeArc_Example.iss
[Setup]
AppName=FreeArc Example
AppVerName=FreeArc Example 3.3
DefaultDirName={pf}\FreeArc Example
UsePreviousAppDir=false
DirExistsWarning=no
ShowLanguageDialog=auto
OutputBaseFilename=FreeArc_Example
OutputDir=.
VersionInfoCopyright=Bulat Ziganshin, Victor Dobrov, SotM, CTACKo

[Languages]
Name: eng; MessagesFile: compiler:Default.isl
Name: rus; MessagesFile: compiler:Languages\Russian.isl

[CustomMessages]
eng.ArcBreak=Installation cancelled!
eng.ExtractedInfo=Extracted %1 Mb of %2 Mb
eng.ArcInfo=Archive: %1 of %2
eng.ArcTitle=Extracting FreeArc archive
eng.ArcError=Decompression failed with error code %1
eng.ArcFail=Decompression failed!
eng.AllProgress=Overall extraction progress: %1%%
eng.ArcBroken=Archive %1 is damaged%nor not enough free space.
eng.Extracting=Extracting: %1
eng.taskbar=%1%%, %2 remains
eng.remains=Remaining time: %1
eng.LongTime=at no time
eng.ending=ending
eng.hour=hours
eng.min=mins
eng.sec=secs

rus.ArcBreak=Установка прервана!
rus.ExtractedInfo=Распаковано %1 Мб из %2 Мб
rus.ArcInfo=Архив: %1 из %2
rus.ArcTitle=Распаковка архивов FreeArc
rus.ArcError=Распаковщик FreeArc вернул код ошибки: %1
rus.ArcFail=Распаковка не завершена!
rus.AllProgress=Общий прогресс распаковки: %1%%
rus.ArcBroken=Возможно, архив %1 повреждён%nили недостаточно места на диске назначения.
rus.Extracting=Распаковывается: %1
rus.taskbar=%1%%, жди %2
rus.remains=Осталось ждать %1
rus.LongTime=вечно
rus.ending=завершение
rus.hour=часов
rus.min=мин
rus.sec=сек

[Files]
;Source: *.arc; DestDir: {app}; Flags: nocompression
Source: unarc.dll; DestDir: {tmp}; Flags: dontcopy deleteafterinstall
Source: compiler:InnoCallback.dll; DestDir: {tmp}; Flags: dontcopy

[UninstallDelete]
Type: filesandordirs; Name: {app}

[Code]
const
Archives = '{src}\*.arc'; // укажите расположение архивов FreeArc; для внешних файлов строку в [Files] добавлять необязательно

PM_REMOVE = 1;
CP_ACP = 0; CP_UTF8 = 65001;
oneMb = 1048576;

type
#ifdef UNICODE ; если у вас ошибка на этой строке, то установите препроцессор или исправьте скрипт для вашей версии Inno Setup
#define A "W"
#else
#define A "A" ; точка входа в SetWindowText, {#A} меняется на A или W в зависимости от версии
PAnsiChar = PChar; // Required for Inno Setup 5.3.0 and higher. (требуется для Inno Setup версии 5.3.0 и ниже)
#endif
#if Ver < 84018176
AnsiString = String; // There is no need for this line in Inno Setup 5.2.4 and above (для Inno Setup версий 5.2.4 и выше эта строка не нужна)
#endif

TMyMsg = record
hwnd: HWND;
message: UINT;
wParam: Longint;
lParam: Longint;
time: DWORD;
pt: TPoint;
end;

TFreeArcCallback = function (what: PAnsiChar; int1, int2: Integer; str: PAnsiChar): Integer;
TArc = record Path: string; OrigSize: Integer; Size: Extended; end;

var
ExtractFile: TLabel;
lblExtractFileName: TLabel;
btnCancelUnpacking: TButton;
CancelCode, n, UnPackError, StartInstall: Integer;
Arcs: array of TArc;
msgError: string;
lastMb: Integer;
baseMb: Integer;
totalUncompressedSize: Integer; // total uncompressed size of archive data in mb
LastTimerEvent: DWORD;

Function MultiByteToWideChar(CodePage: UINT; dwFlags: DWORD; lpMultiByteStr: string; cbMultiByte: integer; lpWideCharStr: string; cchWideChar: integer): longint; external 'MultiByteToWideChar@kernel32.dll stdcall';
Function WideCharToMultiByte(CodePage: UINT; dwFlags: DWORD; lpWideCharStr: string; cchWideChar: integer; lpMultiByteStr: string; cbMultiByte: integer; lpDefaultChar: integer; lpUsedDefaultChar: integer): longint; external 'WideCharToMultiByte@kernel32.dll stdcall';

function PeekMessage(var lpMsg: TMyMsg; hWnd: HWND; wMsgFilterMin, wMsgFilterMax, wRemoveMsg: UINT): BOOL; external 'PeekMessageA@user32.dll stdcall';
function TranslateMessage(const lpMsg: TMyMsg): BOOL; external 'TranslateMessage@user32.dll stdcall';
function DispatchMessage(const lpMsg: TMyMsg): Longint; external 'DispatchMessageA@user32.dll stdcall';

Function OemToChar(lpszSrc, lpszDst: AnsiString): longint; external 'OemToCharA@user32.dll stdcall';
function GetWindowLong(hWnd, nIndex: Integer): Longint; external 'GetWindowLongA@user32 stdcall delayload';
function SetWindowText(hWnd: Longint; lpString: String): Longint; external 'SetWindowText{#A}@user32 stdcall delayload';

function GetTickCount: DWord; external 'GetTickCount@kernel32';
function WrapFreeArcCallback (callback: TFreeArcCallback; paramcount: integer):longword; external 'wrapcallback@files:innocallback.dll stdcall';
function FreeArcExtract (callback: longword; cmd1,cmd2,cmd3,cmd4,cmd5,cmd6,cmd7,cmd8,cmd9,cmd10: PAnsiChar): integer; external 'FreeArcExtract@files:unarc.dll cdecl';

procedure AppProcessMessage;
var
Msg: TMyMsg;
begin
while PeekMessage(Msg, 0, 0, 0, PM_REMOVE) do begin
TranslateMessage(Msg);
DispatchMessage(Msg);
end;
end;

// Перевод числа в строку с точностью 3 знака (%.3n) с округлением дробной части, если она есть
Function NumToStr(Float: Extended): String;
Begin
Result:= Format('%.3n', [Float]); StringChange(Result, ',', '.');
while ((Result[Length(Result)] = '0') or (Result[Length(Result)] = '.')) and (Length(Result) > 1) do
SetLength(Result, Length(Result)-1);
End;

function cm(Message: String): String; Begin Result:= ExpandConstant('{cm:'+ Message +'}') End;

Function Size64(Hi, Lo: Integer): Extended;
Begin
Result:= Lo;
if Lo<0 then Result:= Result + $7FFFFFFF + $7FFFFFFF + 2;
for Hi:= Hi-1 Downto 0 do
Result:= Result + $7FFFFFFF + $7FFFFFFF + 2;
End;

// Converts OEM encoded string into ANSI
// Преобразует OEM строку в ANSI кодировку
function OemToAnsiStr( strSource: AnsiString): AnsiString;
var
nRet : longint;
begin
SetLength( Result, Length( strSource ) );
nRet:= OemToChar( strSource, Result );
end;

// Converts ANSI encoded string into UTF-8
// Преобразует строку из ANSI в UTF-8 кодировку
function AnsiToUtf8( strSource: string ): string;
var
nRet : integer;
WideCharBuf: string;
MultiByteBuf: string;
begin
strSource:= strSource + chr(0);
SetLength( WideCharBuf, Length( strSource ) * 2 );
SetLength( MultiByteBuf, Length( strSource ) * 2 );

nRet:= MultiByteToWideChar( CP_ACP, 0, strSource, -1, WideCharBuf, Length(WideCharBuf) );
nRet:= WideCharToMultiByte( CP_UTF8, 0, WideCharBuf, -1, MultiByteBuf, Length(MultiByteBuf), 0, 0);

Result:= MultiByteBuf;
end;

// OnClick event function for btnCancel
procedure btnCancelUnpackingOnClick(Sender: TObject);
begin
if MsgBox( SetupMessage( msgExitSetupMessage ), mbInformation, MB_YESNO ) = IDYES then
CancelCode:= -127;
end;

var origsize: Integer;
// The callback function for getting info about FreeArc archive
function FreeArcInfoCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer;
begin
if string(what)='origsize' then origsize := Mb else
if string(what)='compsize' then else
if string(what)='total_files' then else
Result:= CancelCode;
end;

// Returns decompressed size of files in archive
function ArchiveOrigSize(arcname: string): Integer;
var
callback: longword;
Begin
callback:= WrapFreeArcCallback(@FreeArcInfoCallback,4); //FreeArcInfoCallback has 4 arguments
CancelCode:= 0;
AppProcessMessage;
try
// Pass the specified arguments to 'unarc.dll'
Result:= FreeArcExtract (callback, 'l', '--', AnsiToUtf8(arcname), '', '', '', '', '', '', '');
if CancelCode < 0 then Result:= CancelCode;
if Result >= 0 then Result:= origsize;
except
Result:= -63; // ArcFail
end;
end;

// Scans the specified folders for archives and add them to list
function FindArcs(dir: string): Extended;
var
FSR: TFindRec;
Begin
Result:= 0;
if FindFirst(ExpandConstant(dir), FSR) then begin
try
repeat
// Skip everything but the folders
if FSR.Attributes and FILE_ATTRIBUTE_DIRECTORY > 0 then CONTINUE;
n:= GetArrayLength(Arcs);
// Expand the folder list
SetArrayLength(Arcs, n +1);
Arcs[n].Path:= ExtractFilePath(ExpandConstant(dir)) + FSR.Name;
Arcs[n].Size:= Size64(FSR.SizeHigh, FSR.SizeLow);
Result:= Result + Arcs[n].Size;
Arcs[n].OrigSize := ArchiveOrigSize(Arcs[n].Path)
totalUncompressedSize := totalUncompressedSize + Arcs[n].OrigSize
until not FindNext(FSR);
finally
FindClose(FSR);
end;
end;
End;

// Sets the TaskBar title
Procedure SetTaskBarTitle(Title: String); var h: Integer;
Begin
h:= GetWindowLong(MainForm.Handle, -8); if h <> 0 then SetWindowText(h, Title);
End;

// Converts milliseconds to human-readable time
// Конвертирует милисекунды в человеко-читаемое изображение времени
Function TicksToTime(Ticks: DWord; h,m,s: String; detail: Boolean): String;
Begin
if detail {hh:mm:ss format} then
Result:= PADZ(IntToStr(Ticks/3600000), 2) +':'+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +':'+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2)
else if Ticks/3600 >= 1000 {more than hour} then
Result:= IntToStr(Ticks/3600000) +h+' '+ PADZ(IntToStr((Ticks/1000 - Ticks/1000/3600*3600)/60), 2) +m
else if Ticks/60 >= 1000 {1..60 minutes} then
Result:= IntToStr(Ticks/60000) +m+' '+ PADZ(IntToStr(Ticks/1000 - Ticks/1000/60*60), 2) +s
else Result:= IntToStr(Ticks/1000) +s {less than one minute}
End;

// The main callback function for unpacking FreeArc archives
function FreeArcCallback (what: PAnsiChar; Mb, sizeArc: Integer; str: PAnsiChar): Integer;
var
percents, Remaining: Integer;
s: String;
begin
if GetTickCount - LastTimerEvent > 1000 then begin
// This code will be executed once each 1000 ms (этот код будет выполняться раз в 1000 миллисекунд)
// ....
// End of code executed by timer
LastTimerEvent := LastTimerEvent+1000;
end;

if string(what)='filename' then begin
// Update FileName label
lblExtractFileName.Caption:= FmtMessage( cm( 'Extracting' ), [OemToAnsiStr( str )] )
end else if (string(what)='write') and (totalUncompressedSize>0) and (Mb>lastMb) then begin
// Assign to Mb *total* amount of data extracted to the moment from all archives
lastMb := Mb;
Mb := baseMb+Mb;

// Update progress bar
WizardForm.ProgressGauge.Position:= Mb;

// Show how much megabytes/archives were processed up to the moment
percents:= (Mb*1000) div totalUncompressedSize;
s := FmtMessage(cm('ExtractedInfo'), [IntToStr(Mb), IntToStr(totalUncompressedSize)]);
if GetArrayLength(Arcs)>1 then
s := s + '. '+FmtMessage(cm('ArcInfo'), [IntToStr(n+1), IntToStr(GetArrayLength(Arcs))])
ExtractFile.Caption := s

// Calculate and show current percents
percents:= (Mb*1000) div totalUncompressedSize;
s:= FmtMessage(cm('AllProgress'), [Format('%.1n', [Abs(percents/10)])]);
if Mb > 0 then Remaining:= trunc((GetTickCount - StartInstall) * Abs((totalUncompressedSize - Mb)/Mb)) else Remaining:= 0;
if Remaining = 0 then SetTaskBarTitle(cm('ending')) else begin
s:= s + '. '+FmtMessage(cm('remains'), [TicksToTime(Remaining, cm('hour'), cm('min'), cm('sec'), false)])
SetTaskBarTitle(FmtMessage(cm('taskbar'), [IntToStr(percents/10), TicksToTime(Remaining, 'h', 'm', 's', false)]))
end;
WizardForm.FileNameLabel.Caption := s
end;
AppProcessMessage;
Result:= CancelCode;
end;

// Extracts all found archives
function UnPack(Archives: string): Integer;
var
totalCompressedSize: Extended;
callback: longword;
FreeMB, TotalMB: Cardinal;
begin
// Display 'Extracting FreeArc archive'
lblExtractFileName.Caption:= '';
lblExtractFileName.Show;
ExtractFile.caption:= cm('ArcTitle');
ExtractFile.Show;
// Show the 'Cancel unpacking' button and set it as default button
btnCancelUnpacking.Caption:= WizardForm.CancelButton.Caption;
btnCancelUnpacking.Show;
WizardForm.ActiveControl:= btnCancelUnpacking;
WizardForm.ProgressGauge.Position:= 0;
// Get the size of all archives
totalUncompressedSize := 0;
totalCompressedSize := FindArcs(Archives);
WizardForm.ProgressGauge.Max:= totalUncompressedSize;
// Other initializations
callback:= WrapFreeArcCallback(@FreeArcCallback,4); //FreeArcCallback has 4 arguments
StartInstall:= GetTickCount; {время начала распаковки}
LastTimerEvent:= GetTickCount;
baseMb:= 0

for n:= 0 to GetArrayLength(Arcs) -1 do
begin
lastMb := 0
CancelCode:= 0;
AppProcessMessage;
try
// Pass the specified arguments to 'unarc.dll'
Result:= FreeArcExtract (callback, 'x', '-o+', '-dp' + AnsiToUtf8( ExpandConstant('{app}') ), '--', AnsiToUtf8(Arcs[n].Path), '', '', '', '', '');
if CancelCode < 0 then Result:= CancelCode;
except
Result:= -63; // ArcFail
end;
baseMb:= baseMb+lastMb

// Error occured
if Result <> 0 then
begin
msgError:= FmtMessage(cm('ArcError'), [IntToStr(Result)]);
GetSpaceOnDisk(ExtractFileDrive(ExpandConstant('{app}')), True, FreeMB, TotalMB);
case Result of
-1: if FreeMB < 32 {Мб на диске} then msgError:= SetupMessage(msgDiskSpaceWarningTitle)
else msgError:= msgError + #13#10 + FmtMessage(cm('ArcBroken'), [ExtractFileName(Arcs[n].Path)]);
-127: msgError:= cm('ArcBreak'); //Cancel button
-63: msgError:= cm('ArcFail');
end;
// MsgBox(msgError, mbInformation, MB_OK); //сообщение показывается на странице завершения
Log(msgError);
Break; //прервать цикл распаковки
end;
end;
// Hide labels and button
WizardForm.FileNameLabel.Caption:= '';
lblExtractFileName.Hide;
ExtractFile.Hide;
btnCancelUnpacking.Hide;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
UnPackError:= UnPack(Archives)
if UnPackError = 0 then
SetTaskBarTitle(SetupMessage(msgSetupAppTitle))
else
begin
// Error occured, uninstall it then
Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n); //откат установки из-за ошибки unarc.dll
SetTaskBarTitle(SetupMessage(msgErrorTitle))
WizardForm.Caption:= SetupMessage(msgErrorTitle) +' - '+ cm('ArcBreak')
end;
end;
end;

// стандартный способ отката (не нужна CurPageChanged), но архивы распаковываются до извлечения файлов инсталлятора
// if CurStep = ssInstall then
// if UnPack(Archives) <> 0 then Abort;

Procedure CurPageChanged(CurPageID: Integer);
Begin
if (CurPageID = wpFinished) and (UnPackError <> 0) then
begin // Extraction was unsuccessful (распаковщик вернул ошибку)
// Show error message
WizardForm.FinishedLabel.Font.Color:= $0000C0; // red (красный)
WizardForm.FinishedLabel.Height:= WizardForm.FinishedLabel.Height * 2;
WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) + #13#10#13#10 + msgError;
end;
End;

procedure InitializeWizard();
begin
with WizardForm.ProgressGauge do
begin
// Create a label to show current FileName being extracted
lblExtractFileName:= TLabel.Create(WizardForm);
lblExtractFileName.parent:=WizardForm.InstallingPage;
lblExtractFileName.autosize:=false;
lblExtractFileName.Width:= Width;
lblExtractFileName.top:=Top + ScaleY(35);
lblExtractFileName.Caption:= '';
lblExtractFileName.Hide;

// Create a label to show percentage
ExtractFile:= TLabel.Create(WizardForm);
ExtractFile.parent:=WizardForm.InstallingPage;
ExtractFile.autosize:=false;
ExtractFile.Width:= Width;
ExtractFile.top:=lblExtractFileName.Top + ScaleY(16);
ExtractFile.caption:= '';
ExtractFile.Hide;
end;

// Create a 'Cancel unpacking' button and hide it for now.
btnCancelUnpacking:=TButton.create(WizardForm);
btnCancelUnpacking.Parent:= WizardForm;
btnCancelUnpacking.SetBounds(WizardForm.CancelButton.Left, WizardForm.CancelButton.top, WizardForm.CancelButton.Width, WizardForm.CancelButton.Height);
btnCancelUnpacking.OnClick:= @btnCancelUnpackingOnClick;
btnCancelUnpacking.Hide;
end;

так что бы cначала распаковывались фриарк архивы а потом запускалось то что мне надо
(например: ExecAndWait(ExpandConstant('{sys}\notepad.exe'), '', '', SW_SHOW, True); )
Пытался объединить через Join scripts,но получалось совсем наоборот =( сначала запускался notepad.exe а потом только распаковывались фа архивы.

Sotonisto
07-03-2010, 19:37
Люди, кто знает:
1. Можно ли удалить иконку возле надписи (Установка...) из шапки (рамки) инсталла (я такое видел в InstallShield)?
2. Во время установки игры в шапке (рамке) инсталла всегда такая надпись: Установка - Название игры.
Можно ли сделать так, что бы название игры не выводилось - было просто слово Установка?

Chelluga
07-03-2010, 22:02
Приветствую всех знающих людей.
У меня вопрос такого рода: Кто может показать пример скрипта с прогресс-баром??
Все примеры, которые отрыл в шапке темы - либо не работают вообще, либо стабильно показывают 0%.
Заранее спасибо.

Habetdin
07-03-2010, 22:15
Sotonisto, Во время установки игры в шапке (рамке) инсталла всегда такая надпись: Установка - Название игры. »
[Messages]
SetupWindowTitle=Установка %1

Serega
07-03-2010, 23:12
объединить со скриптом FreeArc_Example.iss »
Просто не поверите, я устал уже от FreeArc_Example.iss, обычно я игнорирую такие вопросы...
У меня иногда складывается впечатление, что просто какое-то FreeArc-помешательство или может быть это обычный стадный инстинкт, одним словом не знаю...
На мой взгляд 7z лучше и проще, но как говорят для саморазвития:

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
UnPackError:= UnPack(Archives)
if UnPackError = 0 then
SetTaskBarTitle(SetupMessage(msgSetupAppTitle))
else
begin
// Error occured, uninstall it then
Exec(ExpandConstant('{uninstallexe}'), '/SILENT','', sw_Hide, ewWaitUntilTerminated, n); //откат установки из-за ошибки unarc.dll
SetTaskBarTitle(SetupMessage(msgErrorTitle))
WizardForm.Caption:= SetupMessage(msgErrorTitle) +' - '+ cm('ArcBreak')
end;
ExecAndWait(ExpandConstant('{sys}\notepad.exe'), '', '', SW_SHOW, True);
end;
end;


Кто может показать пример скрипта с прогресс-баром?? »

[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
Compression=lzma/ultra
InternalCompressLevel=ultra
SolidCompression=yes

[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl


Все примеры, которые отрыл в шапке темы - либо не работают вообще, либо стабильно показывают 0%. »
Что у вас не работает конкретно? Может расскажите подробней?

Chelluga
07-03-2010, 23:36
Что у вас не работает конкретно? Может расскажите подробней? »
В шапке темы я нашел четире версии прогресс-бара. Обычный, с размером файлов, двойной и для внешних файлов. Последний я не стал трогать ибо не нужен.
Остальные пытался добавить к скрипту и в итоге - с размером и двойной вообще ничего не делают (не видать процентов и вообще изменений), а обычный стабильно показывает 0% при установке.
Скорее всего я чего-то не догоняю, что меня очень волнует.

Serega
08-03-2010, 00:47
В шапке темы я нашел четире версии прогресс-бара. »
Лучше всегда конкретика, т.е. ссылку на пример...
Вот вам простой пример:

[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
OutputDir=.
Compression=lzma/ultra
InternalCompressLevel=ultra
SolidCompression=yes

[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl

[Files]
Source: C:\Program Files\Inno Setup 5\*; DestDir: {app}; AfterInstall: Progress

[Code]
var
ProgressLabel, SizeLabel: TLabel;

procedure Progress;
var
size: Integer;
begin
with WizardForm.ProgressGauge do
ProgressLabel.Caption:= IntToStr((Position-Min)/((Max - Min)/100)) + ' %';
FileSize(ExpandConstant(CurrentFileName), size);
SizeLabel.Caption:= 'Размер ' + ExtractFileName(ExpandConstant(CurrentFileName)) + ': ' +
IntToStr(size) + ' байт';
end;

procedure InitializeWizard();
begin
ProgressLabel:= TLabel.Create(WizardForm);
with WizardForm.ProgressGauge do
begin
ProgressLabel.Top := Top + Height + ScaleY(8);
ProgressLabel.Left:= Left + Width/2 - ScaleX(8);
ProgressLabel.AutoSize := True;
ProgressLabel.Parent := WizardForm.InstallingPage;
end;
SizeLabel:= TLabel.Create(WizardForm);
with WizardForm.ProgressGauge do
begin
SizeLabel.Top := Top + Height + ScaleY(8);
SizeLabel.Left:= Left;
SizeLabel.AutoSize := True;
SizeLabel.Parent := WizardForm.InstallingPage;
end;
end;

South
08-03-2010, 01:01
Просто не поверите, я устал уже от FreeArc_Example.iss, обычно я игнорирую такие вопросы... »
та же кака на руборде, поэтому интерес к этим темам пропадает

ЗЫ сорри за оффтоп

A1EXXX
08-03-2010, 01:45
South, согласен. Тут благо "почище"... хотя видать не на долго... :(

Chelluga
08-03-2010, 12:03
Лучше всегда конкретика, т.е. ссылку на пример...
Вот вам простой пример: »
Ну не отображаются проценты. Ни в какую. Единственное, что приходит на ум: зависит ли отображение, этих самых процентов от темы в Винде? Если нет, тогда не знаю.

Serega
08-03-2010, 13:10
Единственное, что приходит на ум: зависит ли отображение, этих самых процентов от темы в Винде? »
Никак не зависит, т.е. вы компилируете приведённый мной пример, без изменений и у вас не отображаются проценты?
При этом используете стандартный, родной компилятор, без каких либо изменений...
Скажу сразу, что такого быть не может...

Chelluga
08-03-2010, 14:35
Никак не зависит, т.е. вы компилируете приведённый мной пример, без изменений и у вас не отображаются проценты?
При этом используете стандартный, родной компилятор, без каких либо изменений...
Скажу сразу, что такого быть не может... »
Я вставляю Ваш пример в мой скрипт (окромя названия и версии). Использую Инно 5.3.5. с ISPP. Никаких апгрейдов Инно не проводил. Проценты не отображаются.
(Сам скрипт сделал с помощью проги за авторством South + два скрипта почерпнутых в шапке (они работают). Соединял всё без Инновского Джойнера.

Serega
08-03-2010, 15:07
Я вставляю Ваш пример в мой скрипт (окромя названия и версии). »
Прежде чем заявлять, что тот или иной скрипт наработает, попробуйте сначала скомпилировать предложенный вам пример, без всяких изменений и уже после этого можно заявить, что тот или иной пример не работает.
Если же вы изначально, что-то пытаетесь с ним сделать или изменяете под себя и в результате компиляции он у вас не работает, то уж точно не стоит говорить, что пример не работает... а это обычный результат безграмотных действий и вопрос нужно ставить по другому:
В результате объединения того и этого скрипта у меня не работает то и то...
или
Я изменил данный скрипт и почему-то не идёт то… и то...
но в результате, всё равно нужно показать ваш скрипт, чтоб люди могли вам указать, где вы могли сделать ошибку.

Chelluga
08-03-2010, 15:45
Прежде чем заявлять, что тот или иной скрипт наработает, »
Я не говорил, что сам скрипт не работает. Я написал:
Ну не отображаются проценты. Ни в какую »

И что тогда? Выкладывать весь скрипт?? И у кого-то найдёться желание его просмотреть?

Serega
08-03-2010, 16:33
Я не говорил, что сам скрипт не работает. Я написал: »
Но до этого:
Все примеры, которые отрыл в шапке темы - либо не работают вообще, либо стабильно показывают 0%. »
и как это понимать?
И что тогда? Выкладывать весь скрипт?? »
Необязательно, просто закомментируйте 36 строку и исправьте ошибку в 38 строке и тогда всё будет окей ;)
И у кого-то найдёться желание его просмотреть? »
Так вы покажите, те места, где объёдинили скрипты...

Chelluga
08-03-2010, 16:44
Прошу прощения. Видимо мы друг друга недопоняли. Я ничуть не имел ввиду, что сами скрипты не работают. Я имел ввиду, что не работают они у меня.
Необязательно, просто закомментируйте 36 строку и исправьте ошибку в 38 строке и тогда всё будет окей »
Я нахимичил большой скрипт. Насоединял, точнее. В шапке я нашёл скрипт прогресс-бара
[Code]
var
ProgressLabel: TLabel;

procedure ExtLog();
begin
with WizardForm.ProgressGauge do begin
ProgressLabel.Caption:=IntToStr((Position-Min)/((Max - Min)/100)) + '%'
end
end;

procedure InitializeWizard4;
begin
ProgressLabel:=TLabel.Create(WizardForm)
with WizardForm.ProgressGauge do
begin
ProgressLabel.Top:=4
ProgressLabel.Left:=200
ProgressLabel.Caption:='0%'
ProgressLabel.AutoSize:=True
ProgressLabel.Font.Color:=clRed
ProgressLabel.Font.Style:=[fsBold]
ProgressLabel.Transparent:=True
ProgressLabel.Parent:=WizardForm.ProgressGauge
end;
end;
Он единственный выводит надпись, но эта надпись - стабильные 0%.
Собственно весь скрипт:

; Скрипт создан с помощью
; IS GameScript Generator by South
; специально для www.csmania.ru

[Setup]
SourceDir=.
OutputDir=Setup
AppName=Disciples III
AppVerName=Disciples III
AppVersion=1.04
AppPublisher=.dat
AppCopyright=.dat
AppPublisherURL=www.Chel-VasilOK.lamer
AppSupportURL=www.Chel-VasilOK.lamer
AppUpdatesURL=www.Chel-VasilOK.lamer
DefaultDirName={pf}\Disciples III
DefaultGroupName=Disciples III
AllowNoIcons=yes
InfoAfterFile=F:\Different\Техподдержка.txt
OutputBaseFilename=setup
WizardImageFile=F:\Different\Logo.bmp
WizardSmallImageFile=F:\Different\Disciples III.bmp
SetupIconFile=F:\Different\Disciples3.ico
WindowVisible=no
WindowShowCaption=no
WindowResizable=no
Compression=lzma/ultra
DiskSpanning=yes
DiskSliceSize=1073741824
SlicesPerDisk=1



[Languages]
Name: russian; MessagesFile: compiler:Languages\Russian.isl

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}

[Files]
Source: F:\Different\install.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0009.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0012.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0013.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0015.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0019.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0022.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0024.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0026.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0041.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0042.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0051.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0057.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0058.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0064.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0065.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0070.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0073.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0077.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\DisciplesIII 2010-01-22 16-37-13-17.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\DisciplesIII 2010-01-22 16-37-27-04.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\DisciplesIII 2010-01-22 16-38-49-14.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\DisciplesIII 2010-01-22 16-38-52-84.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\DisciplesIII 2010-01-22 16-39-03-42.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\DisciplesIII 2010-01-22 16-48-03-43.bmp; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\Disciples III 0023.jpg; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: isgsg.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: bass.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: innocallback.dll; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\elves_battle2.mp3; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\humans_battle1.mp3; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression
Source: F:\Different\humans_battle2.mp3; DestDir: {tmp}; Flags: ignoreversion dontcopy nocompression

Source: H:\Games\Akella Games\Disciples III\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension

[Icons]
Name: {group}\Disciples III; Filename: {app}\DisciplesIII.exe; WorkingDir: {app}
Name: {userdesktop}\Disciples III; Filename: {app}\DisciplesIII.exe; WorkingDir: {app}; Tasks: desktopicon
Name: {group}\{cm:UninstallProgram,Disciples III}; Filename: {uninstallexe}

[Registry]
Root: HKLM; SubKey: Software\Disciples III; ValueType: string; ValueName: Version; ValueData: 1.04; Flags: CreateValueIfDoesntExist UnInsClearValue deletevalue noerror
Root: HKLM; SubKey: Software\Disciples III; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: CreateValueIfDoesntExist UnInsClearValue deletevalue noerror

[Run]
Description: {cm:LaunchProgram, Disciples III}; Filename: {app}\DisciplesIII.exe; WorkingDir: {app}; Flags: nowait postinstall skipifsilent unchecked

[UninstallDelete]
Type: filesandordirs; Name: {app}

[Code]
type
HSTREAM=DWORD;
TTimerProc=procedure(uTimerID,uMessage:UINT;dwUser,dw1,dw2:DWORD);
const
Indent=25;
dURL=2;

var
URLLabel,URLLabelShadow:TLabel;
MP3List:TStringList;
CurrentMP3:integer;
hMP3:HWND;
TimerID:LongWord;

function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLongA@user32.dll stdcall delayload';
function ssInitialize(hParent:HWND;ssTimeShow:integer;FadeOut:boolean;StretchMode:integer;BkgColor:DWORD):boo lean; external 'ssInitialize@files:isgsg.dll stdcall delayload';
procedure ssDeInitialize; external 'ssDeInitialize@files:isgsg.dll stdcall delayload';
procedure ssSetBkgImage(FileName:PChar); external 'ssSetBkgImage@files:isgsg.dll stdcall delayload';
procedure ssAddImage(FileName:PChar); external 'ssAddImage@files:isgsg.dll stdcall delayload';
procedure ssStartShow; external 'ssStartShow@files:isgsg.dll stdcall delayload';
procedure ssStopShow; external 'ssStopShow@files:isgsg.dll stdcall delayload';
procedure ShowSplashScreen(p1:HWND;p2:string;p3,p4,p5,p6,p7:integer;p8:boolean;p9:Cardinal;p10:integer); external 'ShowSplashScreen@files:isgsg.dll stdcall delayload';
function GetSystemMetrics(nIndex:Integer):integer; external 'GetSystemMetrics@user32.dll stdcall delayload';
function SetTimer(hWnd:HWND;nIDEvent,uElapse:UINT;lpTimerFunc:LongWord{TFNTimerProc}):UINT; external 'SetTimer@user32.dll stdcall delayload';
function KillTimer(hWnd:HWND;uIDEvent:UINT):BOOL; external 'KillTimer@user32.dll stdcall delayload';
function BASS_ChannelIsActive(Handle:HWND):DWORD; external 'BASS_ChannelIsActive@files:bass.dll stdcall';
function BASS_SetConfig(Option,Value:DWORD):DWORD; external 'BASS_SetConfig@files:bass.dll stdcall';
function BASS_Init(Device:integer;Freq,Flags:DWORD;Win:HWND;CLSID:integer):boolean; external 'BASS_Init@files:bass.dll stdcall delayload';
function BASS_StreamCreateFile(Mem:BOOL;f:PChar;Offset:DWORD;Length:DWORD;Flags:DWORD):HSTREAM; external 'BASS_StreamCreateFile@files:bass.dll stdcall';
function BASS_StreamFree(Handle:HWND):boolean; external 'BASS_StreamFree@files:bass.dll stdcall';
function BASS_ChannelPlay(Handle:HWND;Restart:boolean):boolean; external 'BASS_ChannelPlay@files:bass.dll stdcall';
function BASS_Start: Boolean; external 'BASS_Start@files:bass.dll stdcall';
function BASS_Stop: Boolean; external 'BASS_Stop@files:bass.dll stdcall';
function BASS_Free: Boolean; external 'BASS_Free@files:bass.dll stdcall delayload';
function WrapTimerProc(CallBack:TTimerProc;ParamCount:integer):LongWord; external 'wrapcallback@files:innocallback.dll stdcall';

procedure TimerTick(uTimerID,uMessage:UINT;dwUser,dw1,dw2:DWORD);
begin
if BASS_ChannelIsActive(hMP3)=0 then begin
BASS_Stop;
BASS_StreamFree(hMP3);
hMP3:=BASS_StreamCreateFile(False,PChar(MP3List.Strings[CurrentMP3]),0,0,0);
BASS_Start;
if hMP3<>0 then
if BASS_ChannelPlay(hMP3,True) then begin
CurrentMP3:=CurrentMP3+1;
if CurrentMP3>MP3List.Count-1 then CurrentMP3:=0;
end;
end;
end;

procedure URLLabelClick(Sender: TObject);
var
ErrorCode:integer;
begin
ShellExec('open','www.Chel-VasilOK.lamer','','',SW_SHOWNORMAL,ewNoWait,ErrorCode);
end;

procedure URLLabelMouseDown(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top+dURL;
URLLabel.Left:=URLLabel.Left+dURL;
URLLabel.Font.Style:=URLLabel.Font.Style+[fsUnderline];
URLLabel.Font.Color:=clBlue;
URLLabelShadow.Visible:=False;
end;

procedure URLLabelMouseUp(Sender:TObject;Button:TMouseButton;Shift:TShiftState;X,Y:Integer);
begin
URLLabel.Top:=URLLabel.Top-dURL;
URLLabel.Left:=URLLabel.Left-dURL;
URLLabel.Font.Style:=URLLabel.Font.Style-[fsUnderline];
URLLabel.Font.Color:=clYellow;
URLLabelShadow.Visible:=True;
end;

function InitializeSetup1:boolean;
begin
ExtractTemporaryFile('elves_battle2.mp3');
ExtractTemporaryFile('humans_battle1.mp3');
ExtractTemporaryFile('humans_battle2.mp3');
MP3List:=TStringList.Create;
MP3List.Add(ExpandConstant('{tmp}')+'\elves_battle2.mp3');
MP3List.Add(ExpandConstant('{tmp}')+'\humans_battle1.mp3');
MP3List.Add(ExpandConstant('{tmp}')+'\humans_battle2.mp3');
CurrentMP3:=0;
Result:=True;
end;

procedure InitializeWizard1;
begin
URLLabelShadow:=TLabel.Create(WizardForm);
with URLLabelShadow do begin
Top:=ScaleY(331);
Left:=ScaleX(25);
Caption:='www.Chel-VasilOK.lamer';
AutoSize:=True;
Parent:=WizardForm;
Transparent:=True;
Font.Color:=$7FFFD4;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
end;
URLLabel:=TLabel.Create(WizardForm);
with URLLabel do begin
Top:=ScaleY(331)-dURL;
Left:=ScaleX(25)-dURL;
Caption:='www.Chel-VasilOK.lamer';
AutoSize:=True;
Parent:=WizardForm;
Cursor:=crHand;
Transparent:=True;
Font.Color:=clGreen;
Font.Size:=9;
Font.Style:=Font.Style+[fsBold];
BringToFront;
OnClick:=@URLLabelClick;
OnMouseDown:=@URLLabelMouseDown;
OnMouseUp:=@URLLabelMouseUp;
end;
ExtractTemporaryFile('Disciples III 0023.jpg');
ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\Disciples III 0023.jpg',1000,3000,1000,0,255,False,$FFFFFF,10);
TimerID:=SetTimer(0,0,500,WrapTimerProc(@TimerTick,5));
BASS_Init(-1,44100,0,0,0);
BASS_SetConfig(5,100);
BASS_SetConfig(6,100);
ssInitialize(GetWindowLong(MainForm.Handle,-8),10,True,2,$FF000000);
ExtractTemporaryFile('install.jpg');
ssSetBkgImage(ExpandConstant('{tmp}')+'\install.jpg');
end;

procedure CurStepChanged1(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin
ExtractTemporaryFile('Disciples III 0009.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0009.jpg');
ExtractTemporaryFile('Disciples III 0012.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0012.jpg');
ExtractTemporaryFile('Disciples III 0013.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0013.jpg');
ExtractTemporaryFile('Disciples III 0015.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0015.jpg');
ExtractTemporaryFile('Disciples III 0019.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0019.jpg');
ExtractTemporaryFile('Disciples III 0022.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0022.jpg');
ExtractTemporaryFile('Disciples III 0024.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0024.jpg');
ExtractTemporaryFile('Disciples III 0026.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0026.jpg');
ExtractTemporaryFile('Disciples III 0041.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0041.jpg');
ExtractTemporaryFile('Disciples III 0042.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0042.jpg');
ExtractTemporaryFile('Disciples III 0051.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0051.jpg');
ExtractTemporaryFile('Disciples III 0057.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0057.jpg');
ExtractTemporaryFile('Disciples III 0058.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0058.jpg');
ExtractTemporaryFile('Disciples III 0064.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0064.jpg');
ExtractTemporaryFile('Disciples III 0065.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0065.jpg');
ExtractTemporaryFile('Disciples III 0070.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0070.jpg');
ExtractTemporaryFile('Disciples III 0073.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0073.jpg');
ExtractTemporaryFile('Disciples III 0077.jpg');
ssAddImage(ExpandConstant('{tmp}')+'\Disciples III 0077.jpg');
ExtractTemporaryFile('DisciplesIII 2010-01-22 16-37-13-17.bmp');
ssAddImage(ExpandConstant('{tmp}')+'\DisciplesIII 2010-01-22 16-37-13-17.bmp');
ExtractTemporaryFile('DisciplesIII 2010-01-22 16-37-27-04.bmp');
ssAddImage(ExpandConstant('{tmp}')+'\DisciplesIII 2010-01-22 16-37-27-04.bmp');
ExtractTemporaryFile('DisciplesIII 2010-01-22 16-38-49-14.bmp');
ssAddImage(ExpandConstant('{tmp}')+'\DisciplesIII 2010-01-22 16-38-49-14.bmp');
ExtractTemporaryFile('DisciplesIII 2010-01-22 16-38-52-84.bmp');
ssAddImage(ExpandConstant('{tmp}')+'\DisciplesIII 2010-01-22 16-38-52-84.bmp');
ExtractTemporaryFile('DisciplesIII 2010-01-22 16-39-03-42.bmp');
ssAddImage(ExpandConstant('{tmp}')+'\DisciplesIII 2010-01-22 16-39-03-42.bmp');
ExtractTemporaryFile('DisciplesIII 2010-01-22 16-48-03-43.bmp');
ssAddImage(ExpandConstant('{tmp}')+'\DisciplesIII 2010-01-22 16-48-03-43.bmp');
ssStartShow;
end;
if CurStep=ssPostInstall then ssStopShow;
end;

procedure CurPageChanged1(CurPageID: Integer);
begin
if CurPageID=wpInstalling then begin
WizardForm.MainPanel.Visible:=False;
WizardForm.Bevel1.Visible:=False;
WizardForm.Width:=ScaleX(395);
WizardForm.Height:=ScaleY(142);
WizardForm.Left:=ScaleX(GetSystemMetrics(0)-WizardForm.Width-Indent);
WizardForm.Top:=ScaleY(GetSystemMetrics(1)-WizardForm.Height-Indent);
WizardForm.InnerNotebook.Left:=ScaleX(10);
WizardForm.InnerNotebook.Top:=ScaleY(10);
WizardForm.InnerNotebook.Width:=ScaleX(370);
WizardForm.StatusLabel.Left:=ScaleX(0);
WizardForm.StatusLabel.Top:=ScaleY(0);
WizardForm.StatusLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.FileNameLabel.Left:=ScaleX(0);
WizardForm.FileNameLabel.Top:=ScaleY(20);
WizardForm.FileNameLabel.Width:=WizardForm.InnerNotebook.Width;
WizardForm.ProgressGauge.Top:=ScaleY(40);
WizardForm.ProgressGauge.Width:=WizardForm.InnerNotebook.Width;
WizardForm.CancelButton.Left:=ScaleX(154);
WizardForm.CancelButton.Top:=ScaleY(80);
end;
if (CurPageID=wpFinished) or (CurPageID=wpInfoAfter) then begin
if WizardForm.Width<>502 then begin
WizardForm.Visible:=False;
WizardForm.Width:=ScaleX(502);
WizardForm.Height:=ScaleY(392);
WizardForm.Left:=(GetSystemMetrics(0)-WizardForm.Width) div 2;
WizardForm.Top:=(GetSystemMetrics(1)-WizardForm.Height) div 2;
WizardForm.MainPanel.Visible:=True;
WizardForm.Bevel1.Visible:=True;
WizardForm.InnerNotebook.Left:=ScaleX(40);
WizardForm.InnerNotebook.Top:=ScaleY(72);
WizardForm.InnerNotebook.Width:=ScaleX(417);
WizardForm.Visible:=True;
end;
end;
end;

procedure DeinitializeSetup1;
begin
KillTimer(0,TimerID);
BASS_Stop;
BASS_Free;
MP3List.Free;
ssDeInitialize;
end;

\\\\\тут был скрипт на проверку устройств, но пришлось вырезать из-за ограничения форума в 30000 символов\\\\\\

var
NeedSize:Integer;
FreeMB, TotalMB: Cardinal;
NeedSpaceLabel: TLabel;

VolumeName, FileSystemName: String;
VolumeSerialNo, MaxComponentLength, FileSystemFlags: Longint;
ListBox: TListBox;
StartMenuTreeView: TStartMenuFolderTreeView;

procedure GetFreeSpaceCaption(Sender: TObject);
var
Path: String;
begin
Path := ExtractFileDrive(WizardForm.DirEdit.Text);
GetSpaceOnDisk(Path, True, FreeMB, TotalMB);
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled := False else
WizardForm.NextButton.Enabled := True; end;

procedure GetNeedSpaceCaption;
begin
if NeedSize > 1024 then
NeedSpaceLabel.Caption := 'Требуется как минимум '+ FloatToStr(round(NeedSize/1024*100)/100) + ' Гб свободного дискового пространства.' else
NeedSpaceLabel.Caption := 'Требуется как минимум '+ IntToStr(NeedSize)+ ' Мб свободного дискового пространства.';end;


function GetLogicalDrives: DWord; external 'GetLogicalDrives@kernel32.dll stdcall';
function GetDriveType(nDrive: String): Longint; external 'GetDriveTypeA@kernel32.dll stdcall';
function GetVolumeInformation(PathName,VolumeName: PChar; VolumeNameSize,VolumeSerialNumber,MaxComponentLength,FileSystemFlags: Longint; FileSystemName: PChar; FileSystemNameSize: Longint): Longint; external 'GetVolumeInformationA@kernel32.dll stdcall';
function MessageBox(hWnd: Integer; lpText, lpCaption: String; uType: Cardinal): Integer; external 'MessageBoxA@user32.dll stdcall';

Function ByteOTB(Bytes: Extended; noMB: Boolean): String; { Перевод числа в значение бт/Кб/Мб/Гб/Тб (до 3х знаков после запятой)}
Begin
if not noMB then Result:= FloatToStr(Int(Bytes)) +' Мб' else
if Bytes < 1024 then Result:= FloatToStr(Int(Bytes)) +' Бт' else
if Bytes/1024 < 1024 then Result:= FloatToStr(round((Bytes/1024)*10)/10) +' Кб' else
If Bytes/oneMB < 1024 then Result:= FloatToStr(round(Bytes/oneMB*100)/100) +' Мб' else
If Bytes/oneMB/1000 < 1024 then Result:= FloatToStr(round(Bytes/oneMB/1024*1000)/1000) +' Гб' else
Result:= FloatToStr(round(Bytes/oneMB/oneMB*1000)/1000) +' Тб'
StringChange(Result, ',', '.')
End;

Function DellSP(String: String): String; { Удаление начальных, конечных и повторных пробелов }
Begin while (Pos(' ', String) > 0) do Delete(String, Pos(' ', String), 1); Result:= Trim(String); End;

Function CutString(String: String; MaxLength: Longint): String; { Обрезать строку до заданного кол-ва символов}
Begin
if Length(String) > MaxLength then Result:= Copy(String, 1, 6) +'...'+ Copy(String, Length(String) - MaxLength +9, MaxLength)
else Result:= String;
End;

Procedure GetDiskInfo(Disk: String);
Begin
FileSystemName:= StringOfChar(' ', 32); VolumeName:= StringOfChar(' ', 256);
GetVolumeInformation(Disk, VolumeName, 255, VolumeSerialNo, MaxComponentLength, FileSystemFlags, FileSystemName, 31);
FileSystemName:= DelSp(FileSystemName); VolumeName:= DelSp(VolumeName); if VolumeName='' then VolumeName:='без метки';
End;

Procedure ListBoxRefresh; var FreeB, TotalB: Cardinal; Path, String: string; Begin
ListBox.Items.Clear
for n:= 1 to 31 do // диск 'А' пропустить
if (GetLogicalDrives and (1 shl n)) > 0 then
if (GetDriveType(Chr(ord('A') + n) +':\') = 2) or (GetDriveType(Chr(ord('A') + n) +':\') = 3) then
if GetSpaceOnDisk(Chr(ord('A') + n) +':\', True, FreeMB, TotalMB) then ListBox.Items.Add(Chr(ord('A') + n) +':');
for n:= 0 to ListBox.Items.Count -1 do begin
Path:= Copy(ListBox.Items[n],1,2) +'\' { если в накопителе нет диска, пропустить обновление }
if GetSpaceOnDisk(Path, False, FreeB, TotalB) and GetSpaceOnDisk(Path, True, FreeMB, TotalMB) then begin GetDiskInfo(Path);
if FreeB >= $7FFFFFFF then String:= PadL(ByteOrTB(FreeMB*oneMB, true),10) else String:= PadL(ByteOrTB(FreeB, true),10);
if TotalB >= $7FFFFFFF then begin TotalB:= TotalMB; FreeB:= FreeMB; String:= PadL(ByteOrTB(TotalMB*oneMB, true),11) +' всего -'+ String end else String:= PadL(ByteOrTB(TotalB, true),11) +' всего| '+ String;
ListBox.Items[n]:= Copy(Path,1,2) + String + PadL(FloatToStr(round(FreeB/TotalB*100)),3)+ '% своб|'+ PadL(FileSystemName,5)+ '| '+ CutString(VolumeName,9); end; end;
End;

Procedure ObjectOnClick(Sender: TObject); Begin
Case TObject(Sender) of
ListBox: for n:= 0 to ListBox.Items.Count-1 do if ListBox.Selected[n] then WizardForm.DirEdit.Text:= Copy(ListBox.Items[n],1,1) +Copy(WizardForm.DirEdit.Text, 2, Length(WizardForm.DirEdit.Text))
StartMenuTreeView: if StartMenuTreeView.Directory <> '' then WizardForm.GroupEdit.Text:= StartMenuTreeView.Directory else WizardForm.GroupEdit.Text:= '{#SetupSetting("DefaultGroupName")}'
WizardForm.NoIconsCheck: begin WizardForm.GroupEdit.Enabled:= not(WizardForm.GroupEdit.Enabled); StartMenuTreeView.Enabled:= WizardForm.GroupEdit.Enabled; WizardForm.GroupBrowseButton.Enabled:= WizardForm.GroupEdit.Enabled end;
end; End;

procedure InitializeWizard3();
begin
NeedSize := 6100; //Здесь указывается место для приложения
WizardForm.DiskSpaceLabel.Hide;
NeedSpaceLabel := TLabel.Create(WizardForm);
with NeedSpaceLabel do
begin
Parent := WizardForm.SelectDirPage;
Left := ScaleX(0);
Top := ScaleY(220);
Width := ScaleX(209);
Height := ScaleY(13);
end;
ListBox:= TListBox.Create(WizardForm)
ListBox.SetBounds(WizardForm.DirEdit.Left, WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 8, WizardForm.DirBrowseButton.Left + WizardForm.DirBrowseButton.Width - WizardForm.DirEdit.Left, WizardForm.DiskSpaceLabel.Top - (WizardForm.DirEdit.Top + WizardForm.DirEdit.Height + 12))
ListBox.Font.Size:= 9
ListBox.Font.Style:= []
ListBox.Font.Name:= 'Courier New';
ListBox.OnClick:= @ObjectOnClick;
ListBox.Parent:= WizardForm.SelectDirPage;
WizardForm.DirEdit.OnChange := @GetFreeSpaceCaption;
WizardForm.DirEdit.Text := WizardForm.DirEdit.Text + #0;
end;

procedure CurPageChanged3(CurPageID: Integer);
begin
if CurPageID=wpSelectDir then
begin
GetNeedSpaceCaption;
if FreeMB < NeedSize then
WizardForm.NextButton.Enabled:=False
ListBoxRefresh
end;
end;

[Files]
Source: H:\Games\Akella Games\Disciples III\Disciples III\*; 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)) + '%'
end
end;

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





function InitializeSetup(): Boolean;
begin
Result := InitializeSetup1(); if not Result then exit;
end;

procedure InitializeWizard();
begin
InitializeWizard1();
InitializeWizard2();
InitializeWizard3();
InitializeWizard4();
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
CurStepChanged1(CurStep);

end;

procedure CurPageChanged(CurPageID: Integer);
begin
CurPageChanged1(CurPageID);
CurPageChanged2(CurPageID);
CurPageChanged3(CurPageID);
end;

procedure DeinitializeSetup();
begin
DeinitializeSetup1();
end;

Serega
08-03-2010, 17:03
Я нахимичил большой скрипт. »
Просто напросто, вы не совсем внимательно изучили пример, а именно добавьте ссылку на procedure ExtLog(); в секцию [Files], т.е.:

..........................
[Files]
..........................
Source: H:\Games\Akella Games\Disciples III\*; DestDir: {app}; AfterInstall: ExtLog; Flags: ignoreversion recursesubdirs createallsubdirs sortfilesbyextension
..........................

Chelluga
08-03-2010, 17:22
Всё это есть, там где и весь код примера. Но на всяк поставил в начало...и оно заработало. Жииеесть. Весь косяк, точнее все неработающие (у меня) скрипты не работали только потому, что это: "AfterInstall: ExtLog;" и ему подобное я ставил в конце а не в начале.

В любом случае спасибо Вам за помощь.

alex2010
08-03-2010, 18:42
а как сделать так, как у RG Механики?(если можно только код для вставки изображения)
http://s57.radikal.ru/i157/1002/94/a62770aad612t.jpg (http://radikal.ru/F/s57.radikal.ru/i157/1002/94/a62770aad612.png.html)

Cartmans
08-03-2010, 18:44
Вопрос:
что нужно делать что бы добиться максимального сжатия, но при этом что бы при распаковке требовало 1ГБ. Была игра, весила 6.17 ГБ, получилось ужать только до 5.36ГБ, но это очень мало, другие ужимали эту игру до 3ГБ

Выше сказанное о FreeArc'e




© OSzone.net 2001-2012