-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLnchPadInit.ahk
3278 lines (2829 loc) · 99.1 KB
/
LnchPadInit.ahk
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
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#SingleInstance, force
#NoEnv ; Performance and compatibility with future AHK releases.
#Warn, All, OutputDebug
;#Warn, All , MsgBox ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to superior speed & reliability.
; SetBatchLines, -1 ; affects CPU utilization... script will run at max speed
SetWorkingDir %A_ScriptDir%
ListLines, Off
#KeyHistory 0
#MaxMem 512
AutoTrim, Off
Class LnchPadProps
{
Morrowind
{
set
{
this._Morrowind := value
}
get
{
return this._Morrowind
}
}
Oblivion
{
set
{
this._Oblivion := value
}
get
{
return this._Oblivion
}
}
Fallout3
{
set
{
this._Fallout3 := value
}
get
{
return this._Fallout3
}
}
Fallout4
{
set
{
this._Fallout4 := value
}
get
{
return this._Fallout4
}
}
FalloutNV
{
set
{
this._FalloutNV := value
}
get
{
return this._FalloutNV
}
}
SSE
{
set
{
this._SSE := value
}
get
{
return this._SSE
}
}
GetCurrent(tabStat)
{
switch tabStat
{
case 1:
return this.Morrowind
case 2:
return this.Oblivion
case 3:
return this.SSE
case 4:
return this.Fallout3
case 5:
return this.FalloutNV
case 6:
return this.Fallout4
}
}
}
Class ListBoxProps
{
Static LB_GETITEMHEIGHT := 0x01A1
Static LB_SETITEMHEIGHT := 0x01A0
Static LB_GETCOUNT := 0x18B
Static LB_GETSELCOUNT := 0x190
Static LB_GETSELITEMS := 0x191
Static LB_GETCARETINDEX := 0x19F
Static LB_SETSEL := 0x185
Static LB_GETSEL := 0x187
Static sizeOfDWORD := 4
Static LB_ERR := -1
;Static prgNo := 0
tmp := 0
; https://autohotkey.com/board/topic/89793-set-height-of-listbox-rows/
Init ; cannot use__Init() because it is used to initialise above class variables
{
set
{
this.prgNo := value
}
}
NewItemHeight
{
set
{
this._NewItemHeight := value
}
}
hWnd
{
set
{
this._hWnd := value
}
get
{
return this._hWnd
}
}
GetItemHeight()
{
SendMessage, % this.LB_GETITEMHEIGHT, 0, 0, , % "ahk_id" this._hWnd
return ErrorLevel
}
SetItemHeight()
{
SendMessage, % this.LB_SETITEMHEIGHT, 0, % this._NewItemHeight, , % "ahk_id" this._hWnd
WinSet, Redraw, , % "ahk_id" this._hWnd
return ErrorLevel
}
GetItems()
{
lbItemArray := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
if (!this.prgNo)
Msgbox, 8208, LnchPad List, Something broke: prgNo is zero in class!
SendMessage, % this.LB_GETSELCOUNT, 0, 0, , % "ahk_id" this._hWnd
wParam := ErrorLevel
if (wParam < 1)
return wParam
VarSetCapacity(lbSelItems, wParam * this.sizeOfDWORD, 0)
SendMessage, % this.LB_GETSELITEMS, % wParam, % &lbSelItems, , % "ahk_id" this._hWnd
Loop, % wParam
lbItemArray[A_Index] := NumGet(lbSelItems, (A_Index - 1) * this.sizeOfDWORD, "UInt") + 1
VarSetCapacity(lbSelItems, 0)
return lbItemArray
}
GetOneItem()
{
; LB_GETCARETINDEX Retrieves the index of the item that has the focus in a multiple-selection list box.The item may or may not be selected.
SendMessage, % this.LB_GETCARETINDEX, 0, 0, , % "ahk_id" this._hWnd
tmp := ErrorLevel + 1
lbItemArray := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
lbItemArray := this.GetItems()
for i in lbItemArray
{
if (tmp == lbItemArray[i])
break
}
;LB_GETSEL: If an item is selected, the return value is greater than zero
SendMessage, % this.LB_GETSEL, % tmp - 1, 0, , % "ahk_id" this._hWnd
i := ErrorLevel
if (i)
return tmp
else
return -tmp
}
Down()
{
tmp := this.GetOneItem()
if (tmp == this.prgNo)
SendMessage, % this.LB_SETSEL, True, 0, , % "ahk_id" this._hWnd
else
SendMessage, % this.LB_SETSEL, True, %tmp%, , % "ahk_id" this._hWnd
}
Up()
{
tmp := this.GetOneItem()
if (tmp == 1)
SendMessage, % this.LB_SETSEL, True, % this.prgNo - 1, , % "ahk_id" this._hWnd
else
SendMessage, % this.LB_SETSEL, True, % tmp - 2, , % "ahk_id" this._hWnd
}
}
OnMessage(0x201, "WM_LBUTTONDOWN")
OnMessage(0x0053, "WM_Help")
WM_HELPMSG := 0x0053
WS_EX_CONTEXTHELP := 0x00000400
gameList := ["Morrowind", "Oblivion", "Skyrim", "Fallout 3", "Fallout NV", "Fallout 4", "", "", "", "", "", ""]
gameExes := ["MGEXEgui.exe", "obse_loader.exe", "SKSE_loader.exe", "Fallout3.exe", "nvse_loader.exe", "f4se_loader.exe", "", "", "", "", "", ""]
gameFallBackExes := ["Morrowind.exe", "Oblivion.exe", "SkyrimSE.exe", "fose_loader.exe", "FalloutNV.exe", "Fallout4.exe", "", "", "", "", "", ""]
; FO3.exe, "avoid fose_loader.exe!"
; Skyrim.exe and SkyrimTESV.exe ???
gameExesFullPath := ["", "", "", "", "", "", "", "", "", "", "", ""]
iniNames := ["", "", "", "", "", "", "", "", "", "", "", ""]
PrgLnchIniPath := A_ScriptDir . "\PrgLnch.ini"
gameIniPath := ""
gameListStr := ""
tooltipDriveStr := ""
maxGames := 6
maxDrives := 9 ; it's actually 24 letters, but focus on NFTS
DriveLetter := Object()
DriveLetterBak := Object()
FATDrives := ""
maxBatchPrgs := 6
prgNo := 12
thisGuiW := 0
thisGuiH := 0
tabGuiW := 0
tabGuiH := 0
GuiHwnd := 0
fontDPI := 96 ; To be adjustment factor for windows setting
mControl := 0
buttonBkdChange := 0
currDrive := ""
cancelSearchMsg := 0
SearchSelectedClicked := 0
searchstat := 0
tabStat := 0
lboxSelTol := 0
multcopiesPrgWrn := 0
overWriteIniFile := 0
IniFileShortctSep := "?" ; Change if different in Main!
SelIniChoiceNamePrgLnchUpdated := 0
addGameShortCutIndex := 0 ; game path control variables
addGameShortCutLB := 0
retVal := 0
strTmp := ""
strRetVal := ""
tmp := 0
i := 0
prgName1 := ["Wrye Mash", "MLOX", "Morrowind Code Patch", "Bsa Browser", "MWEdit", "TES3Merge", "TESAME", "TESPCD", "Enchanted Editor", "Morrowind Resources Scanner", "Overunity", "MW Mesh Generator"]
prgName2 := ["Wrye Bash", "BOSS", "Construction Set Extender", "TES4Edit", "BSA Commander", "Multi Purpose Gui", "Landscape LOD Generator", "NifSkope", "TES4LODGen", "DDSOpt", "Merge Plugins", "Land Magic"]
prgName3 := ["Wrye Bash", "Mod Organizer", "LOOT", "xEdit", "Bethesda Archive Extractor", "BodySlide", "DynDOLOD", "NifSkope.exe", "Skyrim Performance Monitor 64", "xTranslator", "Creation Kit", "SSELODGen"]
prgName4 := ["Wrye Flash", "Fallout Mod Manager", "Garden of Eden CK Extender", "FO3Edit", "LOOT", "FO3LODGen", "Merge Plugins", "NifSkope", "BSArch", "Fallout 3 Configator", "FO3Dump", "Nifty Automagic Dismember Tool"]
prgName5 := ["Wrye Flash", "Fallout Mod Manager", "Garden of Eden CK Extender", "FNVEdit", "LOOT", "FNVLODGen", "Merge Plugins", "NifSkope", "BSArch", "New Vegas Configator", "FaceGen Exchange", "FO3 Save Import Utility"]
prgName6 := ["Wrye Bash", "Mod Organizer", "LOOT", "xEdit", "Bethesda Archive Extractor", "BodySlide", "Fallout 4 Config Tool", "NifSkope", "Creation Kit", "xTranslator", "Bsa Browser", "Material Editor"]
prgExe1 := ["mash64.exe", "mlox.exe", "Morrowind Code Patch.exe", "BSA Browser.exe", "MWEdit.exe", "TES3Merge.exe", "TES Advanced Mod Editor.exe", "tespcdv031.exe", "Enchanted.exe", "tes3cmd.exe", "Overunity.exe", "Grass.exe"]
prgExe2 := ["Wrye Bash.exe", "boss.exe", "TESConstructionSet.exe", "TES4Edit.exe", "bsacmd.exe", "mpgui.exe", "tes4ll.exe", "NifSkope.exe", "TES4LODGen.exe", "DDSOpt X64.exe", "MergePlugins.exe", "LandMagic.exe"]
prgExe3 := ["Wrye Bash.exe", "ModOrganizer.exe", "Loot.exe", "SSEEdit.exe", "bae.exe", "BodySlideX64.exe", "DynDOLOD.exe", "NifSkope.exe", "PerformanceMonitor64.exe", "xTranslator.exe", "CreationKit.exe", "SSELODGen.exe"]
prgExe4 := ["Wrye Flash.exe", "fomm.exe", "GECK.exe", "FO3Edit.exe", "Loot.exe", "FO3LODGen.exe", "MergePlugins.exe", "NifSkope.exe", "bsarch.exe", "FO3Configator.exe", "FO3Dump.exe", "nifty.exe"]
prgExe5 := ["Wrye Flash.exe", "fomm.exe", "GECK.exe", "FNVEdit.exe", "Loot.exe", "FNVLODGen.exe", "MergePlugins.exe", "NifSkope.exe", "bsarch.exe", "NVConfigator.exe", "FaceGen Exchange.exe", "FO3 Save Importer.exe"]
prgExe6 := ["Wrye Bash.exe", "ModOrganizer.exe", "Loot.exe", "FO4Edit.exe", "bae.exe", "BodySlideX64.exe", "Fallout4ConfigTool.exe", "NifSkope.exe", "CreationKit.exe", "xTranslator.exe ", "BSA Browser.exe", "Material Editor.exe "]
prgPath1 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath2 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath3 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath4 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath5 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath6 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath1bak := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath2bak := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath3bak := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath4bak := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath5bak := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgPath6bak := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgCmd1 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgCmd2 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgCmd3 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgCmd4 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgCmd5 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgCmd6 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgUrl1 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgUrl2 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgUrl3 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgUrl4 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgUrl5 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgUrl6 := ["", "", "", "", "", "", "", "", "", "", "", ""]
prgInfUrl1 := ["https://www.nexusmods.com/morrowind/mods/45439", "https://github.com/rfuzzo/mlox", "https://www.nexusmods.com/morrowind/mods/19510", "https://www.nexusmods.com/skyrimspecialedition/mods/1756", "http://mwedit.sourceforge.net", "https://www.nexusmods.com/morrowind/mods/46870", "http://mw.modhistory.com/download-95-5289", "https://www.nexusmods.com/morrowind/mods/3874", "http://mw.modhistory.com/download--1662", "https://mw.modhistory.com/download-p2-i25-95", "https://mw.modhistory.com/download-95-15293", "https://www.nexusmods.com/morrowind/mods/23065"]
prgInfUrl2 := ["https://www.nexusmods.com/oblivion/mods/22368", "https://boss-developers.github.io", "https://www.nexusmods.com/oblivion/mods/36370", "http://tes5edit.github.io", "https://www.nexusmods.com/oblivion/mods/3311", "https://www.nexusmods.com/oblivion/mods/41447", "https://www.nexusmods.com/oblivion/mods/40549", "http://niftools.sourceforge.net/wiki/NifSkope", "https://www.nexusmods.com/oblivion/mods/15781", "https://www.nexusmods.com/skyrim/mods/5755", "https://github.com/matortheeternal/merge-plugins", "https://www.nexusmods.com/oblivion/mods/30519"]
prgInfUrl3 := ["https://www.nexusmods.com/skyrimspecialedition/mods/6837", "https://www.nexusmods.com/skyrimspecialedition/mods/6194", "https://loot.github.io", "http://tes5edit.github.io", "https://www.nexusmods.com/skyrimspecialedition/mods/974", "https://www.nexusmods.com/skyrimspecialedition/mods/201", "https://www.nexusmods.com/skyrim/mods/59721", "http://niftools.sourceforge.net/wiki/NifSkope", "https://www.nexusmods.com/skyrimspecialedition/mods/3826", "https://www.nexusmods.com/skyrimspecialedition/mods/134", "https://store.steampowered.com/app/1946180/Skyrim_Special_Edition_Creation_Kit", "https://www.nexusmods.com/skyrimspecialedition/mods/6642"]
prgInfUrl4 := ["https://www.nexusmods.com/fallout3/mods/11336", "https://www.nexusmods.com/newvegas/mods/54991", "https://www.nexusmods.com/fallout3/mods/23425", "https://www.nexusmods.com/fallout3/mods/637", "https://loot.github.io", "https://www.nexusmods.com/fallout3/mods/21174", "https://www.nexusmods.com/skyrim/mods/69905", "http://niftools.sourceforge.net/wiki/NifSkope", "https://www.nexusmods.com/fallout4/mods/63243", "https://www.nexusmods.com/fallout3/mods/6769", "http://modsreloaded.com/fo3dump", "https://www.nexusmods.com/fallout3/mods/2631"]
prgInfUrl5 := ["https://www.nexusmods.com/newvegas/mods/35003", "https://www.nexusmods.com/newvegas/mods/54991", "https://www.nexusmods.com/newvegas/mods/64888", "https://www.nexusmods.com/newvegas/mods/34703", "https://loot.github.io", "https://www.nexusmods.com/newvegas/mods/58562", "https://www.nexusmods.com/skyrim/mods/69905", "http://niftools.sourceforge.net/wiki/NifSkope", "https://www.nexusmods.com/fallout4/mods/63243", "https://www.nexusmods.com/newvegas/mods/40442", "https://www.nexusmods.com/newvegas/mods/36471", "https://www.nexusmods.com/newvegas/mods/37649"]
prgInfUrl6 := ["https://www.nexusmods.com/fallout4/mods/20032", "https://github.com/ModOrganizer2/modorganizer", "https://loot.github.io", "https://www.nexusmods.com/fallout4/mods/2737", "https://www.nexusmods.com/fallout4/mods/78", "https://www.nexusmods.com/fallout4/mods/25", "https://www.nexusmods.com/fallout4/mods/102", "http://niftools.sourceforge.net/wiki/NifSkope", "https://store.steampowered.com/app/1946160/Fallout_4_Creation_Kit", "https://www.nexusmods.com/skyrimspecialedition/mods/134", "https://www.nexusmods.com/skyrimspecialedition/mods/1756", "https://www.nexusmods.com/fallout4/mods/3635"]
listboxIndices := [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
WS_CLIPSIBLINGS := 0x4000000
WS_EX_TOPMOST := 0x8
WS_CLIPCHILDREN := 0x2000000
LBS_MULTIPLESEL := 0x8
Black := "000000"
White := "ffffff"
Onyx := "353839"
Silver := "c0c0c0"
Yellow := "ffff00"
Gold := "FFD700"
Goldenrod := "DAA520"
Green := "00c000"
Olive := "808000"
Viridian := "40826D"
Avocado := "008000"
Lime := "00ff00"
Feldgrau := "5d5d3d"
Blue := "ff0000"
Navy := "000080"
Turquoise := "40E0D0"
Teal := "008080"
Cerulean := "007BA7"
Cyan := "00ffff"
Red := "ff0000"
Maroon := "000080"
Vermilion := "E34234"
Magenta := "F653A6"
Pink := "ff20ff"
Fuchsia := "ff00ff"
Purple := "800080"
Grape := "6F2DA8"
Violet := "7F00FF"
Plum := "8E4585"
Orange := "FFA500"
Salmon := "fa8072"
DkSalmon := "E9967A"
Peach := "FFE5B4"
Beige := "F5F5DC"
Chestnut := "954535"
Chocolate := "7B3F00"
Taupe := "483C32"
Auburn := "A52A2A"
Gray := "808080"
Steingrau := "555548"
Khakigrau := "746643"
(A_PtrSize = 8)? 64bit := 1 : 64bit := 0 ; ONLY checks .exe bitness
if FileExist("PrgLnch.ico")
Menu, Tray, Icon, PrgLnch.ico
Loop, Files, % A_ScriptDir . "\*.exe"
{
if (InStr(A_LoopFileName, "PrgLnch.exe"))
{
tmp := 1
break
}
}
if (!tmp && A_IsCompiled)
{
msgbox, 8192, PrgLnch Executable Required!, This cannot be run without Prglnch in the same folder!
ExitApp
}
lnchPadPID := DllCall("GetCurrentProcessId")
for tmp, strRetVal in A_Args ; For each parameter (or file dropped onto a script):
{
if (tmp == 2)
break
}
; The "active" slot, in current selection in PrgLnch
SelIniChoiceNamePrgLnch := strRetVal
ListBoxProps.Init() := prgNo
RegRead, fontDPI, HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics, AppliedDPI
if (ErrorLevel)
{
msgbox, 8192, Registry Access, The Applied DPI value in registry is unavailable!`n`nAssuming default font scaling of 96.
fontDPI := 1
}
else
fontDPI := 96/fontDPI
Gui, +LastFound +%WS_CLIPSIBLINGS% +DPIScale -MaximizeBox -MinimizeBox +OwnDialogs +E%WS_EX_CONTEXTHELP%
GuiHwnd := WinExist()
; This is for right click help invocation
DllCall("RegisterShellHookWindow", "UInt", GuiHwnd)
MsgSH := DllCall( "RegisterWindowMessage", "Str", "SHELLHOOK" )
OnMessage(MsgSH, "ShellMessage")
loop, % maxGames
gameListStr .= gameList[A_Index] . "|"
GetGamePaths()
Gui, Add, Text, x0 y0 Center +E%WS_EX_TOPMOST% gsearchDrive vsearchDrive HWNDsearchDriveHwnd, % "&Search PC for " gameList[1] " Apps"
Gui, Add, Text, Center gaddToLnchPad vaddToLnchPad HWNDaddToLnchPadHwnd wp, % "&Locate " gameList[1] " LnchPad Slot"
loop % maxDrives
{
Gui, Add, Checkbox, vDrive%A_Index% gDrive HWNDDrive%A_Index%Hwnd
guiControl, Hide, Drive%A_Index%
}
Gui, Add, Radio, gOverWriteIni voverWriteIni HWNDoverWriteIniHwnd, Overwrite existing Slot with PrgLnch defaults
Gui, Add, Radio, gUpdateIni vupdateIni HWNDupdateIniHwnd, Update existing Ini File with acquired Prg info.
Gui, Add, Checkbox, gAddGameShortCut vaddGameShortCut HWNDaddGameShortCutHwnd, Include shortcut to game extender
GuiControl, Hide, overWriteIni
GuiControl, Hide, updateIni
GuiControl, Hide, addGameShortCut
A_GuiFont := GuiDefaultFont()
A_GuiFontSize := A_LastError
thisGuiW := floor(GetMonWidth(GuiHwnd))
thisGuiH := floor(GetMonHeight(GuiHwnd))
tmp := (thisGuiW > 1400)? ((thisGuiW > 1800)? 4: 2): 1
Gui, Font, % "s" fontDPI * (A_GuiFontSize + tmp)
GuiControl, Font, searchDrive
GuiControl, Font, addToLnchPad
Gui, Font
CtlColors.Attach(searchDriveHwnd, Red, "White")
CtlColors.Attach(addToLnchPadHwnd, Red, "White")
; Font sizes scale up when resolution decreases
if (thisGuiW < 400)
thisGuiW := floor(2 * thisGuiW/3)
else
thisGuiW := floor(thisGuiW/2)
if (thisGuiH < 600)
thisGuiH := floor(2 * thisGuiH/3)
else
thisGuiH := floor(thisGuiH/2)
Gui, Add, Tab2, x0 y0 w%thisguiW% h%thisguiH% vLnchPadTab gLnchPadTab AltSubmit HWNDLnchPadTabHwnd, % substr(gameListStr, 1, StrLen(gameListStr) - 1)
Gui Show, w%thisguiW% h%thisguiH% Hide,
tabguiH := thisguiH - GetTabRibbonHeight(GuiHwnd)
tabguiW := thisguiW - A_LastError
tmp := (prgNo + 1/2) * ListBoxProps.GetItemHeight()
loop, % maxGames
{
Gui, Tab, %A_Index%
Gui, Add, ListBox, %LBS_MULTIPLESEL% x0 y0 vPrgIndex%A_Index% gPrgListBox HWNDPrgIndex%A_Index%Hwnd
ListBoxProps.hWnd := PrgIndex%A_Index%Hwnd
; Not the best....
tmp := (thisGuiH > 520)? ((thisGuiH > 700)? 4: 3): (thisGuiH > 420)? 2: 1
Gui, Font, % "s" fontDPI * (A_GuiFontSize + tmp)
GuiControl, Font, % PrgIndex%A_Index%Hwnd
Gui, Font
ListBoxProps.NewItemHeight := floor(3/2 * ListBoxProps.GetItemHeight())
ListBoxProps.SetItemHeight()
; Factor for low res
if (thisGuiH < 300)
tmp := tabguiH/6
else
tmp := tabguiH/4
GuiControl, Move, PrgIndex%A_Index%, % "x" 11.5 * tabguiW/16 "y" tmp " w" tabguiW/4 "h" (prgNo + 1/2) * ListBoxProps.GetItemHeight()
CtlColors.Attach(PrgIndex%A_Index%Hwnd, Pink, "White")
switch A_Index
{
case 1:
{
tmp = LnchPadMorrowind.jpg
FileInstall LnchPadMorrowind.jpg, LnchPadMorrowind.jpg
}
case 2:
{
tmp = LnchPadOblivion.jpg
FileInstall LnchPadOblivion.jpg, LnchPadOblivion.jpg
}
case 3:
{
tmp = LnchPadSkyrim.jpg
FileInstall LnchPadSkyrim.jpg, LnchPadSkyrim.jpg
}
case 4:
{
tmp = LnchPadFallout 3.jpg
FileInstall LnchPadFallout 3.jpg, LnchPadFallout 3.jpg
}
case 5:
{
tmp = LnchPadFallout NV.jpg
FileInstall LnchPadFallout NV.jpg, LnchPadFallout NV.jpg
}
case 6:
{
tmp = LnchPadFallout 4.jpg
FileInstall LnchPadFallout 4.jpg, LnchPadFallout 4.jpg
}
}
; more for uncompiled run- else disaster!
if (!(FileExist(A_ScriptDir . "\" . tmp)))
{
MsgBox, 8208, Game Image File, The file %tmp% cannot be accessed!`nQuitting LnchPad.
return
}
picH := LoadPicture(tmp, GDI+ w%tabguiW% h%tabguiH%)
Gui Add, Picture, x0 y0 w%tabguiW% h%tabguiH% +%WS_CLIPSIBLINGS% vgamePic%A_Index% ggamePic, % "HBITMAP:*" picH
PopulateGameList(prgNo, A_Index, prgName%A_Index%)
gosub gamePic
}
;Gui, Tab
; 8 is default size of MS Shell Dlg for controls
GuiControl, Move, searchDrive, % "x" thisguiW/16 "y" 11 * thisguiH/32 "w" A_GuiFontSize * 5 * thisguiW/(16 * 8) "h" A_GuiFontSize * thisguiH/(16 * 8)
GuiControl, Move, addToLnchPad, % "x" thisguiW/16 "y" 5 * thisguiH/8 "w" A_GuiFontSize * 5 * thisguiW/(16 * 8) "h" A_GuiFontSize * thisguiH/(16 * 8)
ControlGetPos, , , , tmp, , ahk_id %Drive1Hwnd%
loop % maxDrives
{
GuiControl, Move, Drive%A_Index%, % "x" 2*thisguiW/5 "y" ((A_Index - 1) * 2 * tmp + (3 * thisguiH/8))
CtlColors.Attach(Drive%A_Index%Hwnd, Yellow, "Black") ; CtlColors doesn't do text colour for checkbox/radio.
}
CtlColors.Attach(updateIniHwnd, Yellow, "Black")
CtlColors.Attach(overWriteIniHwnd, Yellow, "Black")
CtlColors.Attach(addGameShortCutHwnd, Yellow, "Black")
GuiControl, Move, updateIni, % "x" thisguiW/6 "y" 3 * thisguiH/4
GuiControl, Move, overWriteIni, % "x" thisguiW/6 "y" 4 * thisguiH/5
GuiControl, Move, addGameShortCut, % "x" thisguiW/6 "y" 9 * thisguiH/10
tabStat := 1
GoSub LnchPadTab
GuiControl, Choose, LnchPadTab, %tabStat%
Gui Show, xCenter yCenter w%thisguiW% h%thisguiH%, LnchPad Setup
SetTaskBarIcon(GuiHwnd)
WinSet, Redraw,, ahk_id %GuiHwnd%
return
gamePic:
GuiControl, Move, % "HBITMAP:*" picH, % "x" GetTabRibbonHeight() "y" GetTabRibbonHeight(GuiHwnd, 1) "w" tabguiW "h" tabguiH
return
PrgListBox:
Gui, Submit, Nohide
ToolTip
lboxSelTol++
resetSearch(searchStat, tabStat, gameList, maxDrives)
if (PrgIndex%tabStat%hwnd == PrgListBox_SelectedItem_last_hwnd && tabStat)
{
; tolerance of clicks
if (lboxSelTol > prgNo)
{
GuiControl, Choose, PrgIndex%tabStat%, 0
loop % prgNo
{
prgPath%tabStat%[A_Index] := ""
}
ToolTip Max Clicks on Listbox. Switch Tabs or Redo Search!
}
}
ListBox_SelectedItem := ListBoxProps.GetOneItem()
if (ListBox_SelectedItem > 0)
{
; Restore
if (addGameShortCutLB != ListBox_SelectedItem)
prgPath%tabStat%[ListBox_SelectedItem] := prgPath%tabStat%bak[ListBox_SelectedItem]
; Following deselection not required for LBS_MULTIPLESEL listboxes
;if (ListBox_SelectedItem = ListBox_SelectedItem_last)
;{
;LB_SETSEL:=0x185
;SendMessage, LB_SETSEL, 0, %ListBox_SelectedItem%, , ahk_id %hwndListBox%
;}
}
else
{
; LB_GETCARETINDEX := 0x019F
SendMessage, 0x019F, 0, 0, , % "ahk_id" . PrgIndex%tabStat%Hwnd
tmp := ErrorLevel + 1
if (tmp == addGameShortCutLB)
GuiControl, Choose, PrgIndex%tabStat%, %tmp%
else
prgPath%tabStat%[-ListBox_SelectedItem] := ""
}
; Want backup array
PrgListBox_SelectedItem_last_hwnd := PrgIndex%tabStat%hwnd
return
searchDrive:
Gui, Submit, Nohide
Tooltip
GuiControlGet, strTmp, , searchDrive
if (InStr(strTmp, "Search PC"))
{
if (!SearchSelectedClicked)
{
DriveLetterBak := ""
DriveLetterBak := Object()
DriveLetterBak := GetDriveLetters(FATDrives)
}
loop % maxDrives
{
if (DriveLetterBak[A_Index])
{
GuiControl, Show, Drive%A_Index%
GuiControl, Text, Drive%A_Index%, % DriveLetterBak[A_Index]
}
}
guiControl, , searchDrive, &Search Selected Drives
}
else
{
; only alternative, but that may change
if (InStr(strTmp, "Search Selected"))
{
SearchSelectedClicked := 1
guiControl, , searchDrive, &Cancel Search
Process, priority, %lnchPadPID%, A
searchStat := -1
tooltipDriveStr := ""
GuiControl, Choose, PrgIndex%tabStat%, 0
lboxSelTol := 0
setTimer SearchFiles, -1
}
}
return
SearchFiles:
;must reset game shortcut
PopulateGameList(prgNo, tabStat, prgName%tabStat%)
loop %PrgNo%
{
prgPath%tabStat%[A_Index] := ""
prgPath%tabStat%bak[A_Index] := ""
prgCmd%tabStat%[A_Index] := ""
prgUrl%tabStat%[A_Index] := ""
}
GuiControl, , addGameShortCut, 0
GuiControl, Hide, addGameShortCut
GuiControl, Hide, overWriteIni
GuiControl, Hide, updateIni
loop % maxDrives
{
currDrive := DriveLetter[A_Index]
if (currDrive)
{
tmp := 0
fallBackNotFound := 1
gameNotFound := 1
GoSub StartProgress
if (InStr(FATDrives, currDrive))
{
; Slow slow method
FolderList := ""
FolderList := Object()
;FolderList.SetCapacity(65534)
Loop, Files, % currDrive . ":\*", D
FolderList.Push(A_LoopFilePath)
; Don't forget root drive
FolderList.Push(currDrive . ":")
Loop % FolderList.Length()
{
if A_LoopFileAttrib contains H,S
FolderList[A_Index] := ""
else
{
;i exclude upgrade- temp directories etc- maybe include ProgramData
if ((InStr(FolderList[A_Index], "tmp\")) || (InStr(FolderList[A_Index], "temp\")) || (InStr(FolderList[A_Index], "old\")) || (InStr(FolderList[A_Index], "$")) || (InStr(FolderList[A_Index], "Winnt\")) || (InStr(FolderList[A_Index], "Windows\")) || (InStr(FolderList[A_Index], "Driver\")) || (InStr(FolderList[A_Index], "inetpub\")) || (InStr(FolderList[A_Index], "Intel\")) || (InStr(FolderList[A_Index], "PerfLogs\")) || (InStr(FolderList[A_Index], "AMD\")) || (InStr(FolderList[A_Index], "ISO\")) || (InStr(FolderList[A_Index], "VirtIO\")) || (InStr(FolderList[A_Index], "Logs\")))
FolderList[A_Index] := ""
}
}
Progress, 10
fileList := "" ; Initialize to be blank.
Loop % FolderList.Length()
{
if (FolderList[A_Index])
{
Progress, % 10 + (90 * A_Index//FolderList.Length())
if (searchStat == -2)
break
Loop, Files, % FolderList[A_Index] . "\*.exe", R
fileList .= A_LoopFileFullPath "`n"
}
}
Loop, parse, fileList, `n
{
if (A_LoopField == "") ; Ignore the blank item at the end of the list.
continue
else
{
loop % prgNo
{
SplitPath, A_Loopfield, strTmp
if (!strTmp) ; trailing `n in fileList
break
if (gameNotFound && strTmp == gameExes[tabStat])
{
gameExesFullPath[tabStat] := A_Loopfield
fallBackNotFound := 0
gameNotFound := 0
}
else
{
if (gameNotFound && fallBackNotFound && strTmp == gameFallBackExes[tabStat])
{
gameExesFullPath[tabStat] := A_Loopfield
fallBackNotFound := 0
}
else
{
if (strTmp == prgExe%tabStat%[A_Index])
{
if (prgPath%tabStat%[A_Index])
{
if (multcopiesPrgWrn == 1)
break
else
{
if (!multcopiesPrgWrn)
{
MsgBox, 8195, Duplicate Prg, % strTmp " was discovered on a previous drive.`n`nReply:`nYes: Use the " currDrive " drive instead (This will not show again)`nNo: Keep the old Prg. (Warn like this next time)`nCancel: Keep the old Prg (Recommended: This will not show again)"
GoSub StartProgress
Progress, 99
IfMsgBox, No
break
else
{
IfMsgBox, Yes
{
multcopiesPrgWrn := 2
break
}
else
multcopiesPrgWrn := 1
}
}
prgPath%tabStat%[A_Index] := A_Loopfield
prgPath%tabStat%bak[A_Index] := A_Loopfield
GuiControl, Choose, PrgIndex%tabStat%, %A_Index%
tmp := 1
}
}
break
}
}
}
}
}
}
if (!tmp)
tooltipDriveStr .= currDrive . ","
FolderList.SetCapacity(0)
}
else
{
fileList := ListMFTfiles(currDrive, prgExe%tabStat%, "," . gameExes[tabStat] . "," . gameFallBackExes[tabStat],, retVal)
if (fileList)
{
Loop, parse, fileList, `n
{
loop % prgNo
{
SplitPath, A_Loopfield, strTmp
if (!(strTmp)) ; trailing `n in fileList
break
if (gameNotFound && (strTmp == gameExes[tabStat]))
{
gameExesFullPath[tabStat] := A_Loopfield
fallBackNotFound := 0
gameNotFound := 0
}
else
{
if (gameNotFound && fallBackNotFound && (strTmp == gameFallBackExes[tabStat]))
{
gameExesFullPath[tabStat] := A_Loopfield
fallBackNotFound := 0
}
else
{
if (strTmp == prgExe%tabStat%[A_Index])
{
prgPath%tabStat%[A_Index] := A_Loopfield
prgPath%tabStat%bak[A_Index] := A_Loopfield
GuiControl, Choose, PrgIndex%tabStat%, %A_Index%
tmp := 1
break
}
}
}
}
}
}
else
tooltipDriveStr .= currDrive . ","
}
Progress, Off
if (searchStat == -2)
break
}
}
if (tooltipDriveStr)
{
strTmp := "Nothing found for " SubStr(tooltipDriveStr,1,StrLen(tooltipDriveStr)-1) "."
(retval)? strTmp .= "`nError code (for NFTS): " retVal:
Tooltip, % strTmp
}
else
{
searchStat := 1
; Fix Wrye Bash
loop %PrgNo%
{
if (InStr(prgPath%tabStat%[A_Index], "Wrye Bash.exe"))
{
SplitPath, % gameExesFullPath[tabStat] , , strTmp
if (!InStr(prgPath%tabStat%[A_Index], strTmp))
break ; Wrye Bash is for this game!
if (tabStat == 2 || tabStat == 3 || tabStat == 6)
{
strTmp := LnchPadProps.GetCurrent(tabStat)
if (InStr(prgPath%tabStat%[A_Index], strTmp))
{
strTmp .= "\Mopy\Wrye Bash.exe"
if (FileExist(strTmp))
prgPath%tabStat%[A_Index] := strTmp
break
}
}
}
}
}
Process, priority, %lnchPadPID%, B
resetSearch(searchStat, tabStat, gameList, maxDrives)
cancelSearchMsg := 0
return
Drive:
Gui, Submit, Nohide
GuiControlGet, i, , %A_GuiControl%
tmp := substr(A_GuiControl, 0)
if (i)
DriveLetter[tmp] := DriveLetterBak[tmp]
else
DriveLetter[tmp] := ""
return
OverWriteIni:
Gui, Submit, Nohide
GuiControlGet, overWriteIniFile, , overWriteIni
GuiControl, Focus, addToLnchPad
return
UpdateIni:
Gui, Submit, Nohide
overWriteIniFile := 0
GuiControl, Focus, addToLnchPad
return
AddGameShortCut:
Gui, Submit, Nohide
GuiControlGet, addGameShortCutLB, , addGameShortCut
GameShortcutBiz(prgNo, addGameShortCutLB, tabStat, gameList, PrgName%tabStat%, PrgIndex%tabStat%)
if (addGameShortCutLB > 0)
{
addGameShortCutIndex := 0
loop %PrgNo%
{
if (prgPath%tabStat%[A_Index] == "")
{
addGameShortCutIndex := A_Index
prgPath%tabStat%[addGameShortCutIndex] := gameExesFullPath[tabStat]
break
}
}
if (!addGameShortCutIndex)
MsgBox, 8192, % "Shortcut to " . gameList[tabStat], No room for game!
}
else
{
prgPath%tabStat%[addGameShortCutIndex] := ""
; Because "-editor" pops in when testing for game just before AddToIniProc
prgCmd%tabStat%[addGameShortCutIndex] := ""
prgUrl%tabStat%[addGameShortCutIndex] := ""
addGameShortCutLB := 0
addGameShortCutIndex := 0
}
GuiControl, Focus, addToLnchPad
Return