Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  | Правила  

Компьютерный форум OSzone.net » Автоматическая установка Windows » Автоматическая установка приложений » Скрипты Inno Setup. Помощь и советы [часть 6]

Закрытая тема
Настройки темы
Скрипты Inno Setup. Помощь и советы [часть 6]

Аватара для El Sanchez

Ветеран


Contributor


Сообщения: 1274
Благодарности: 1030


Конфигурация

Профиль | Отправить PM | Цитировать


Изменения
Автор: El Sanchez
Дата: 16-02-2015
Внимание! Данная тема предназначена только для обсуждения написания скриптов !
Остальные вопросы, а также последние версии компилятора в теме
Inno Setup. Прочие вопросы.


Показать/скрыть: Справка, руководство, примеры:
Показать/скрыть: Ссылки на примеры скриптов:
Показать/скрыть: Дополнительные программы для Inno Setup:
  • ISTool - неплохой редактор скриптов Inno Setup.
    Последняя версия: 5.3.0.1 [29.09.2009] - Скачать | зеркало;

  • Inno Script Generator - генератор скриптов Inno Setup. Обладает некоторыми полезными функциями, которых нет ни у самого Inno Setup, ни у ISTool.
    Последняя версия: 1.0.3.1 [23.03.2008] - Скачать | зеркало на русифицированную программу;
    Примечание: Родной сайт www.hisoft2000.de более недоступен, поэтому здесь расположены сторонние ссылки.

  • Inno Setup Form Designer - редактор страниц Inno Setup, можно создавать свои страницы.
    Последняя версия: 2.0.8 [12.11.2006] - Скачать;
    Примечание: Родной сайт http://isfd.kaju74.de/index.php?isfd более недоступен, поэтому здесь расположены сторонние ссылки.

  • Inno Setup GameScript Generator - программа генерирует скрипты для Inno Setup . С помощью GameScript Generator и Inno Setup вы сможете быстро создать простенький инсталляционный пакет для любой игры. В инсталлятор можно встроить музыку, слайдшоу и фоновый рисунок. Для специалистов созданный скрипт, возможно, будет неплохой заготовкой для дальнейшей модернизации;

  • ISSkin - Программа для создания и добавления в инсталлятор скинов. Инструкция.
    Последняя версия: 3.0.0.0 [19.01.2010] - Скачать;

  • ISSJoiner - Программа для объединения нескольких скриптов InnoSetup в один.
    Последняя версия: 3.0 [23.07.2009]

  • Converter - Программа конвертирует reg-файлы в формат *.iss (формат скриптов Inno Setup).
    Последняя версия: 0.1.4 [13.03.2010] - Скачать;


Предыдущие ветки обсуждения по ссылкам ниже и в прикреплённых архивах:

Отправлено: 19:06, 28-03-2013

 

SHVtYW4=


Сообщения: 3451
Благодарности: 1273

Профиль | Отправить PM | Цитировать


Ещё, Farser21,
читать дальше »
Цитата saurn:
(пакуемые файлы не нужны) »
Я изначально туда вставил
Код: Выделить весь код
#define Files

#ifdef Files
#endif
Код: Выделить весь код
#define Files

#ifdef Files
[Files]
#endif
не везде.

При комментировании
Код: Выделить весь код
//#define Files
файлы становятся не активны и не входят в сборку при компиляции. Для проверки компиляции это хорошо, т.к для себя лишний раз не нужно ждать когда все файлы войдут в сборку. А для других (кто проверяет твой скрипт), если нет файлов, то не выдаст ошибку что файл не найден.

-------
09a468a9b4293cd82adf6d6c60a9da82 | Tm9yZGVr
В связи со сменой железа и переходом на LInux с полным отказом от Windows - посещение на форуме будет редким.


Отправлено: 13:36, 26-10-2013 | #1371



Для отключения данного рекламного блока вам необходимо зарегистрироваться или войти с учетной записью социальной сети.

Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля.


Аватара для Dinvin4ester

Старожил


Сообщения: 229
Благодарности: 0

Профиль | Отправить PM | Цитировать


А мне не поможете ?

Отправлено: 00:45, 27-10-2013 | #1372


Ветеран


Сообщения: 517
Благодарности: 314

Профиль | Отправить PM | Цитировать


Цитата Dinvin4ester:
сделать музыку по умолчанию , а то при запуске и когда установка идет ее не выключить »
читать дальше »
Код: Выделить весь код
[Code]
{ RedesignWizardFormBegin } // Не удалять эту строку!
// Не изменять эту секцию. Она создана автоматически.
procedure RedesignWizardForm;
begin
  with WizardForm.DiskSpaceLabel do
  begin
    Left := ScaleX(-416);
    Top := ScaleY(200);
    Height := ScaleY(46);
  end;

{ ReservationBegin }
  // Вы можете добавить ваш код здесь.

{ ReservationEnd }
end;
// Не изменять эту секцию. Она создана автоматически.
{ RedesignWizardFormEnd } // Не удалять эту строку!

const
  PCFonFLY=true;
  notPCFonFLY=false;
  BASS_SAMPLE_LOOP = 4; //повторение

var
  LabelPct1,LabelTime1,LabelTime2,LabelTime3,FinishedLbl: TLabel;
#ifdef SecondProgressBar
  LabelPct2: TLabel;
  ISDoneProgressBar2:TNewProgressBar;
#endif
  ISDoneCancel, i, CurrentPicture:integer;
  ISDoneError:boolean;
  PCFVer:double;
  TimerID: LongWord;
  PicList: TStringlist;
  BackgroundForm: TForm;
  MusicButton, VolumeUP, VolumeDown, MyButton: TButton;
  VolumeInd: TNewProgressBar;
  BackgroundBitmapImage: TBitmapImage;
  s, Name, ResultStr: string;
  Ver, VerREG : Cardinal;

type
  TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
  TProc=procedure(HandleW, msg, idEvent, TimeSys: LongWord);

function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';

function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';
function IS7ZipExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'IS7zipExtract@files:ISDone.dll stdcall delayload';
function ISRarExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath: AnsiString; DeleteInFile:boolean; Password: AnsiString):boolean; external 'ISRarExtract@files:ISDone.dll stdcall delayload';
function ISPrecompExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISPrecompExtract@files:ISDone.dll stdcall delayload';
function ISSRepExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString; DeleteInFile:boolean):boolean; external 'ISSrepExtract@files:ISDone.dll stdcall delayload';
function ISxDeltaExtract(CurComponent:Cardinal; PctOfTotal:double; minRAM,maxRAM:integer; InName, DiffFile, OutFile: AnsiString; DeleteInFile, DeleteDiffFile:boolean):boolean; external 'ISxDeltaExtract@files:ISDone.dll stdcall delayload';
function ISPackZIP(CurComponent:Cardinal; PctOfTotal:double; InName, OutFile: AnsiString;ComprLvl:integer; DeleteInFile:boolean):boolean; external 'ISPackZIP@files:ISDone.dll stdcall delayload';
function ShowChangeDiskWindow(Text, DefaultPath, SearchFile:AnsiString):boolean; external 'ShowChangeDiskWindow@files:ISDone.dll stdcall delayload';

function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';
function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';
function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';
function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';
function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';
function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString;Show:boolean):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';

