-
Notifications
You must be signed in to change notification settings - Fork 8
/
example5.iss
128 lines (100 loc) · 3.84 KB
/
example5.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#define MyAppName "My Program"
#define MyAppVerName "My Program 1.5"
#define MyAppPublisher "My Company, Inc."
#define MyAppURL "http://www.mycompany.com"
[Setup]
AppName={#MyAppName}
AppVerName={#MyAppVerName}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=example5
Compression=lzma
SolidCompression=true
CreateAppDir=true
ShowLanguageDialog=yes
[Languages]
Name: english; MessagesFile: compiler:Default.isl
#include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Downloader','ScriptPath','');
#include ReadReg(HKEY_LOCAL_MACHINE,'Software\Sherlock Software\InnoTools\Tray','ScriptPath','');
[Code]
{
Example 5
This example demonstrates how to integrate InnoTools Downloader with
InnoTools Tray to have setup minimize to the tray while downloading.
You must have InnoTools Tray installed to compile this example.
}
procedure MyITDEventHandler(event:integer);
begin
{Extend ITD's default handling of events to include
handling for a tray icon}
case event of
ITD_Event_DownloadPageEntered:begin
//Only enable minimizing to tray from the download page
ITT_SetMinimizesToTray(true);
ITT_MinimizeToTray();
ITT_ShowBalloon('Setup is downloading additional files...',
'You can continue to use your computer while setup '+
'is downloading files.',10);
end;
ITD_Event_DownloadPageLeft:begin
ITT_SetMinimizesToTray(false);
if ITT_IsInTray then begin
{ITT_ShowBalloon('Setup has finished downloading files',
'Click here to continue installation',10);}
ITT_RestoreFromTray;
end;
end;
ITD_Event_DownloadFailed:begin
ITT_RestoreFromTray; //Get the user to do something about the error
end;
end;
end;
{Contributed by Hilbrand Edskes. Sets the HTTP agent
that ITD uses to a custom one which includes information
about which version of Windows that the customer is using.
Great for tracking the popularity of your software on different
platforms! (If you want to send more detailed information,
then consider posting a string to your server as in
Example2.iss)
}
procedure SetCustomUserAgent();
var UA:String;
begin
// Create User Agent String and include system information and version
UA:='InnoTools Downloader '+ITD_GetOption('ITD_Version')+' (Windows '
if UsingWinNT then UA:=UA + 'NT '
if IsWin64 then UA:=UA + 'x64 '
UA:=UA + GetWindowsVersionString + ')'
// Changes the "agent" field used in HTTP requests
ITD_SetOption('ITD_Agent', UA);
end;
procedure InitializeWizard();
begin
itd_init;
itt_init; //Important! Create (but don't display yet) the tray icon
ITT_SetHint('Downloading files...');
itd_EventHandler:=@MyITDEventHandler;
//Let's download two zipfiles from my website..
itd_addfile('http://www.sherlocksoftware.org/petz/files/dogz5.zip',expandconstant('{tmp}\dogz5.zip'));
itd_addfile('http://www.sherlocksoftware.org/petz/files/petz4.zip',expandconstant('{tmp}\petz4.zip'));
{While we're at it, let's change the default appearance
from the "simple mode" to the "detailed mode" that appears
when you click the "Details" button}
itd_setoption('UI_DetailedMode', '1');
{And let's change the agent string that is used to identify
the "browser" that is making HTTP requests}
SetCustomUserAgent;
//Start the download after the "Ready to install" screen is shown
itd_downloadafter(wpReady);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then begin //Lets install those files that were downloaded for us
filecopy(expandconstant('{tmp}\dogz5.zip'),expandconstant('{app}\dogz5.zip'),false);
filecopy(expandconstant('{tmp}\petz4.zip'),expandconstant('{app}\petz4.zip'),false);
end;
end;