forked from florentbr/SeleniumBasic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeleniumBasicSetup.iss
619 lines (529 loc) · 31.4 KB
/
SeleniumBasicSetup.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
#define ASSEMBLY_PATH ".\Selenium\bin\Release\Selenium.dll"
#define ASSEMBLY_VERSION GetFileVersion(ASSEMBLY_PATH)
#define AppName "Selenium"
#define AppID "{{0277FC34-FD1B-4616-BB19-1FDB7381B291}"
#define AppLongName "Selenium Basic"
#define AppPublisher "Florent BREHERET"
#define AppURL "https://github.com/florentbr/SeleniumBasic"
#define AppFolder "SeleniumBasic"
#define AppSetupFilename "SeleniumBasic-" + ASSEMBLY_VERSION
[Setup]
AppId={#AppID}
PrivilegesRequired=lowest
AppName={#AppLongName}
AppVersion={#ASSEMBLY_VERSION}
AppVerName={#AppLongName}
VersionInfoVersion={#ASSEMBLY_VERSION}
VersionInfoTextVersion={#ASSEMBLY_VERSION}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DisableDirPage=yes
DefaultDirName={code:GetRootDir}
UsePreviousAppDir=no
UsePreviousSetupType=yes
DefaultGroupName={#AppLongName}
DisableProgramGroupPage=yes
LicenseFile=.\LICENSE.txt
OutputDir="."
OutputBaseFilename={#AppSetupFilename}
;Compression=zip
Compression=lzma2
SolidCompression=yes
DirExistsWarning=no
ArchitecturesInstallIn64BitMode=x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[CustomMessages]
MsgNETFrameworkNotInstalled=Microsoft .NET Framework 3.5 installation was Not detected.
MsgRegistryWriteFailure=Failed to register the library due to insufficient privileges.
MsgFileNotFound=File Not found: %1.
MsgCOMInvokeFailed=Installation failed. The installer was unable to call the registered library.
[Components]
Name: "pkg_core"; Description: ".Net core libraries"; Types: full compact custom; Flags: fixed;
Name: "pkg_doc"; Description: "Templates and examples"; Types: full compact custom;
Name: "pkg_cons"; Description: "Enhanced console runner for VBScript files"; Types: full compact custom;
Name: "pkg_ff"; Description: "WebDriver for Firefox"; Types: full custom;
Name: "pkg_cr"; Description: "WebDriver for Chrome"; Types: full custom;
Name: "pkg_op"; Description: "WebDriver for Opera"; Types: full custom;
Name: "pkg_ie"; Description: "WebDriver for Internet Explorer"; Types: full custom;
Name: "pkg_edg"; Description: "WebDriver for Microsoft Edge"; Types: full custom;
Name: "pkg_pjs"; Description: "WebDriver for PhantomJS (headless browser)"; Types: full custom;
Name: "pkg_ide"; Description: "SeleniumIDE plugin for Firefox"; Types: full custom;
[Files]
Source: "Selenium\bin\Release\Selenium.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium.pdb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium32.tlb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "Selenium\bin\Release\Selenium64.tlb"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core; Check: IsWin64;
Source: "Selenium\bin\Help\Selenium.chm"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_core;
Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion overwritereadonly ; Attribs:readonly;
Source: "CHANGELOG.txt"; DestDir: "{app}"; Flags: ignoreversion overwritereadonly ; Attribs:readonly;
Source: "VbsConsole\bin\Release\vbsc.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_cons;
;drivers
Source: "References\firefoxdriver.xpi"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ff;
Source: "References\chromedriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_cr;
Source: "References\operadriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_op;
Source: "References\phantomjs.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_pjs;
Source: "References\iedriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ie;
;Source: "References\iedriver64.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ie; Check: IsWin64;
Source: "References\edgedriver.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_edg;
;Firefox extensions
Source: "FirefoxAddons\bin\extensions.xpi"; DestDir: "{app}"; Flags: ignoreversion; Components: pkg_ide;
;examples
Source: "Scripts\*.*" ; DestDir: "{app}\Scripts"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_core;
Source: "Templates\*.vbs" ; DestDir: "{app}\Templates"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Templates\Xlbin\*.xlt"; DestDir: "{app}\Templates"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc; Check: HasOldExcel
Source: "Templates\*.xltm" ; DestDir: "{app}\Templates"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc; Check: HasNewExcel
Source: "Templates\*.au3" ; DestDir: "{app}\Templates"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc; Check: HasAutoIt
Source: "Examples\VBScript\*.vbs"; DestDir: "{app}\Examples\VBScript"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\JavaScript\*.js"; DestDir: "{app}\Examples\JavaScript"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc;
Source: "Examples\Excel\Xlbin\*.xls"; DestDir: "{app}\Examples\Excel"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc; Check: HasOldExcel
Source: "Examples\Excel\*.xlsm"; DestDir: "{app}\Examples\Excel"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc; Check: HasNewExcel
Source: "Examples\AutoIt\*.au3"; DestDir: "{app}\Examples\AutoIt"; Flags: ignoreversion overwritereadonly; Attribs:readonly; Components: pkg_doc; Check: HasAutoIt
;copy config file
Source: "References\exe.config" ; DestDir: "{sys}"; DestName: "wscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges;
Source: "References\exe.config" ; DestDir: "{sys}"; DestName: "cscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges;
Source: "References\exe.config" ; DestDir: "{syswow64}"; DestName: "wscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: IsWin64 And HasPrivileges;
Source: "References\exe.config" ; DestDir: "{syswow64}"; DestName: "cscript.exe.config"; Flags: ignoreversion uninsneveruninstall; Check: IsWin64 And HasPrivileges;
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|excel.exe}"; DestName: "EXCEL.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('excel.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|winword.exe}"; DestName: "WINWORD.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('winword.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|msaccess.exe}"; DestName: "MSACCESS.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('msaccess.exe');
Source: "References\exe.config" ; DestDir: "{code:GetAppFolder|outlook.exe}"; DestName: "OUTLOOK.EXE.CONFIG"; Flags: ignoreversion uninsneveruninstall; Check: HasPrivileges And HasApp('outlook.exe');
[Icons]
Name: "{group}\Project Home Page"; Filename: {#AppURL}; WorkingDir: "{app}";
Name: "{group}\Vbs Console"; Filename: "{app}\vbsc.exe"; Components: pkg_cons;
Name: "{group}\Examples"; Filename: "{app}\Examples";
Name: "{group}\Templates"; Filename: "{app}\Templates";
Name: "{group}\RunCleaner"; Filename: "{app}\Scripts\RunCleaner.vbs";
Name: "{group}\API documentation"; Filename: "{app}\Selenium.chm";
Name: "{group}\ChangeLog"; Filename: "{app}\CHANGELOG.txt";
Name: "{group}\Uninstall"; Filename: "{uninstallexe}"
Name: "{group}\Start Firefox"; Filename: "{app}\Scripts\StartFirefox.vbs"; Components: pkg_ff;
Name: "{group}\Start Chrome"; Filename: "{app}\Scripts\StartChrome.vbs"; Components: pkg_cr;
Name: "{group}\Start Chrome Debug"; Filename: "{app}\Scripts\StartChromeDebug.vbs"; Components: pkg_cr;
Name: "{group}\Start IE"; Filename: "{app}\Scripts\StartInternetExplorer.vbs"; Components: pkg_ie;
Name: "{group}\Start Opera"; Filename: "{app}\Scripts\StartOpera.vbs"; Components: pkg_op;
Name: "{group}\Start PhantomJS"; Filename: "{app}\Scripts\StartPhantomJS.vbs"; Components: pkg_pjs;
[Registry]
;Firefox plugins
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "{{a6fd85ed-e919-4a43-a5af-8da18bda539f}"; ValueType: string; ValueData:"{app}\selenium-ide.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "[email protected]"; ValueType: string; ValueData:"{app}\vbformatters.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;Root: HKCU; Subkey: "Software\Mozilla\Firefox\Extensions"; ValueName: "[email protected]"; ValueType: string; ValueData:"{app}\implicit-wait.xpi"; Flags: uninsdeletevalue; Components: pkg_ide;
;IE tweaks: Force the tabs to run in the same process as the manager process
;Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "TabProcGrowth"; ValueType: dword; ValueData: 0; Flags: uninsdeletevalue; Components: pkg_ie;
;IE tweaks: Allow file navigation
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_RESTRICT_FILEDOWNLOAD"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweaks: Maintain a connection to the instance (for IE11)
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweaks: Restore default zoom level
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Zoom"; ValueName: "ZoomFactor"; Flags: dontcreatekey deletevalue; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Zoom"; ValueName: "ResetTextSizeOnStartup"; ValueType: dword; ValueData: 1 ; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Zoom"; ValueName: "ResetZoomOnStartup"; ValueType: dword; ValueData: 1 ; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Zoom"; ValueName: "ResetZoomOnStartup2"; ValueType: dword; ValueData: 1 ; Components: pkg_ie;
;IE tweaks: Disable enhanced protected mode
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Isolation"; Flags: dontcreatekey deletevalue; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Isolation64Bit"; Flags: dontcreatekey deletevalue; Components: pkg_ie;
;IE tweaks: Disable autocomplete
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoComplete"; ValueName: "AutoSuggest"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Use FormSuggest"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "FormSuggest Passwords"; ValueType: string; ValueData: "no"; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "FormSuggest PW Ask"; ValueType: string; ValueData: "no"; Components: pkg_ie;
;IE tweaks: Disable warn
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnonBadCertRecving"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnonZoneCrossing"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "WarnOnPostRedirect"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweaks: Disable Check for publisher's certificate revocation
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing"; ValueName: "State"; ValueType: dword; ValueData: 146944; Components: pkg_ie;
;IE tweaks: Disable Check for server certificate revocation
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "CertificateRevocation"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweaks: Disable Check for signatures on downloaded programs
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Download"; ValueName: "CheckExeSignatures"; ValueType: string; ValueData: "no"; Components: pkg_ie;
;IE tweaks: Disable Check default browser
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "Check_Associations"; ValueType: string; ValueData: "no"; Components: pkg_ie;
;IE tweaks: Disable accelerator button
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Activities"; ValueName: "NoActivities"; ValueType: dword; ValueData: 1; Components: pkg_ie;
;IE tweaks: Set the same protected mode for all zones Disable=3 Enable=0
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main"; ValueName: "NoProtectedModeBanner"; ValueType: dword; ValueData: 1; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\4"; ValueName: "2500"; ValueType: dword; ValueData: 3; Components: pkg_ie;
;IE tweaks: Enable all cookies
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "PrivacyAdvanced"; ValueType: dword; ValueData: 1; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"; ValueName: "1A10"; ValueType: dword; ValueData: 1; Components: pkg_ie;
;IE tweak: Allow HTTP Basic Authentication in url
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE"; ValueName: "iexplore.exe"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweak: Turn off popup blocker
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\New Windows"; ValueName: "PopupMgr"; ValueType: dword; ValueData: 0; Components: pkg_ie;
;IE tweak: Delete browsing history on exit
Root: HKCU; Subkey: "Software\Microsoft\Internet Explorer\Privacy"; ValueName: "ClearBrowsingHistoryOnExit"; ValueType: dword; ValueData: 1; Components: pkg_ie;
;IE tweak: Disable cache
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\CACHE"; ValueName: "Persistent"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings"; ValueName: "SyncMode5"; ValueType: dword; ValueData: 3; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History"; ValueName: "DaysToKeep"; ValueType: dword; ValueData: 0; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content"; ValueName: "CacheLimit"; ValueType: dword; ValueData: 2000; Components: pkg_ie;
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content"; ValueName: "CacheLimit"; ValueType: dword; ValueData: 2000; Components: pkg_ie;
;File association for the console
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\App Paths\vbsc.exe"; ValueType: string; ValueData: "{app}\vbsc.exe"; Flags: deletekey uninsdeletekey; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\Debug"; ValueType: string; ValueData: "Debug"; Flags: deletekey uninsdeletekey;
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\Debug\Command"; ValueType: expandsz; ValueData: """%SystemRoot%\System32\wscript.exe"" //D //X ""%1"" %*"; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\VBSFile\shell\runas"; ValueType: string; ValueName: "HasLUAShield"; ValueData: ""; Flags: deletekey uninsdeletekey;
Root: HKCU; Subkey: "Software\Classes\VBSFile\shell\runas\Command"; ValueType: expandsz; ValueData: """%SystemRoot%\System32\wscript.exe"" ""%1"" %*";
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\RunExt"; ValueType: string; ValueData: "Run VBScript"; Flags: deletekey uninsdeletekey; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\VBSFile\Shell\RunExt\Command"; ValueType: string; ValueData: """{app}\vbsc.exe"" -i ""%1"" %*"; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\Directory\shell\RunExt"; ValueType: string; ValueData: "Run VBScripts"; Flags: deletekey uninsdeletekey; Components: pkg_cons;
Root: HKCU; Subkey: "Software\Classes\Directory\shell\RunExt\Command"; ValueType: string; ValueData: """{app}\vbsc.exe"" -i ""%1\*.vbs"""; Components: pkg_cons;
;Add excel trusted location for templates and examples
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Excel}.0\Excel\Security\Trusted Locations\Selenium1"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Templates"; Flags: uninsdeletekey; Check: HasExcel;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Excel}.0\Excel\Security\Trusted Locations\Selenium2"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Examples"; Flags: uninsdeletekey; Check: HasExcel;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Word}.0\Word\Security\Trusted Locations\Selenium1"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Templates"; Flags: uninsdeletekey; Check: HasWord;
Root: HKCU; Subkey: "Software\Microsoft\Office\{code:GetOfficeVersion|Word}.0\Word\Security\Trusted Locations\Selenium2"; ValueName: "Path"; ValueType: String; ValueData: "{app}\Examples"; Flags: uninsdeletekey; Check: HasWord;
;Enable WScript host in case it's been disabled
Root: HKCU; Subkey: "Software\Microsoft\Windows Script Host\Settings"; ValueName: "Enabled"; ValueType: dword; ValueData: 1;
[Run]
;Filename: "{app}\RegNet.exe"; Parameters: "-r"; WorkingDir: {app}; Flags: waituntilterminated runascurrentuser runhidden; StatusMsg: "Register for COM interoperability";
Filename: "{code:GetAppPath|firefox.exe}"; Parameters: "-url ""{app}\extensions.xpi"""; WorkingDir: {app}; Flags: shellexec postinstall skipifsilent runascurrentuser; Components: pkg_ide; Check: HasFirefox; Description: "Install the Selenium IDE Addon for Firefox";
[UninstallRun]
;Filename: "{app}\RegNet.exe"; Parameters: "-u"; WorkingDir: {app}; Flags: waituntilterminated runascurrentuser runhidden; StatusMsg: "Unregister for COM interoperability";
[InstallDelete]
Type: filesandordirs; Name: "{localappdata}\Temp\Selenium"
[UninstallDelete]
Type: filesandordirs; Name: "{app}"
Type: filesandordirs; Name: "{localappdata}\Temp\Selenium"
[Code]
var
ALL_USERS : Boolean;
HK : Integer;
HK32 : Integer;
Function HasPrivileges(): Boolean;
Begin
Result := IsAdminLoggedOn Or IsPowerUserLoggedOn
End;
Function GetRootDir(Param: String): String;
Begin
If ALL_USERS Then
Result := ExpandConstant('{pf}\{#AppFolder}')
Else
Result := ExpandConstant('{localappdata}\{#AppFolder}');
End;
Procedure InitRootKeys();
Begin
If ALL_USERS Then Begin
HK := HKLM;
HK32 := HKLM32;
End Else Begin
HK := HKCU;
HK32 := HKCU32;
End
End;
Function GetAppPath(app: String): string;
Begin
RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\' + app, '', Result);
End;
Function HasFirefox(): Boolean;
Begin
Result := FileExists(GetAppPath('firefox.exe'));
End;
Function GetAppFolder(app: String): string;
Begin
Result := ExtractFileDir(GetAppPath(app));
End;
Function HasApp(app: String): Boolean;
Begin
Result := GetAppPath(app) <> '';
End;
Function GetOfficeVersion(app: String): String;
Var ver: String; i: Integer;
Begin
If RegQueryStringValue(HKCR, app + '.Application\CurVer', '', ver) Then Begin
For i := 1 To Length(ver) Do Begin
If (ver[i] >= '0') And (ver[i] <= '9') Then
Result := Result + ver[i];
End;
End;
End;
Function HasExcel(): Boolean;
Begin
Result := RegKeyExists(HKCR, 'Excel.Application');
End;
Function HasWord(): Boolean;
Begin
Result := RegKeyExists(HKCR, 'Word.Application');
End;
Function HasNewExcel(): Boolean;
Begin
Result := RegKeyExists(HKCR, '.xlsm');
End;
Function HasOldExcel(): Boolean;
Begin
Result := RegKeyExists(HKCR, '.xls') And Not RegKeyExists(HKCR, '.xlsm');
End;
Function HasAutoIt(): Boolean;
Begin
Result := RegKeyExists(HKCR, '.au3');
End;
Procedure _PatchOfficeFileVersion(Const subkey: String);
Var name, value: String;
Begin
name := 'Maximum File Version Number';
If RegQueryStringValue(HKLM, subkey, name, value) Then Begin
RegWriteStringValue(HKLM, subkey, 'Maximum File Version', value);
RegDeleteValue(HKLM, subkey, name);
End
End;
Procedure PatchOfficeFileVersion();
Begin
If Not HasPrivileges() Then Exit;
//Excel 11
_PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v4.0.30319.00000\excel.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
_PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v2.0.50727.00000\excel.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
//Word 11
_PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v4.0.30319.00000\winword.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
_PatchOfficeFileVersion('SOFTWARE\Microsoft\.NETFramework\Policy\AppPatch\v2.0.50727.00000\winword.exe\{2CCAA9FE-6884-4AF2-99DD-5217B94115DF}');
End;
Procedure AssertFrameworkPresent(Const version: String);
Begin
If Not RegKeyExists(HKLM,'SOFTWARE\Microsoft\NET Framework Setup\NDP\v' + version) Then
RaiseException(ExpandConstant('{cm:MsgNETFrameworkNotInstalled}'));
End;
Procedure AssertFilePresent(Const path: String);
Begin
If Not FileExists(path) Then
RaiseException(ExpandConstant('{cm:MsgFileNotFound,' + path +'}'));
End;
Function UninstallPrevious(const appid: String): Boolean;
Var key, name, out_cmd: String; retcode: Integer;
Begin
key := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + ExpandConstant(appid) + '_is1';
name := 'UninstallString';
If Not RegQueryStringValue(HKLM, key, name, out_cmd) Then
If Not RegQueryStringValue(HKLM32, key, name, out_cmd) Then
If Not RegQueryStringValue(HKCU, key, name, out_cmd) Then
RegQueryStringValue(HKCU32, key, name, out_cmd);
If out_cmd <> '' Then
Exec('>', out_cmd + ' /SILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_SHOW, ewWaitUntilTerminated, retcode);
Result := retcode = 0;
End;
Function BoolToStr(const value: Boolean): String;
Begin
If value Then Result := '1' Else Result := '0';
End;
//---------------------------------------------------------------------------------------
// Registration
//---------------------------------------------------------------------------------------
type
TNetLib = record
Guid: String;
FullName: String;
Description: String;
TypeVersion: String;
Directory: String;
PathDll: String;
PathTlb32: String;
PathTlb64: String;
Runtime: String;
end;
Procedure RegString(Const root: Integer; Const subkey, name, value: String);
Begin
//Log('REG [' + subkey + '] "' + name + '"="' + value + '"');
If Not RegWriteStringValue(root, subkey, name, value) Then
RaiseException(ExpandConstant('{cm:MsgRegistryWriteFailure}'));
End;
// Interface registration (32/64bits Independent) :
//
// HKCU\Software\Classes\Interface\{ interface guid }
// ""=" interface name "
// \ProxyStubClsid32
// ""=" interface short name "
// \TypeLib
// ""="{ assembly guid }"
// \Version
// ""=" assembly type version "
//
Procedure RegInterface_(Const lib : TNetLib; Const root: Integer; Const guid, typename, proxyStub: String);
Var key: String;
Begin
key := 'Software\Classes\Interface\' + guid;
RegDeleteKeyIncludingSubkeys(root, key);
If Not IsUninstaller Then Begin
RegString(root, key , '' , typename );
RegString(root, key + '\ProxyStubClsid32' , '' , proxyStub );
RegString(root, key + '\TypeLib' , '' , lib.Guid );
RegString(root, key + '\TypeLib' , 'Version' , lib.TypeVersion );
End
End;
Procedure RegInterface(Const lib : TNetLib; Const guid, name, proxystub: String);
Begin
RegInterface_(lib, HK, guid, name, proxystub);
If IsWin64 Then
RegInterface_(lib, HK32, guid, name, proxystub);
End;
// Enumeration registration (32/64bits Shared) :
//
// HKCU\Software\Classes\Record\{ record guid }]
// ""="mscoree.dll"
// "Class"="Selenium.Structures.Point"
// "Assembly"="Selenium, Version=2.0.1.2, Culture=neutral, PublicKeyToken=null"
// "RuntimeVersion"="v2.0.50727"
// "CodeBase"="C:\...\SeleniumBasic\Selenium.dll"
//
Procedure RegRecord(Const lib : TNetLib; Const guid, typename: String);
Var key: String;
Begin
key := 'Software\Classes\Record\' + guid;
RegDeleteKeyIncludingSubkeys(HK, key);
If Not IsUninstaller Then Begin
RegString(HK, key, 'Class' , typename );
RegString(HK, key, 'Assembly' , lib.FullName );
RegString(HK, key, 'RuntimeVersion' , lib.Runtime );
RegString(HK, key, 'CodeBase' , lib.PathDll );
End
End;
// CLSID registration (32/64bits Independent) :
//
// Root\Software\Classes\CLSID\{ class guid }
// ""="Selenium.WebDriver"
// \InprocServer32
// ""="C:\Windows\System32\mscoree.dll"
// "Class"="Selenium.WebDriver"
// "Assembly"="Selenium, Version=2.0.1.2, Culture=neutral, PublicKeyToken=null"
// "RuntimeVersion"="v2.0.50727"
// "CodeBase"="C:\...\SeleniumBasic\Selenium.dll"
// "ThreadingModel"="Both"
// \Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}
// ""=""
// \ProgId
// ""="Selenium.WebDriver"
// \VersionIndependentProgID
// ""="Selenium.WebDriver"
//
Procedure RegClsid(Const lib : TNetLib; Const root: Integer; Const guid, progid, typename, sysdir: String);
Var key, skey : String;
Begin
key := 'Software\Classes\CLSID\' + guid;
RegDeleteKeyIncludingSubkeys(root, key);
If Not IsUninstaller Then Begin
RegString(root, key, '', typename);
skey := key + '\InprocServer32';
RegString(root, skey, '' , ExpandConstant(sysdir) + '\mscoree.dll' );
RegString(root, skey, 'Class' , typename );
RegString(root, skey, 'Assembly' , lib.FullName );
RegString(root, skey, 'RuntimeVersion' , lib.Runtime );
RegString(root, skey, 'CodeBase' , lib.PathDll );
RegString(root, skey, 'ThreadingModel' , 'Both' );
skey := key + '\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}';
RegString(root, skey, '', '');
skey := key + '\ProgId';
RegString(root, skey, '', progid);
skey := key + '\VersionIndependentProgID';
RegString(root, skey, '', progid);
End
End;
// Class registration (32/64bits Shared) :
//
// HKCU\Software\Classes\[progid]
// ""=[progid]
// \CLSID
// ""=[class guid]
//
Procedure RegClass(Const lib : TNetLib; Const guid, progid, typename: String);
Var key, sysdir: String;
Begin
key := 'Software\Classes\' + progid;
RegDeleteKeyIncludingSubkeys(HK, key);
If Not IsUninstaller Then Begin
RegString(HK, key, '', progid);
RegString(HK, key + '\CLSID', '', guid);
End
RegClsid(lib, HK, guid, progid, typename, '{sys}');
If IsWin64 Then
RegClsid(lib, HK32, guid, progid, typename, '{syswow64}');
End;
// TypeLib registration (32/64bits Shared) :
//
// HKCU\Software\Classes\TypeLib\[assembly guid]
// \2.0
// ""="App Type Library"
// \0\win32
// ""="C:\...\App32.tlb"
// \0\win64
// ""="C:\...\App64.tlb"
// \FLAGS
// ""="0"
// \HELPDIR
// ""="C:\..."
//
Procedure RegTypeLib(Const lib : TNetLib);
Var key, skey : String;
Begin
key := 'Software\Classes\TypeLib\' + lib.Guid;
RegDeleteKeyIncludingSubkeys(HK, key);
If Not IsUninstaller Then Begin
skey := key + '\' + lib.TypeVersion;
RegString(HK, skey, '', lib.Description);
RegString(HK, skey + '\FLAGS' , '' , '0' );
RegString(HK, skey + '\HELPDIR' , '' , lib.Directory );
RegString(HK, skey + '\0\win32' , '' , lib.PathTlb32 );
If IsWin64 Then
RegString(HK, skey + '\0\win64', '' , lib.PathTlb64 );
End
End;
Procedure RegisterAssembly();
Var lib : TNetLib;
Begin
{ Includes the file generated by gen-registration.ipy }
#include 'SeleniumBasicSetup.pas'
End;
//---------------------------------------------------------------------------------------
// Workflow
//---------------------------------------------------------------------------------------
Function InitializeSetup() : Boolean;
Begin
ALL_USERS := HasPrivileges();
InitRootKeys();
//AssertFrameworkPresent('3.5');
Result := True;
End;
Function InitializeUninstall() : Boolean;
var p : string;
Begin
ALL_USERS := GetPreviousData('AllUsers', '') = '1';
InitRootKeys();
Result := True;
End;
Procedure RegisterPreviousData(PreviousDataKey: Integer);
Begin
SetPreviousData(PreviousDataKey, 'AllUsers', BoolToStr(ALL_USERS));
End;
Procedure CurPageChanged(CurPageID: Integer);
var lines : TStrings;
Begin
If CurPageID = wpReady Then Begin
lines := Wizardform.ReadyMemo.Lines;
If ALL_USERS Then
lines.Insert(0, 'Install folder / All Users :')
Else
lines.Insert(0, 'Install folder / Current User :');
lines.Insert(1, ExpandConstant('{app}'));
lines.Insert(2, '');
End;
End;
Procedure CurStepChanged(CurStep: TSetupStep);
Begin
If CurStep = ssInstall Then Begin
UninstallPrevious('SeleniumWrapper');
UninstallPrevious('{#AppId}');
End Else If CurStep = ssPostInstall Then Begin
RegisterAssembly();
PatchOfficeFileVersion();
End;
End;
Procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
Begin
If CurUninstallStep = usUninstall Then Begin
RegisterAssembly(); //Only deletes the main keys
End;
End;