function SrepInit(TmpPath:PAnsiChar;VirtMem,MaxSave:Cardinal):boolean; external 'SrepInit@files:ISDone.dll stdcall delayload';
function PrecompInit(TmpPath:PAnsiChar;VirtMem:cardinal;PrecompVers:single):boolean; external 'PrecompInit@files:ISDone.dll stdcall delayload';
function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';
function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';
function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';
function ChangeLanguage(Language:AnsiString):boolean; external 'ChangeLanguage@files:ISDone.dll stdcall delayload';
function SuspendProc:boolean; external 'SuspendProc@files:ISDone.dll stdcall';
function ResumeProc:boolean; external 'ResumeProc@files:ISDone.dll stdcall';

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 WrapTimerProc(callback:TProc; paramcount:integer):longword; external 'wrapcallback@files:innocallback.dll stdcall';
function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall';
function GetSystemMetrics(nIndex:Integer):Integer; external 'GetSystemMetrics@user32.dll stdcall';
procedure InitializeSlideShow(Hwnd:Thandle; l,t,w,h:integer;Animate:boolean; Stretch:integer); external 'InitializeSlideShow@files:isslideshow.dll stdcall';
procedure DeinitializeSlideShow; external 'DeinitializeSlideShow@files:isslideshow.dll stdcall';
procedure ShowImage(ipath:PAnsiChar; Effect:integer); external 'ShowImage@files:isslideshow.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): DWORD; external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload';
function BASS_Start(): Boolean; external 'BASS_Start@files:BASS.dll stdcall delayload';
function BASS_Pause(): Boolean; external 'BASS_Pause@files:BASS.dll stdcall delayload';
function BASS_SetVolume(volume: DWORD): BOOL; external 'BASS_SetVolume@files:BASS.dll stdcall delayload';
function BASS_GetVolume: Integer; external 'BASS_GetVolume@files:BASS.dll stdcall delayload';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean; external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload';
function BASS_Stop(): Boolean; external 'BASS_Stop@files:BASS.dll stdcall delayload';
function BASS_Free(): Boolean; external 'BASS_Free@files:BASS.dll stdcall delayload';


// Процедуры работы со скинами
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 KillTask(ExeFileName: string): Integer; external 'KillTask@files:ISTask.dll stdcall delayload';
function RunTask(FileName: string; bFullpath: Boolean): Boolean; external 'RunTask@files:ISTask.dll stdcall delayload';

function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
  if OveralPct<=1000 then WizardForm.ProgressGauge.Position := OveralPct div 10;
  LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
#ifdef SecondProgressBar
  if CurrentPct<=1000 then ISDoneProgressBar2.Position := CurrentPct;
  LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';
#endif
  WizardForm.FilenameLabel.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, WizardForm.FilenameLabel.Font, WizardForm.FilenameLabel.Width-ScaleX(100));
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  //LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1; // при необходимости раскоментировать
  LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
  Result := ISDoneCancel;
end;

procedure CancelButtonOnClick(Sender: TObject);
begin
  SuspendProc;
  if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;
  ResumeProc;
end;

//Кнопка вкл.\выкл. музыки
procedure MusicButtonOnClick(Sender: TObject);
begin
    case TButton(Sender).Caption of
        'Play':
        begin
            BASS_Start;
            MusicButton.Caption := 'Stop';
        end;
        'Stop':
        begin
            BASS_Pause;
            MusicButton.Caption := 'Play';
        end;
    end;
end;

// увеличения громкости
procedure VolumeUPOnClick(Sender: TObject);
var
vol : integer;
begin
  vol := BASS_GetVolume;
  if vol+5 >= 100 then // Увеличение громкости по 5 едини.... пример (vol+5) - (vol+10) и.т.д.
  begin
    BASS_SETVolume(100);
    VolumeIND.position := 100;
     VolumeUP.Enabled := False; 
  end else
  begin
    BASS_SETVolume(vol+5);
    VolumeIND.position := vol+5;
    VolumeDOWN.Enabled := True;
  end;
end;

// уменьшение громкости
procedure VolumeDOWNOnClick(Sender: TObject);
var
vol : integer;
begin
  vol := BASS_GetVolume;
  if vol-5 <= 0 then
  begin
    BASS_SETVolume(0);
    VolumeIND.position := 0;
    VolumeDOWN.Enabled := False; 
  end else
  begin
    BASS_SETVolume(vol-5);
    VolumeIND.position := vol-5;
    VolumeUP.Enabled := True;
  end;
end;

procedure InitMusic();
begin
  ExtractTemporaryFile('BASS.dll');
  ExtractTemporaryFile('music.mp3');
  if BASS_Init(-1, 44100, 0, 0, 0) then
  begin
    BASS_Start();
    Name:=ExpandConstant('{tmp}\music.mp3');
    i:=BASS_StreamCreateFile(FALSE, PChar(Name), 0, 0, 4);
    if i <> 0 then
    begin
     BASS_ChannelPlay(i, True);
    end;
  end;
  
  // Music Button on/off
  MusicButton := TButton.Create(WizardForm);
  with MusicButton do
  begin
    Left := 4//WizardForm.ClientWidth - WizardForm.CancelButton.Left - WizardForm.CancelButton.Width;
    Top := 337//WizardForm.CancelButton.Top;
    Width := 131//WizardForm.CancelButton.Height;
    Height := 17//WizardForm.CancelButton.Height;
    Caption := 'Play';
    Hint := 'Вкл.\Выкл. музыку';
    ShowHint := True;
    OnClick := @MusicButtonOnClick;
    Parent := WizardForm;
  end;
  
  if MusicButton.Caption = 'Stop' then BASS_Start else BASS_Pause;
end;

/////////////////////////////////////////////////////////////////////////////////////////////////
procedure InitializeWizard();
begin
  InitMusic();
  RedesignWizardForm;
  with WizardForm do
  begin
    ExtractTemporaryFile('folder.bmp');
    SelectDirBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\folder.bmp');
    SelectDirBitmapImage.SetBounds(0,0,42,42);
    ExtractTemporaryFile('folder1.bmp');
    SelectGroupBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\folder1.bmp')
    SelectGroupBitmapImage.SetBounds(0,0,42,42);
    ExtractTemporaryFile('img1.bmp');
    WizardBitmapImage.SetBounds(0,0,500,313);
    WizardBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\img1.bmp'));
    ExtractTemporaryFile('img2.bmp');
    WizardBitmapImage2.SetBounds(0,0,500,313);
    WizardBitmapImage2.Bitmap.LoadFromFile(ExpandConstant('{tmp}\img2.bmp'));
    WizardSmallBitmapImage.SetBounds(0,0,497,58);
    PageNameLabel.Hide; //Del, если нужно вернуть текст
    PageDescriptionLabel.Hide; //Del, если нужно вернуть текст
  end;

  //WelcomePage,
  with TLabel.Create(WizardForm) do
  begin
    Left:= ScaleX(100);
    Top:= ScaleY(7);
    Width:= ScaleX(300);
    Height:= ScaleY(80);
    AutoSize:= false;
    Alignment := taCenter;
    Transparent:= true;
    WordWrap:= true;
    Font.Size:= 14;
    Font.Color:=ClWhite
    Font.Style := [fsBold]
    Parent:= WizardForm.WelcomePage;
    Font.Name:= 'Georgia'
    //Caption:= WizardForm.WelcomeLabel1.Caption;
  end;

  with TLabel.Create(WizardForm) do
  begin
    Top:= ScaleY(245);
    Left:= ScaleX(25);
    Width:= ScaleX(450);
    Height:= ScaleY(270);
    AutoSize:= false;
    Alignment := taCenter;
    WordWrap:= true;
    Font.Color:=ClWhite
    Font.Name:= 'Georgia'
    Font.Size:= 10;
    Transparent:= true;
    Parent:= WizardForm.WelcomePage;
    //Caption:= ExpandConstant('{cm:Welcome2}');
  end;

  with TLabel.Create(WizardForm) do
  begin
    Left:= ScaleX(100);
    Top:= ScaleY(7);
    Width:= ScaleX(300);
    Height:= ScaleY(80);
    AutoSize:= false;
    Alignment := taCenter;
    WordWrap:= true;
    Font.Size:= 14;
    Font.Color:=ClWhite
    Font.Name:= 'Georgia'
    Font.Style := [fsBold]
    Transparent:= true;
    Parent:= WizardForm.FinishedPage;
    //Caption:= WizardForm.FinishedHeadingLabel.Caption;
  end;

  FinishedLbl:= TLabel.Create(WizardForm);
  with FinishedLbl do
  begin
    Left:= ScaleX(25);
    Top:= ScaleY(245);
    Width:= ScaleX(450);
    Height:= ScaleY(160);
    AutoSize:= false;
    Alignment := taCenter;
    WordWrap:= true;
    Transparent:= true;
    Font.Color:=ClWhite
    Font.Size:= 10;
    Font.Name:= 'Georgia'
    Parent:= WizardForm.FinishedPage;
    //Caption:= ExpandConstant('{cm:Finished2}');
  end;

  LabelPct1 := TLabel.Create(WizardForm);
  with LabelPct1 do begin
    Parent    := WizardForm.InstallingPage;
    AutoSize  := False;
    Left      := WizardForm.ProgressGauge.Width+ScaleX(5);
    Top       := WizardForm.ProgressGauge.Top + ScaleY(2);
    Width     := ScaleX(80);
  end;
