Новый участник
Сообщения: 20
Благодарности: 1
|
Профиль
|
Отправить PM
| Цитировать
Прошу прощения. Видимо мы друг друга недопоняли. Я ничуть не имел ввиду, что сами скрипты не работают. Я имел ввиду, что не работают они у меня.
Цитата Serega:
Необязательно, просто закомментируйте 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;
|