Войти

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


Страниц : 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

leshcat
03-04-2014, 03:24
Здравствуйте,

Подскажите пожалуйста, есть функция slideshow в окне инсталлятора:


#define TIME_FOR_VIEW 10

[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program

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

[Files]
Source: InnoCallback.dll; Flags: dontcopy noencryption nocompression solidbreak;
Source: .bmp; Flags: dontcopy noencryption nocompression solidbreak;

Source: D:\Games\StarCraft enGB\StarDat.mpq; DestDir: {app}

[Code
const
n=21; ///количество слайдов
type
TProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord);
TRandNumbers = array[1..N] of byte;

function WrapTimerProc(callback:TProc; paramcount:integer):longword;
external 'wrapcallback@files:InnoCallback.dll stdcall';

function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord;
external 'SetTimer@user32.dll stdcall';

function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord;
external 'KillTimer@user32.dll stdcall';

function get_unique_r andom_number(X:byte):TRandNumbers;
var
A,b,c: string;
i,j,k:byte;
begin
For i:=1 to X do A:=A+chr(i);
B:='';
For i:=1 to X do begin
j:=Random(Length(A)-1)+1;
C:='';
B:=B + A[j];
for k:=1 to Length(A) do
if k<>j then C:=C+A[k];
A:=C;
end;
for i:=1 to X do Result[i]:=ord(B[i]);
end;

var
TimerID: LongWord;
currTime: Integer;
SplashImage: TBitmapImage;
StatusMessages: TNewStaticText;
bmp: TRandNumbers;
z:byte;

procedure OnTimer(HandleW, msg, idEvent, TimeSys: LongWord);
begin
currTime := currTime + 1;
if (currTime mod {#TIME_FOR_VIEW} = 0)
then begin
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+ inttostr(bmp[currTime/{#TIME_FOR_VIEW}])+'.bmp'));
if (currTime/{#TIME_FOR_VIEW} = N) then currTime:=0;
end;
end;

procedure InitializeWizard;
begin
bmp:=get_unique_random_number(N);
ExtractTemporaryFile('Image_'+inttostr(bmp[1])+'.bmp');

currTime := 0;

WizardForm.ProgressGauge.Parent := WizardForm;
WizardForm.ProgressGauge.Top := WizardForm.CancelButton.Top + ScaleY (12);
WizardForm.ProgressGauge.Left := ScaleX(10);
WizardForm.ProgressGauge.Width := WizardForm.MainPanel.Width - ScaleX(20);
WizardForm.ProgressGauge.Height := 16;
WizardForm.ProgressGauge.Hide;

WizardForm.StatusLabel.Parent := WizardForm;
WizardForm.StatusLabel.Top := WizardForm.ProgressGauge.Top - ScaleY(18);
WizardForm.StatusLabel.Left := ScaleX(10);
WizardForm.StatusLabel.Width := ScaleX(397);
WizardForm.StatusLabel.Hide;

SplashImage := TBitmapImage.Create(WizardForm);
SplashImage.Top := 0;
SplashImage.Left := 0;
SplashImage.Width := WizardForm.MainPanel.Width;
SplashImage.Height := WizardForm.Bevel.Top;
SplashImage.Parent := WizardForm.InnerPage;
SplashImage.Stretch := True;
SplashImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\Image_'+inttostr(bmp[1])+'.bmp'));
SplashImage.Hide;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
WizardForm.StatusLabel.Caption := 'Распаковка слайдов ...';
for z:=2 to N do ExtractTemporaryFile('Image_ '+inttostr(bmp[z])+'.bmp');
end;
end;

procedure CurPageChanged(CurPageID: Integer);
var
pfunc: LongWord;
begin
if (CurPageID = wpInstalling) then
begin
pfunc := WrapTimerProc(@OnTimer, 5);
TimerID := SetTimer(0, 0, 1000, pfunc);
WizardForm.PageNameLabel.Visible := False;
WizardForm.PageNameLabel.Visible := False;
WizardForm.InnerNotebook.Hide;
WizardForm.Bevel1.Hide;
WizardForm.MainPanel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.PageNameLabel.Hide;
WizardForm.ProgressGauge.Show;
WizardForm.StatusLabel.Show;
SplashImage.Show;
WizardForm.CancelButton.Enabled := True;
WizardForm.CancelButton.Top := WizardForm< /FONT> .Bevel.Top + ScaleY(100);
end else
begin
WizardForm.ProgressGauge.Hide;
SplashImage.Hide;
WizardForm.FileNameLabel.Hide;
WizardForm.StatusLabel.Hide;
if (CurPageID > wpInstalling) and (CurPageID < wpFinished) then
begin
WizardForm.InnerNotebook.Show;
WizardForm.Bevel1.Show;
WizardForm.MainPanel.Show;
WizardForm.PageNameLabel.Show;
WizardForm.PageNameLabel.Show;
end;
If CurPageID = wpFinished then
end;
end;

procedure DeInitializeSetup();
begin
KillTimer(0, TimerID);
end;


Вопрос: как убрать рандом, чтобы картинки показывались последовательно?

innot20
03-04-2014, 06:49
Здравствуйте, подскажите пожалуйста как менять значение конфига json, при выборе определённого компонента

Ivan_009
03-04-2014, 08:34
Подскажите пожалуйста как на деинсталлятор прикрутить свой шрифт для кнопок...

Пробовал так не работает... Ошибку выбивает:http://rghost.ru/53729756

var
hCancelUninstBtn: HWND;
ButtonFontU:TFont;

procedure BtnSetFontU(h :HWND; Font :Cardinal); external 'BtnSetFont@{tmp}\b2p.dll stdcall delayload';

procedure InitializeUninstallProgressForm();
begin
ButtonFontU:=TFont.Create;
with ButtonFontU do begin
Name:='Tahoma';
Size:= 8;
Style:=[];
end;

with UninstallProgressForm.CancelButton do begin
BtnSetFontU(hCancelUninstBtn,ButtonFontU.Handle);
end;

Mat_y
03-04-2014, 09:39
Если {tmp} это временная папка инсталлятора... а как обозначить временную папку Win? {%TEMP} ?

R.i.m.s.k.y.
03-04-2014, 09:40
Mat_y, %temp%

Mat_y
03-04-2014, 09:57
Mat_y, %temp% »
Прямо так и писать?

Filename: %temp%/FileName.exe;

Gnom_aka_Lexander
03-04-2014, 09:58
Mat_y, в инно это константа {%TEMP}

Mat_y
03-04-2014, 10:02
Mat_y, в инно это константа {%TEMP} »
Mat_y, %temp% »

Хмм... обе придется пробовать :(

R.i.m.s.k.y.
03-04-2014, 10:07
Mat_y, EXPANDconstant('{%temp}')

Gnom_aka_Lexander
03-04-2014, 10:10
Mat_y, Из справки:
{%NAME|DefaultValue}
Вставляет значение переменной среды.

•NAME - имя переменной среды
•DefaultValue - определяет текст, который будет вставлен в случае, если константа не существует
•Для вставки запятой, вертикальной черты ("|"), или закрывающей фигурной скобки ("}") поставьте перед ней "%-код_символа.". Замените символ символом "%", сопровождаемым его двухразрядным шестнадцатеричным кодом. Запятая - "%2c", вертикальная черта - "%7c", и закрывающая фигурная скобка - "%7d". Если Вы хотите включить символ "%", используйте "%25".
•NAME and DefaultValue могут содержать константы. Обратите внимание, что описанным выше способом закрывающая фигурная скобка задается только в случае, когда она используется сама по себе. Если же она обозначает константу, подобные изощрения не нужны.
Например:
{%COMSPEC}{%PROMPT|$P$G}
то есть по маске {%NAME} вместо NAME подставляем имя переменной винды без обрамляющих знаков процента. формат %temp% или она-же %tmp% - инно не поймет, это для командной строки самой винды.

Mat_y
03-04-2014, 10:47
Я может не выспался... но никак не могу усвоить материал...
Как мне надо написать, чтобы inno распаковал фаил в temp винды? И потом оттуда выполнил [RUN]?

nik1967
03-04-2014, 11:30
leshcat, выкладывал пример уже. (http://rghost.ru/53367624)

Ivan_009, в другом месте ответил.

Stealthmax
03-04-2014, 13:09
[Files]
Source: "{port}\*"; DestDir: "{code:GetPath}"; Flags: ignoreversion createallsubdirs recursesubdirs; Check: Portable
[Code]
var isportable : boolean;
function Portable: Boolean;
begin
Result := PortableRadioButton.Checked or isportable;
end;
Function InitializeSetup: Boolean;
var i : integer;
Begin
for i:=2 to ParamCount do begin
if ( Pos(LowerCase('/p'), Lowercase(ParamStr(i))) > 0 ) then isportable := true else isportable := false;
Result := True;
end;//for
end; »
Почти, но кусочек был потерян, установщик возвращает False и установка не происходит в таком случае, но все равно спасибо, сам подправил, теперь работает.
И вопрос по поводу /SILENT и /VERYSILENT остается открытым. Есть ли возможность их уравнять и переназначить на один ключ "/s"? К примеру, /SILENT := /VERYSILENT := /s, ну это грубо изобразил ,но думаю смысл понятен.

R.i.m.s.k.y.
03-04-2014, 13:16
Как мне надо написать, чтобы inno распаковал фаил в temp винды? И потом оттуда выполнил [RUN]? »
в секциях files и run указываешь {%temp}
в секции code - expandconstant('{%temp}')

Почти, но кусочек был потерян, установщик возвращает False и установка не происходит в таком случае, но все равно спасибо, сам подправил, теперь работает. »
а ну да
хотя КМК это баг инно - нигде result не объявялется false
И вопрос по поводу /SILENT и /VERYSILENT остается открытым. »
КМК - никак
я просто проверяю поданы ли на вход параметры /SILENT и /VERYSILENT и если да - отталкиваюсь от них

Stealthmax
03-04-2014, 13:30
Смотри от #517 сообщения. Так же сообщение #1780 »
Тоже пойдет, у меня Check'и выставлены и вариант от R.i.m.s.k.y. прекрасно отработал. Но все равно возьму на заметку и такой вариант, спасибо.)

КМК - никак
я просто проверяю поданы ли на вход параметры /SILENT и /VERYSILENT и если да - отталкиваюсь от них »
А вот это случайно не относится к сути дела (http://stackoverflow.com/questions/11449561/detecting-verysilent-mode-in-inno-setup) ? Устанавливается глобальная переменная; может это обыграть каким-то образом? Или тупо брать исходники Inno и "пилить под себя"?

R.i.m.s.k.y.
03-04-2014, 14:15
А вот это случайно не относится к сути дела ? »
WizardSilent видать недавно (сравнительно) появилась
поиск по silent в помощи такой WizardSilent не выдает
А кусок кода и метода по ссылке - объявить глобальную переменную в зависимости от параметра комстроки установщика - это я выше и написал

Stealthmax
03-04-2014, 16:39
WizardSilent видать недавно (сравнительно) появилась »
Как недавно? У меня в расширенной версии есть function WizardSilent: Boolean; // Returns True if Setup is running silently, False otherwise. А юзаю эту версию уже года 3 точно да и в оф.справке тоже есть упоминание (http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_wizardsilent). Только какой смысл от этой функции, если нет второй WizardVerySilent, которая как раз и пригодилась бы большинству. Ну раз такая пьянка пошла, что ж, буду в сорсы погружаться и конструировать.

Dodakaedr
03-04-2014, 16:45
Со скином и без работает: »
Выводит только кнопку закрыть, но и системное меню не скрывает... Это не то что нужно. Способ от Gnom_aka_Lexander подошел.

Stealthmax
03-04-2014, 16:59
Выводит только кнопку закрыть, но и системное меню не скрывает... Это не то что нужно. Способ от Gnom_aka_Lexander подошел. »
Ну так добавь свойства Border и будет радость))). Я имел ввиду скрыть кнопки справа, а меню убирается штатными средствами, в расширенной версии можно наглядно просмотреть.

Nordek
03-04-2014, 17:07
У меня в расширенной версии есть function WizardSilent: Boolean; // Returns True if Setup is running silently, False otherwise. »Подтверждаю, есть такое (выделил жирным):
// Support functions
// Here's the list of support functions that can be called from
// within the Pascal script.

// Setup or Uninstall Info functions

function GetCmdTail: String; // Returns all command line parameters passed to Setup or Uninstall as a single String.
function ParamCount: Integer; // Returns the number of command line parameters passed to Setup or Uninstall.
function ParamStr(Index: Integer): String; // Returns the Index-th command line parameter passed to Setup or Uninstall.

function ActiveLanguage: String; // Returns the name of the active language.

function CustomMessage(const MsgName: String): String; // Returns the value of the [CustomMessages] entry with the specified name.
function FmtMessage(const S: String; const Args: array of String): String; // Formats the String S using the specified String arguments.
function SetupMessage(const ID: TSetupMessageID): String; // Returns the value of the specified message.

function WizardDirValue: String; // Returns the current contents of the edit control on the Select Destination Location page of the wizard.
function WizardGroupValue: String; // Returns the current contents of the edit control on the Select Start Menu Folder page of the wizard.
function WizardNoIcons: Boolean; // Returns the current setting of the Don't create any icons check box on the Select Start Menu Folder page of the wizard.
function WizardSetupType(const Description: Boolean): String; // Returns the name or description of the setup type selected by the user.
function WizardSelectedComponents(const Descriptions: Boolean): String; // Returns a comma-separated list of names or descriptions of the components selected by the user.
function WizardSelectedTasks(const Descriptions: Boolean): String; // Returns a comma-separated list of names or descriptions of the tasks selected by the user.
function WizardSilent: Boolean; // Returns True if Setup is running silently, False otherwise.

function IsUninstaller: Boolean;
function UninstallSilent: Boolean;

function CurrentFileName: String;

function ExpandConstant(const S: String): String;
function ExpandConstantEx(const S: String; const CustomConst, CustomValue: String): String;

function IsComponentSelected(const Components: String): Boolean;
function IsTaskSelected(const Tasks: String): Boolean;

procedure ExtractTemporaryFile(const FileName: String);
procedure ExtractTemporaryFileEx(const FileName: String; const DestDir: String);
procedure ExtractTemporaryFileToStream(const FileName: String; const Stream: TStream);
function ExtractTemporaryFileSize(const FileName: String): LongWord;
procedure ExtractTemporaryFileToBuffer(const FileName: String; Buffer: Integer);

function GetSetupPreviousData(const ValueName, DefaultValueData: String): String;
function SetSetupPreviousData(const PreviousDataKey: Integer; const ValueName, ValueData: String): Boolean;
function GetPreviousData(const ValueName, DefaultValueData: String): String;
function SetPreviousData(const PreviousDataKey: Integer; const ValueName, ValueData: String): Boolean;

function Terminated: Boolean;

function RmSessionStarted: Boolean;
в оф.справке тоже есть упоминание (http://www.oszone.net/go.php?url=http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_wizardsilent). »И такое есть в русской справке "Inno Setup версия 5.4.3":
Скрипты на Pascal » Встроенные функции » function WizardSilent: Boolean; »
Прототип:
function WizardSilent: Boolean;

Описание:
Возвращает значение True, если инсталлятор запущен в тихом режиме, в обратном случае False.




© OSzone.net 2001-2012