#ifdef SecondProgressBar
  ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);
  with ISDoneProgressBar2 do begin
    Parent   := WizardForm.InstallingPage;
    Left     := ScaleX(0);
    Top      := ScaleY(83);
    Width    := WizardForm.ProgressGauge.Width;
    Max      := 1000;
    Height   := WizardForm.ProgressGauge.Height;
  end;
  LabelPct2 := TLabel.Create(WizardForm);
  with LabelPct2 do begin
    Parent    := WizardForm.InstallingPage;
    AutoSize  := False;
    Left      := ISDoneProgressBar2.Width+ScaleX(5);
    Top       := ISDoneProgressBar2.Top + ScaleY(2);
    Width     := ScaleX(80);
  end;
#endif
  LabelTime1 := TLabel.Create(WizardForm);
  with LabelTime1 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := WizardForm.ProgressGauge.Width div 2;
    Left     := ScaleX(0);
    Top      := ScaleY(85);
  end;
  LabelTime2 := TLabel.Create(WizardForm);
  with LabelTime2 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := LabelTime1.Width+ScaleX(40);
    Left     := 280;
    Top      := LabelTime1.Top;
  end;
  LabelTime3 := TLabel.Create(WizardForm);
  with LabelTime3 do begin
    Parent   := WizardForm.FinishedPage;
    AutoSize := False;
    Width    := 300;
    Left     := 180;
    Top      := 200;
  end;
  //==splash
//  ExtractTemporaryFile('splash.png');
//  ShowSplashScreen(WizardForm.Handle,ExpandConstant('{tmp}')+'\splash.png',1000,3000,1000,0,255,False,$FFFFFF,10);
//  //==slides
//  BackgroundForm:= TForm.Create(nil);
//  BackgroundForm.BorderStyle:= bsNone;
//  BackgroundForm.Color:=clBlack;
//  BackgroundForm.SetBounds(0, 0, GetSystemMetrics(0), GetSystemMetrics(1))
//  BackgroundForm.Visible:=True;
//  BackgroundForm.enabled:= false;
//  PicList:=tstringlist.Create;
//  ExtractTemporaryFile('0.jpg');
//  piclist.add(ExpandConstant('{tmp}') + '\1.jpg');
//  BackgroundForm.show;
//  InitializeSlideShow(BackgroundForm.Handle, 0, 0, GetSystemMetrics(0), GetSystemMetrics(1), false, 1);
//  ShowImage(ExpandConstant('{tmp}') + '\0.jpg', 1);

//Volum up
  VolumeDown := TButton.Create(WizardForm);
  with VolumeDown do
  begin
    Left := 4
    Top := 318
    Width := WizardForm.CancelButton.Height;
    Height := 17
    Caption := '-';
    Hint := 'Убавить громкость';
    ShowHint := True;
    OnClick := @VolumeDOWNOnClick;
    Parent := WizardForm;
  end;

//Volum down
  VolumeUP := TButton.Create(WizardForm);
  with VolumeUP do
  begin
    Left := 112//WizardForm.ClientWidth - WizardForm.CancelButton.Left - WizardForm.CancelButton.Width + MusicButton.Width + VolumeDown.Width;
    Top := 318
    Width := WizardForm.CancelButton.Height;
    Height := 17
    Caption := '+';
    Hint := 'Прибавить громкость';
    ShowHint := True;
    OnClick := @VolumeUPOnClick;
    Parent := WizardForm;
  end;

  VolumeIND := TNewProgressBar.Create(WizardForm);
  with VolumeIND do
  begin
    Parent := WizardForm;
    Left := 30//WizardForm.ClientWidth - WizardForm.CancelButton.Left - WizardForm.CancelButton.Width + MusicButton.Width + VolumeUP.Width + VolumeDown.Width;
    Top := 320//WizardForm.CancelButton.Top;
    Width := 80//WizardForm.CancelButton.Width;
    Height := 14//WizardForm.CancelButton.Height;
    Min := 0;
    Max := 100;
    Position := BASS_GetVolume;
  end;

  if BASS_GetVolume >= 100 then volumeUP.Enabled := False;
  if BASS_GetVolume <= 0 then volumeDOWN.Enabled := False;
end;

//  ***********  Конец для управления музыкой

//procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
//begin
// CurrentPicture:=CurrentPicture+1;
// if CurrentPicture=piclist.count+1 then CurrentPicture:=1;
//  ShowImage(piclist.strings[CurrentPicture - 1], 1);
//end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
  WizardForm.WelcomeLabel1.Hide;
  WizardForm.WelcomeLabel2.Hide;
  WizardForm.FinishedHeadingLabel.Hide;
  WizardForm.FinishedLabel.Hide;
  Case CurPageID of
  wpInstalling:
   begin
    CurrentPicture:=1;
    with WizardForm do
     begin
      hide;
      MainPanel.Visible:=False;
      Bevel1.Visible:=False;
      setbounds(ScaleX(GetSystemMetrics(0)-420), ScaleY(GetSystemMetrics(1)-167), ScaleX(395), ScaleY(142));
      InnerNotebook.setbounds(ScaleX(10), ScaleY(10), ScaleX(370), InnerNotebook.height);
      StatusLabel.setbounds(ScaleX(0), ScaleY(0), InnerNotebook.Width, StatusLabel.height);
      FileNameLabel.setbounds(ScaleX(0), ScaleY(15), InnerNotebook.Width, FileNameLabel.height);
      ProgressGauge.Top:=ScaleY(40);
      ProgressGauge.Width:=InnerNotebook.Width;
      CancelButton.Left:=ScaleX(154);
      CancelButton.Top:=ScaleY(82);
      CancelButton.bringtofront;
      show;
     end;
//    ShowImage(piclist.strings[CurrentPicture - 1], 1);
//    TimerID:=SetTimer(0, 0, 6000, WrapTimerProc(@OnTimer, 4));
   end;
  wpFinished:
  begin
    LabelTime3.Hide;
    WizardForm.Visible:=False;
    WizardForm.setbounds((GetSystemMetrics(0)-WizardForm.Width) div 2, (GetSystemMetrics(1)-WizardForm.Height) div 2, ScaleX(502), ScaleY(392));
    WizardForm.Visible:=True;
    KillTimer(0, TimerID);
//    showimage(ExpandConstant('{tmp}') + '\0.jpg', 1);
  if ISDoneError then
  begin
    LabelTime3.Hide;
    WizardForm.Caption:= ExpandConstant('{cm:Error}');
    FinishedLbl.Font.Color:= clRed;
    FinishedLbl.Caption:= SetupMessage(msgSetupAborted) ;
  end;
  end;
 end;
end;

function InitializeSetup(): Boolean;
begin
  ExtractTemporaryFile('Tiger.cjstyles');
  LoadSkin(ExpandConstant('{tmp}\Tiger.cjstyles'), '');
  Result := True;
end;

procedure DeinitializeSetup();
begin
 DeinitializeSlideShow;
 KillTimer(0, TimerID);
 BASS_Stop(); 
 BASS_Free(); 
 ShowWindow(StrToInt(ExpandConstant('{wizardhwnd}')), 0);
UnloadSkin();
end;

function CheckError:boolean;
begin
  result:= not ISDoneError;
end;

procedure CurStepChanged(CurStep: TSetupStep);
var Comps1,Comps2,Comps3, TmpValue:cardinal;
    FindHandle1,ColFiles1,CurIndex1,tmp:integer;
    ExecError:boolean;
    InFilePath,OutFilePath,OutFileName:PAnsiChar;
begin
  if CurStep = ssInstall then begin  //Если необходимо, можно поменять на ssPostInstall
    WizardForm.CancelButton.OnClick:= @CancelButtonOnClick;
    WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');
    ISDoneCancel:=0;

// Распаковка всех необходимых файлов в папку {tmp}.

ExtractTemporaryFile('unarc.dll');

#ifdef PrecompInside
ExtractTemporaryFile('CLS-precomp.dll');
ExtractTemporaryFile('packjpg_dll.dll');
ExtractTemporaryFile('packjpg_dll1.dll');
ExtractTemporaryFile('precomp.exe');
ExtractTemporaryFile('zlib1.dll');
#endif
#ifdef SrepInside
ExtractTemporaryFile('CLS-srep.dll');
#endif
#ifdef MSCInside
ExtractTemporaryFile('CLS-MSC.dll');
#endif
#ifdef facompress
    ExtractTemporaryFile('facompress.dll'); 
#endif
#ifdef records
    ExtractTemporaryFile('records.inf');
#endif
#ifdef precomp
  #if precomp == "0.38"
    ExtractTemporaryFile('precomp038.exe');
  #else
    #if precomp == "0.4"
      ExtractTemporaryFile('precomp040.exe');
    #else
      #if precomp == "0.41"
        ExtractTemporaryFile('precomp041.exe');
      #else
        #if precomp == "0.42"
          ExtractTemporaryFile('precomp042.exe');
        #else
          ExtractTemporaryFile('precomp038.exe');
          ExtractTemporaryFile('precomp040.exe');
          ExtractTemporaryFile('precomp041.exe');
          ExtractTemporaryFile('precomp042.exe');
        #endif
      #endif
    #endif
  #endif
#endif
#ifdef unrar
    ExtractTemporaryFile('Unrar.dll');
#endif
#ifdef XDelta
    ExtractTemporaryFile('XDelta3.dll');
#endif
#ifdef PackZIP
    ExtractTemporaryFile('7z.dll');
    ExtractTemporaryFile('PackZIP.exe');
#endif

    ExtractTemporaryFile('English.ini');

// Подготавливаем переменную, содержащую всю информацию о выделенных компонентах для ISDone.dll
// максимум 96 компонентов.
    Comps1:=0; Comps2:=0; Comps3:=0;
#ifdef Components
    TmpValue:=1;
    if IsComponentSelected('text\rus') then Comps1:=Comps1+TmpValue;     //компонент 1
    TmpValue:=TmpValue*2;
    if IsComponentSelected('text\eng') then Comps1:=Comps1+TmpValue;     //компонент 2
    TmpValue:=TmpValue*2;
    if IsComponentSelected('voice\rus') then Comps1:=Comps1+TmpValue;    //компонент 3
    TmpValue:=TmpValue*2;
    if IsComponentSelected('voice\eng') then Comps1:=Comps1+TmpValue;    //компонент 4
//    .....
// см. справку
#endif

#ifdef precomp
  PCFVer:={#precomp};
#else
  PCFVer:=0;
#endif
    ISDoneError:=true;
    if ISDoneInit(ExpandConstant('{src}\records.inf'), $F444, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin
      repeat
//        ChangeLanguage('English');
        if not SrepInit('',512,0) then break;
        if not PrecompInit('',128,PCFVer) then break;
        if not FileSearchInit(true) then break;

        //if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data1.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        //if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data2.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        //if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data3.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        //if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data4.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        //if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data5.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;
        //if not ISArcExtract ( 0, 0, ExpandConstant('{src}\data6.bin'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

//    далее находятся закомментированые примеры различных функций распаковки (чтобы каждый раз не лазить в справку за примерами)
(*
        if not ISArcExtract    ( 0, 0, ExpandConstant('{src}\arc.arc'), ExpandConstant('{app}\'), '', false, '', ExpandConstant('{tmp}\arc.ini'), ExpandConstant('{app}\'), notPCFonFLY{PCFonFLY}) then break;
        if not IS7ZipExtract   ( 0, 0, ExpandConstant('{src}\CODMW2.7z'), ExpandConstant('{app}\data1'), false, '') then break;
        if not ISRarExtract    ( 0, 0, ExpandConstant('{src}\data_*.rar'), ExpandConstant('{app}'), false, '') then break;
        if not ISSRepExtract   ( 0, 0, ExpandConstant('{app}\data1024_1024.srep'),ExpandConstant('{app}\data1024.arc'), true) then break;
        if not ISPrecompExtract( 0, 0, ExpandConstant('{app}\data.pcf'),    ExpandConstant('{app}\data.7z'), true) then break;
        if not ISxDeltaExtract ( 0, 0, 0, 640, ExpandConstant('{app}\in.pcf'), ExpandConstant('{app}\*.diff'),   ExpandConstant('{app}\out.dat'), false, false) then break;
        if not ISPackZIP       ( 0, 0, ExpandConstant('{app}\1a1\*'), ExpandConstant('{app}\1a1.pak'), 2, false ) then break;
        if not ISExec          ( 0, 0, 0, ExpandConstant('{tmp}\Arc.exe'), ExpandConstant('x -o+ "{src}\001.arc" "{app}\"'), ExpandConstant('{tmp}'), '...',false) then break;
        if not ShowChangeDiskWindow ('Пожалуйста, вставьте второй диск и дождитесь его инициализации.', ExpandConstant('{src}'),'CODMW_2.arc') then break;

//    распаковка группы файлов посредством внешнего приложения

        FindHandle1:=ISFindFiles(0,ExpandConstant('{app}\*.ogg'),ColFiles1);
        ExecError:=false;
        while not ExecError and ISPickFilename(FindHandle1,ExpandConstant('{app}\'),CurIndex1,true) do begin
          InFilePath:=ISGetName(0);
          OutFilePath:=ISGetName(1);
          OutFileName:=ISGetName(2);
          ExecError:=not ISExec(0, 0, 0, ExpandConstant('{tmp}\oggdec.exe'), '"'+InFilePath+'" -w "'+OutFilePath+'"',ExpandConstant('{tmp}'),OutFileName,false);
        end;
        ISFindFree(FindHandle1);
        if ExecError then break;
*)

        ISDoneError:=false;
      until true;
      ISDoneStop;
    end;
  end;
  if (CurStep=ssPostInstall) and ISDoneError then begin
    Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);
  end;
end;
Это сообщение посчитали полезным следующие участники:

Отправлено: 10:59, 27-10-2013 | #1373


Аватара для Dinvin4ester

Старожил


Сообщения: 229
Благодарности: 0

Профиль | Отправить PM | Цитировать


saurn,
Все получилось , а с этой не поможете ?
Цитата Dinvin4ester:
Ребята, помогите вставить музыку в инсталл - http://sendfile.su/886037. »

Отправлено: 13:54, 27-10-2013 | #1374


Ветеран


Сообщения: 517
Благодарности: 314

Профиль | Отправить PM | Цитировать


Цитата Dinvin4ester:
а с этой не поможете ? »
Без регулятора уровня громкости. Только кнопка Старт/Стоп
http://rghost.ru/49756930
Это сообщение посчитали полезным следующие участники:

Отправлено: 16:10, 27-10-2013 | #1375


Аватара для Dinvin4ester

Старожил


Сообщения: 229
Благодарности: 0

Профиль | Отправить PM | Цитировать


saurn,
Благодарю. А можно еще узнать - можно ли как-то чтоб музыка шла сразу при запуске инсталлятора ?

Последний раз редактировалось Dinvin4ester, 27-10-2013 в 16:33.


Отправлено: 16:24, 27-10-2013 | #1376


Ветеран


Сообщения: 517
Благодарности: 314

Профиль | Отправить PM | Цитировать


Цитата Dinvin4ester:
можно ли как-то чтоб музыка шла сразу при запуске инсталлятора ? »
Можно конечно.
читать дальше »
Код: Выделить весь код
[Code]
const
  TfontColor = $ffffff;

var
  Wizard1,Wizard2,Wizard3,Wizard4,Wizard5,Wizard6,Wizard7,Wizard8,Wizard9,Wizard10,
  Wizard11,Wizard12,Wizard13,Wizard14,Wizard15,Wizard16,Wizard17,Wizard18,Wizard19,Wizard20,Wizard21,Wizard22: LongInt;
  hCancelBtn, hNextBtn, hBackBtn, hMusicButton, hDirBrowseBtn, hGroupBrowseBtn, hLogoBtn, StartBtn, IconBtn, hMyCancelBtn, Font1, Font2: HWND;
  ButtonFont: TFont;
  FreeMB, TotalMB: Cardinal;
  WelcomLabel1, SelectDirLabel, DirEditLabel, InstallSpacelabel1, InstallSpacelabel2, GroupEditLabel,
  SelectGroupLabel, NoStartLabel, TaskLabel, IconLabel, LabelStatus, LabelFinish: TLabel;
  MusicButton: TButton;

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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): DWORD; external 'BASS_StreamCreateFile@files:BASS.dll stdcall delayload';
function BASS_Start(): Boolean; external 'BASS_Start@files:BASS.dll stdcall delayload';
function BASS_Pause(): Boolean; external 'BASS_Pause@files:BASS.dll stdcall delayload';
function BASS_SetVolume(volume: DWORD): BOOL; external 'BASS_SetVolume@files:BASS.dll stdcall delayload';
function BASS_GetVolume: Integer; external 'BASS_GetVolume@files:BASS.dll stdcall delayload';
function BASS_ChannelPlay(handle: DWORD; restart: BOOL): Boolean; external 'BASS_ChannelPlay@files:BASS.dll stdcall delayload';
function BASS_Stop(): Boolean; external 'BASS_Stop@files:BASS.dll stdcall delayload';
function BASS_Free(): Boolean; external 'BASS_Free@files:BASS.dll stdcall delayload';
function NewFont(Height:Integer;thickness,italic,underline,strikeout:DWORD;name:String):hWnd;external 'NewFont@files:IsMyFont.dll stdcall delayload';
procedure Deinitialize;external 'Deinitialize@files:IsMyFont.dll stdcall delayload';

procedure IsMyFont;
begin
  Font1:=NewFont(20,500,0,0,0,'Corbel');
  Font2:=NewFont(17,500,0,0,0,'Franklin Gothic Medium');
  WizardForm.Font.Handle:=Font1;
  WizardForm.Font.Color:=TfontColor;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

procedure wzform;
begin
  WizardForm.ClientWidth:=600;
  WizardForm.ClientHeight:=400;
  WizardForm.InnerNotebook.hide;
  WizardForm.OuterNotebook.hide;
  WizardForm.OuterNotebook.hide;
  WizardForm.Bevel.Hide;
  WizardForm.Position:=poScreenCenter;
  WizardForm.ProgressGauge.Parent := WizardForm;
  WizardForm.ProgressGauge.SetBounds(ScaleX(30), ScaleY(163), ScaleX(540), ScaleY(26));
end;

procedure SetStateNewButtons;
begin
  with WizardForm.BackButton do begin
    BtnSetText(hBackBtn,PAnsiChar(Caption));
    BtnSetVisibility(hBackBtn,Visible);
  end;
  with WizardForm.NextButton do begin
    BtnSetText(hNextBtn,PAnsiChar(Caption));
    BtnSetVisibility(hNextBtn,Visible);
  end;
  with WizardForm.CancelButton do begin
    BtnSetText(hCancelBtn,PAnsiChar(Caption));
    BtnSetVisibility(hCancelBtn,Visible);
  end;
  with MusicButton do begin
    BtnSetText(hMusicButton,PAnsiChar(Caption));
    BtnSetVisibility(hMusicButton,Visible);
  end;
  BtnSetText(hDirBrowseBtn,PAnsiChar(WizardForm.DirBrowseButton.Caption));
  BtnSetText(hGroupBrowseBtn,PAnsiChar(WizardForm.GroupBrowseButton.Caption));
end;

procedure LogoBtnClick(hBtn:HWND);
var
ErrorCode: Integer;
begin
ShellExec('open', 'http://forum.krinkels.ru/index.php', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode)
end;

procedure WizardFormBtnClick(hBtn:HWND);
var
  Btn:TButton;
begin
  case hBtn of
    hCancelBtn: Btn:=WizardForm.CancelButton;
    hNextBtn: Btn:=WizardForm.NextButton;
    hBackBtn: Btn:=WizardForm.BackButton;
    hMusicButton: Btn:=MusicButton;
    hDirBrowseBtn: Btn:=WizardForm.DirBrowseButton;
    hGroupBrowseBtn: Btn:=WizardForm.GroupBrowseButton;
  end;
  Btn.OnClick(Btn);
  SetStateNewButtons;
  BtnRefresh(hBtn);
end;

procedure MusicButtonOnClick(Sender: TObject);
begin
    case TButton(Sender).Caption of
        'Играть':
        begin
            BASS_Start;
            MusicButton.Caption := 'Стоп';
        end;
        'Стоп':
        begin
            BASS_Pause;
            MusicButton.Caption := 'Играть';
        end;
    end;
end;

procedure InitMusic();
var
    Name: String;
    i: Integer;
begin
    ExtractTemporaryFile('BASS.dll');
    ExtractTemporaryFile('music.mp3');
    if BASS_Init(-1, 44100, 0, 0, 0) then
    begin
        BASS_Start();
        Name := ExpandConstant('{tmp}\music.mp3');
        i := BASS_StreamCreateFile(FALSE, PChar(Name), 0, 0, 4);
        if i <> 0 then
        begin
            BASS_ChannelPlay(i, True);
        end;
    end;
end;

procedure btn;
begin
    ButtonFont:=TFont.Create;
    ButtonFont.Handle:=Font2;
    hLogoBtn:=BtnCreate(WizardForm.Handle,12,335,116,52,ExpandConstant('{tmp}\Button2.png'),15,False);
    BtnSetEvent(hLogoBtn,BtnClickEventID,WrapBtnCallback(@LogoBtnClick,1));
    BtnSetCursor(hLogoBtn,GetSysCursorHandle(32649));
  with WizardForm.CancelButton do begin
    hCancelBtn:=BtnCreate(WizardForm.Handle,495,339,100,46,ExpandConstant('{tmp}\Button1.png'),15,False);
    BtnSetEvent(hCancelBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
    BtnSetFont(hCancelBtn,ButtonFont.Handle);
    Width:=0;
    Height:=0;
  end;
  with WizardForm.NextButton do begin
    hNextBtn:=BtnCreate(WizardForm.Handle,385,339,100,46,ExpandConstant('{tmp}\Button1.png'),15,False);
    BtnSetEvent(hNextBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
    BtnSetFont(hNextBtn,ButtonFont.Handle);
    Width:=0;
    Height:=0;
  end;
  with WizardForm.BackButton do begin
    hBackBtn:=BtnCreate(WizardForm.Handle,285,339,100,46,ExpandConstant('{tmp}\Button1.png'),15,False);
    BtnSetEvent(hBackBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
    BtnSetFont(hBackBtn,ButtonFont.Handle);
    Width:=0;
    Height:=0;
  end;
  MusicButton := TButton.Create(nil);
  with MusicButton do
  begin
    Caption := 'Стоп';
    Hint := 'Вкл.\Выкл. музыку';
    ShowHint := True;
    OnClick := @MusicButtonOnClick;
  end;
  with MusicButton do begin
    hMusicButton:=BtnCreate(WizardForm.Handle,495,6,100,46,ExpandConstant('{tmp}\Button1.png'),15,False);
    BtnSetEvent(hMusicButton,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
    BtnSetFont(hMusicButton,ButtonFont.Handle);
    Width:=0;
    Height:=0;
  end;
  with WizardForm.DirBrowseButton do begin
    hDirBrowseBtn:=BtnCreate(WizardForm.Handle,495,180,100,46,ExpandConstant('{tmp}\Button1.png'),15,False);
    BtnSetEvent(hDirBrowseBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
    BtnSetFont(hDirBrowseBtn,ButtonFont.Handle);
    Width:=0;
    Height:=0;
  end;
  with WizardForm.GroupBrowseButton do begin
    hGroupBrowseBtn:=BtnCreate(WizardForm.Handle,495,180,100,46,ExpandConstant('{tmp}\Button1.png'),15,False);
    BtnSetEvent(hGroupBrowseBtn,BtnClickEventID,WrapBtnCallback(@WizardFormBtnClick,1));
    BtnSetFont(hGroupBrowseBtn,ButtonFont.Handle);
    Width:=0;
    Height:=0;
  end;
  ImgApplyChanges(WizardForm.Handle);
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure welcom;
begin
Wizard1:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\BGImage1.png'),0,0,WizardForm.ClientWidth,WizardForm.ClientHeight,True,True);
Wizard2:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage1.png'),0,315,WizardForm.ClientWidth,85,True,True);
Wizard3:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage3.png'),0,181,WizardForm.ClientWidth,138,True,True);
Wizard4:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage2.png'),3,205,590,91,True,True);

  WelcomLabel1:= TLabel.Create(WizardForm);
with WelcomLabel1 do begin
  Left:= 30;
  Top:= 219;
  Width:= 550;
  Height:= 58;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
  Caption:=ExpandConstant('{cm:Welcom1}');
end;
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)+ExpandConstant('{cm:Size1}') else
if Float/1024 < 1024 then Result:= NumToStr(Float/1024)+ExpandConstant('{cm:Size2}') else
   Result:= NumToStr(Float/(1024*1024))+ExpandConstant('{cm:Size3}');
end;

procedure DirEditOnChange(Sender: TObject);
var Drive: String;
begin
  DirEditLabel.Caption:=MinimizePathName(WizardForm.DirEdit.Text, DirEditLabel.Font, DirEditLabel.Width);
  Drive:= ExtractFileDrive(WizardForm.DirEdit.Text);
  GetSpaceOnDisk(Drive, True, FreeMB, TotalMB);
  InstallSpacelabel1.Caption:=ExpandConstant('{cm:Install1}')+ MbOrTb({#NeedInstallSize});
  InstallSpacelabel2.Caption:=ExpandConstant('{cm:Install2}')+ MbOrTb({#NeedSinceInstallSize});
if WizardForm.CurPageID = wpWelcome then begin
end;
if  (FreeMB>{#NeedInstallSize}) then begin
  WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize});
  BtnSetEnabled(hNextBtn, True);
end else begin
  WizardForm.NextButton.Enabled:= (FreeMB>{#NeedInstallSize});
  BtnSetEnabled(hNextBtn, False);
end;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure SelectDir;
begin
Wizard6:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage4.png'),0,81,600,238,True,True);
Wizard7:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage5.png'),3,105,594,74,True,True);
Wizard8:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage6.png'),90,180,395,45,True,True);
Wizard9:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage7.png'),5,230,346,77,True,True);
Wizard10:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\FLRImage1.png'),17,170,79,64,True,True);

  SelectDirLabel:= TLabel.Create(WizardForm);
with SelectDirLabel do begin
  Left:= 30;
  Top:= 119;
  Width:= 594;
  Height:= 74;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
  Caption:=ExpandConstant('{cm:SelectDir}');
end;

  DirEditLabel := TLabel.Create(WizardForm);
with DirEditLabel do begin
  Left:=112;
  Top:= 191;
  Width:= 350;
  Height:= 20;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Caption := MinimizePathName(WizardForm.DirEdit.Text, DirEditLabel.Font, DirEditLabel.Width);
  Parent := WizardForm;
end;

  InstallSpacelabel1:= TLabel.Create(WizardForm);
with InstallSpacelabel1 do begin
  Left:= 30;
  Top:= 244;
  Width:= 594;
  Height:= 74;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
end;

  InstallSpacelabel2:= TLabel.Create(WizardForm);
with InstallSpacelabel2 do begin
  Left:= 30;
  Top:= 269;
  Width:= 594;
  Height:= 74;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
end;

  WizardForm.DirEdit.OnChange:=@DirEditOnChange;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure GroupChange(Sender: TObject);
begin
  GroupEditLabel.Caption := MinimizePathName(WizardForm.GroupEdit.Text, GroupEditLabel.Font, GroupEditLabel.Width);
end;

function Group: Boolean;
begin
  Result := BtnGetEnabled(hGroupBrowseBtn);
end;

procedure StartClick(hBtn:HWND);
var
  Check:boolean;
begin
  Check:=BtnGetChecked(hBtn);
if Check then begin
BtnSetEnabled(hGroupBrowseBtn, False)
GroupEditLabel.Font.Color:=$737373;
end else begin
BtnSetEnabled(hGroupBrowseBtn, True)
GroupEditLabel.Font.Color:=$FFFFFF
end;
end;

procedure NoIconsLabelClick(Sender:TObject);
begin
  BtnSetChecked(StartBtn, not BtnGetChecked(StartBtn));
  StartClick(StartBtn);
end;

procedure ProgramGroup;
begin
Wizard11:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage8.png'),20,240,282,48,True,True);
StartBtn:=BtnCreate(WizardForm.Handle,19,247,28,32,ExpandConstant('{tmp}\Button3.png'),8,True);
BtnSetEvent(StartBtn,BtnClickEventID,WrapBtnCallback(@StartClick,1));

  GroupEditLabel := TLabel.Create(WizardForm);
with GroupEditLabel do begin
  Left:=112;
  Top:= 191;
  Width:= 350;
  Height:= 20;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Caption := MinimizePathName(WizardForm.GroupEdit.Text, GroupEditLabel.Font, GroupEditLabel.Width);
  Parent := WizardForm;
end;

  SelectGroupLabel:= TLabel.Create(WizardForm);
with SelectGroupLabel do begin
  Left:= 30;
  Top:= 119;
  Width:= 540;
  Height:= 74;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
  Caption:=ExpandConstant('{cm:SelectGroup}');
end;

  NoStartLabel:= TLabel.Create(WizardForm);
with NoStartLabel do begin
  Left:= 44;
  Top:= 252;
  Width:= 250;
  Height:= 20;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
  OnClick:= @NoIconsLabelClick;
  Caption:=ExpandConstant('{cm:NoStart}');
end;

  WizardForm.GroupEdit.OnChange := @GroupChange;
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function IconDP: Boolean;
begin
  Result:= BtnGetChecked(IconBtn);
end;

procedure IconClick(hBtn:HWND);
var
  Check:boolean;
begin
  Check:=BtnGetChecked(hBtn);
end;

procedure IconLabelClick(Sender:TObject);
begin
  BtnSetChecked(IconBtn, not BtnGetChecked(IconBtn));
  IconClick(IconBtn);
end;

procedure ProgramTask;
begin
Wizard12:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage8.png'),20,205,232,48,True,True);
IconBtn:=BtnCreate(WizardForm.Handle,39,211,28,32,ExpandConstant('{tmp}\Button3.png'),8,True);
BtnSetEvent(IconBtn,BtnClickEventID,WrapBtnCallback(@IconClick,1));
BtnSetChecked(IconBtn,True);

TaskLabel:= TLabel.Create(WizardForm);
with TaskLabel do begin
  Left:= 30;
  Top:= 119;
  Width:= 540;
  Height:= 74;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
  Caption:=ExpandConstant('{cm:Task}');
end;

IconLabel:= TLabel.Create(WizardForm);
with IconLabel do begin
  Left:= 64;
  Top:= 215;
  Width:= 170;
  Height:= 20;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Parent:= WizardForm;
  OnClick:= @IconLabelClick;
  Caption:=ExpandConstant('{cm:Icon}');
end;
end;

procedure CreateControls;
begin
 Wizard13:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage10.png'),3,148,594,72,True,True);
 Wizard14:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage11.png'),190,105,84,52,True,True);
 Wizard15:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage9.png'),3,105,200,52,True,True);

  LabelStatus := TLabel.Create(WizardForm);
with LabelStatus do begin
  Left:= 30;
  Top:= 119;
  Width:= 540;
  Height:= 74;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Caption:= ExpandConstant('{cm:Extracted}');
  Parent:= WizardForm;
end;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure Finish;
begin
Wizard16:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage12.png'),3,220,594,62,True,True);
Wizard17:=ImgLoad(WizardForm.Handle,ExpandConstant('{tmp}\SDWImage5.png'),3,215,594,72,True,True);

  LabelFinish := TLabel.Create(WizardForm);
with LabelFinish do begin
  Left:= 30;
  Top:= 230;
  Width:= 550;
  Height:= 58;
  AutoSize:= false;
  Transparent:= true;
  WordWrap:= true;
  ParentFont := True;
  Caption:= ExpandConstant('{cm:Finish2}');
  Parent:= WizardForm;
end;
end;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure InitializeWizard;
begin
InitMusic();
IsMyFont;
wzform;
btn;
welcom;
SelectDir;
ProgramGroup;
ProgramTask;
CreateControls;
Finish;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function InitializeSetup:boolean;
begin
  if not FileExists(ExpandConstant('{tmp}\b2p.dll')) then ExtractTemporaryFile('b2p.dll');
  if not FileExists(ExpandConstant('{tmp}\botva2.dll')) then ExtractTemporaryFile('botva2.dll');
  ExtractTemporaryFile('IsMyFont.dll');
  Result:=True;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  if (PageID =wpLicense)or(PageID =wpInfoBefore)or(PageID =wpUserInfo)or(PageID =wpSelectTasks) then
  Result:= True;
end;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure Hide(CurPageID: Integer);
begin
  WizardForm.ProgressGauge.hide;
  WelcomLabel1.hide;
  SelectDirLabel.hide;
  DirEditLabel.hide;
  InstallSpacelabel1.hide;
  InstallSpacelabel2.hide;
  GroupEditLabel.hide;
  SelectGroupLabel.hide;
  NoStartLabel.hide;
  TaskLabel.hide;
  IconLabel.hide;
  LabelStatus.hide;
  LabelFinish.hide;
  BtnSetVisibility(hDirBrowseBtn, False);
  BtnSetVisibility(hGroupBrowseBtn, False);
  ImgSetVisibility(Wizard3, False);
  ImgSetVisibility(Wizard4, False);
  ImgSetVisibility(Wizard6, False);
  ImgSetVisibility(Wizard7, False);
  ImgSetVisibility(Wizard8, False);
  ImgSetVisibility(Wizard9, False);
  ImgSetVisibility(Wizard10, False);
  ImgSetVisibility(Wizard11, False);
  ImgSetVisibility(Wizard12, False);
  ImgSetVisibility(Wizard13, False);
  ImgSetVisibility(Wizard14, False);
  ImgSetVisibility(Wizard15, False);
  ImgSetVisibility(Wizard16, False);
  ImgSetVisibility(Wizard17, False);
  BtnSetVisibility(StartBtn, False);
  BtnSetVisibility(IconBtn, False);
  BtnSetVisibility(hMyCancelBtn, False);
  BtnSetVisibility(hCancelBtn, False);
  ImgApplyChanges(WizardForm.Handle);
end;

procedure Show(CurPageID: Integer);
begin case CurPageID of
  wpWelcome:
begin
  ImgSetVisibility(Wizard3, True);
  ImgSetVisibility(Wizard4, True);
  BtnSetVisibility(hCancelBtn, True);
  BtnSetEnabled(hNextBtn, True);
  WelcomLabel1.Show;
  WizardForm.Caption:= ExpandConstant('{cm:Welcom}');
  ImgApplyChanges(WizardForm.Handle);
end;
  wpSelectDir:
begin
  DirEditOnChange(nil)
  BtnSetVisibility(hCancelBtn, True);
  ImgSetVisibility(Wizard6, True);
  ImgSetVisibility(Wizard7, True);
  ImgSetVisibility(Wizard8, True);
  ImgSetVisibility(Wizard9, True);
  ImgSetVisibility(Wizard10, True);
  BtnSetVisibility(hDirBrowseBtn, True);
  SelectDirLabel.Show;
  DirEditLabel.Show;
  InstallSpacelabel1.Show;
  InstallSpacelabel2.Show;
  WizardForm.Caption:= ExpandConstant('{cm:SelectDir1}');
  ImgApplyChanges(WizardForm.Handle);
end;
  wpSelectProgramGroup:
begin
  GroupChange(nil)
  GroupEditLabel.Show;
  SelectGroupLabel.Show;
  NoStartLabel.Show;
  WizardForm.Caption:= ExpandConstant('{cm:SelectGroup1}');
  BtnSetVisibility(hCancelBtn, True);
  ImgSetVisibility(Wizard6, True);
  ImgSetVisibility(Wizard7, True);
  ImgSetVisibility(Wizard8, True);
  ImgSetVisibility(Wizard10, True);
  ImgSetVisibility(Wizard11, True);
  BtnSetVisibility(hGroupBrowseBtn, True);
  BtnSetVisibility(StartBtn, True);
  ImgApplyChanges(WizardForm.Handle);
end;
  wpReady:
begin
  TaskLabel.Show;
  IconLabel.Show;
  WizardForm.Caption:= ExpandConstant('{cm:Task1}');
  BtnSetVisibility(hCancelBtn, True);
  ImgSetVisibility(Wizard6, True);
  ImgSetVisibility(Wizard7, True);
  ImgSetVisibility(Wizard12, True);
  BtnSetVisibility(IconBtn, True);
  ImgApplyChanges(WizardForm.Handle);
end;
  wpInstalling:
begin
  WizardForm.ProgressGauge.Show;
  LabelStatus.Show;
  BtnSetVisibility(hCancelBtn, True);
  ImgSetVisibility(Wizard6, True);
  ImgSetVisibility(Wizard13, True);
  ImgSetVisibility(Wizard14, True);
  ImgSetVisibility(Wizard15, True);
  ImgApplyChanges(WizardForm.Handle);
end;
  wpFinished:
begin
  LabelFinish.Show;
  WizardForm.Caption:= ExpandConstant('{cm:Finish1}');
  ImgSetVisibility(Wizard3, True);
  ImgSetVisibility(Wizard17, True);
  ImgApplyChanges(WizardForm.Handle);
end;
end;
end;

Procedure CurPageChanged(CurPageID: Integer);
Begin
  SetStateNewButtons;
  Hide(CurPageID);
  Show(CurPageID);
end;


procedure DeinitializeSetup;
begin
  Deinitialize;
  gdipShutDown;
  ButtonFont.Free;
  BASS_Stop();
  BASS_Free();
end;
Это сообщение посчитали полезным следующие участники:

Отправлено: 16:39, 27-10-2013 | #1377


Аватара для Dinvin4ester

Старожил


Сообщения: 229
Благодарности: 0

Профиль | Отправить PM | Цитировать


saurn,
Спасибище вам от нуба.

Отправлено: 16:49, 27-10-2013 | #1378


Пользователь


Сообщения: 80
Благодарности: 3

Профиль | Отправить PM | Цитировать


Ребят!
Как можно удалить файлы в папке в "AppData" перед установкой, если стоит галочка в секции [Tasks]...
...все дело в том, что секция [InstallDelete] совершенно не воспринимает...
Код: Выделить весь код
Type: filesandordirs; Name: {userappdata}\Имя папки в которой надо все удалить\
Type: filesandordirs; Name: {commonappdata}\Имя папки в которой надо все удалить\
Type: filesandordirs; Name: {localappdata}\Имя папки в которой надо все удалить\
?

Отправлено: 14:58, 28-10-2013 | #1379


Пользователь


Сообщения: 80
Благодарности: 3

Профиль | Отправить PM | Цитировать


Еще вопрос... есть такой скрипт, который копирует файлы из одной папку в другую (создает бэкап)
читать дальше »
Код: Выделить весь код
[Setup]
AppName=MyProg
AppVerName=MyProg
DefaultDirName={pf}\MyProg
DefaultGroupName=MyProg
OutputDir=.

\Code\
var
MyTask: TCheckBox;

function MoveFile(const srcFile, destFile: PChar): Integer; external 'MoveFileA@kernel32.dll stdcall';

procedure CurStepChanged(CurStep: TSetupStep);
var
FindFiles: TFindRec;
i: integer;
MyFiles: array of string;
MyDir, BackDir: string;
begin
if CurStep=ssInstall then begin
if MyTask.Checked then begin
MyFiles:=['TS3.exe','gameplay.package','*.precomp','*.jpg']; // указать файлы или маски нужные для бакупа через запятую. при указании маски '*' бакупятся все файлы с вложенными папками
MyDir:=ExpandConstant('{app}'+'\Game\Bin\'); //папка откуда бакупить
BackDir:=ExpandConstant('{app}'+'\Backup\'); // папка куда бакупить
for i:=0 to GetArrayLength(MyFiles)-1 do
begin
if FindFirst(MyDir+MyFiles[i], FindFiles) then begin
repeat
if not DirExists(BackDir) then begin
CreateDir(BackDir);
end;
MoveFile(MyDir+FindFiles.Name, BackDir+FindFiles.Name);
until not FindNext(FindFiles);
FindClose(FindFiles);
end;
end;
end;
end;
end;

procedure InitializeWizard();
begin
MyTask:=TCheckBox.Create(WizardForm);
with MyTask do
begin
Parent:=WizardForm.SelectDirPage;
Caption:='Сделать Бэкап';
Left:=ScaleX(0);
Top:=ScaleY(100);
Width:=ScaleX(400);
Height:=ScaleY(15);
TabOrder:=0;
Checked:=True;
end;
end;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
FindFiles: TFindRec;
MyDir, BackDir: string;
begin
if CurUninstallStep = usPostUninstall then begin
MyDir:=ExpandConstant('{app}'+'\Game\Bin\'); //папка куда возвращать файлы
BackDir:=ExpandConstant('{app}'+'\Backup\'); // папка откуда брать файлы
if DirExists(BackDir) then begin
if MsgBox('Восстановить данные из бэкапа?', mbConfirmation, MB_YESNO) = IDYES then begin
if FindFirst(BackDir+'*', FindFiles) then begin
repeat
MoveFile(BackDir+FindFiles.Name, MyDir+FindFiles.Name);
until not FindNext(FindFiles);
FindClose(FindFiles);
RemoveDir(BackDir);
end;
end;
end;
end;
end;


У данного скрипта есть проблема... если в папке куда перемещаются файлы уже создана пусть даже пустая папка, имя которой совпадает с перемещаемой папкой, то файлы в эту папку просто не копируются... их просто пропускают... как это исправить?

Отправлено: 00:08, 29-10-2013 | #1380



Компьютерный форум OSzone.net » Автоматическая установка Windows » Автоматическая установка приложений » Скрипты Inno Setup. Помощь и советы [часть 6]

Участник сейчас на форуме Участник сейчас на форуме Участник вне форума Участник вне форума Автор темы Автор темы Шапка темы Сообщение прикреплено

Похожие темы
Название темы Автор Информация о форуме Ответов Последнее сообщение
Скрипты Inno Setup. Помощь и советы [часть 5] El Sanchez Автоматическая установка приложений 1999 28-03-2013 19:09
Скрипты Inno Setup. Помощь и советы [часть 4] El Sanchez Автоматическая установка приложений 2099 22-05-2012 23:16
Скрипты Inno Setup. Помощь и советы [часть 3] Serega Автоматическая установка приложений 3755 26-10-2011 17:58
[архив] Скрипты Inno Setup. Помощь и советы [часть 2] Serega Автоматическая установка приложений 2651 08-11-2010 18:34
Скрипты Inno Setup Compiler QAZAK Автоматическая установка приложений 7 15-01-2007 17:59




 
Переход