-
Notifications
You must be signed in to change notification settings - Fork 0
/
ACS-Manager.ahk
3278 lines (3047 loc) · 117 KB
/
ACS-Manager.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
/* TODO: CHECK EVERY SECTION'S SNIPPETS IF THEY WERE IMPORTED CORRECTLY
CHECKED SECTIONS ARE INDENTED TO HERE
String/Array/Text
gui - interacting
Varius get
Clipboard
graphic
System functions/Binary handling
gui - get informations
Internet Explorer/Chrome/FireFox/HTML
Filesystem
Variables
Math/Converting
Internet/Network
gui - control type
Keys/Hotkeys/Hotstring
Objects
gui - customize
Hooks/Messaging
Font things
gui - menu
ACC (MSAA)
gui - to change
Other
ToolTips
Command CommandLine
System/User/hardware
Date or Time
gui - icon
UIAutomation
Other languages/MCode
gui - customise
*/
/*
TODO:::: Make the script language-agnostic (replace ".ahk"-filetype references with any file of same name for any ini-file in library-path)
Sections copied successfully from ahk-rare:
Done:::: add a double map to translate any assumed ahk_Version's to unified
output: v1,v1.1,v2
Idea:::: execute dependency-search in snippets when searching, and check if snippets covering those exist
→ might be thrown out as too complex/ressource-heavy/pointless, just food for thought so far.
*/
#Requires AutoHotkey v1.1+
; #Warn, all
#HotkeyInterval 99000000
;#InstallKeybdHook
#KeyHistory 0
#MaxThreads 250
#MaxThreadsBuffer On
#MaxHotkeysPerInterval 99000000
#NoEnv
#Persistent
#SingleInstance Force
AutoTrim On
CoordMode Mouse, Screen
CoordMode Pixel, Screen
CoordMode ToolTip, Screen
CoordMode Caret, Screen
CoordMode Menu, Screen
DetectHiddenWindows Off
FileEncoding UTF-8
ListLines Off
SendMode Input
SetBatchLines -1
SetControlDelay -1
SetKeyDelay -1, -1
SetTitleMatchMode 2
SetTitleMatchMode Fast
SetWinDelay -1
SetWorkingDir % A_ScriptDir
; ACS_ttip("Comb through ahkrare-content and move example and description comment blocks to their respective files","add all metadata-fields to be used in the editor, and figure out how to do the editor metadata-adjustable")
; #Warn,,Off
CodeTimer("")
; CurrentMode:="Instr"
; Add scriptObj-template and convert Code to use it - maybe, just a thought. Syntax of the Library-File is probably way too special for doing so, and there are no real configs to save anyways
; separate library-files and settings-files, take a peek at ahk-rare to see what they store in settings
/*
for creditsRaw, use "/" in the "URL"-field when the snippet is not published yet (e.g. for code you've written yourself and not published yet)
space author, SnippetNameX and URLX out by spaces or tabs, and remember to include "-" inbetween both fields
when 2+ snippets are located at the same url, concatenate them with "|" and treat them as a single one when putting together the URL's descriptor string
finally, make sure toingest 'CreditsRaw' into the 'credits'-field of the template below.
*/
#Include <Script>
CreditsRaw=
(LTRIM
author1 - snippetName1 - URL1
Gewerd Strauss - snippetName2|SnippetName3 (both at the same URL) - /
Ixiko - AHK-Rare - https://github.com/Ixiko/AHK-Rare
Paris - DateParse - https://github.com/Paris/AutoHotkey-Scripts/blob/master/DateParse.ahk
tidbit - String Things - https://www.autohotkey.com/boards/viewtopic.php?t=53
hi5 - tf - https://github.com/hi5/TF#ALG_TF_InsertPrefix
jballi - AddToolTip, REMOVE THIS - https://www.autohotkey.com/boards/viewtopic.php?t=30079, https://www.autohotkey.com/board/topic/75906-about-my-scripts-and-snippets/
G33kdude - RichCode - https://github.com/G33kDude/RichCode.ahk
)
FileGetTime ModDate,%A_ScriptFullPath%,M
FileGetTime CrtDate,%A_ScriptFullPath%,C
CrtDate:=SubStr(CrtDate,7, 2) "." SubStr(CrtDate,5,2) "." SubStr(CrtDate,1,4)
, global script := { base : script
,name : regexreplace(A_ScriptName, "\.\w+")
,version : FileOpen(A_ScriptDir "\version.ini","r").Read() ;; Gets read in from settings-file later
,dbgLevel : 1
,computername : A_ComputerName
,author : "Gewerd Strauss"
,authorID : "LAPTOP-C"
,authorlink : ""
,email : ""
,credits : CreditsRaw
,creditslink : ""
,crtdate : SubStr(CrtDate,7, 2) "." SubStr(CrtDate,5,2) "." SubStr(CrtDate,1,4)
,moddate : SubStr(ModDate,7, 2) "." SubStr(ModDate,5,2) "." SubStr(ModDate,1,4)
,homepagetext : ""
,homepagelink : ""
,ghtext : "GH-Repo"
,ghlink : "https://github.com/Gewerd-Strauss/ACS-Manager"
,doctext : "Documenation"
,doclink : "https://github.com/Gewerd-Strauss/ScriptObj#readme"
,forumtext : ""
,forumlink : ""
,donateLink : ""
,resfolder : A_ScriptDir "\res"
,iconfile : A_ScriptDir "\res\sct.ico"
,reqInternet : false
,rfile : "https://github.com/Gewerd-Strauss/ACS-Manager/archive/refs/heads/main.zip"
,vfile_raw : "https://raw.github.com/Gewerd-Strauss/ACS-Manager/main/version.ini"
,vfile : "https://raw.github.com/Gewerd-Strauss/ACS-Manager/main/version.ini"
,vfile_local : A_ScriptDir "\version.ini"
,DataFolder : A_ScriptDir "\Sources"
,Data_rfile : "https://github.com/Gewerd-Strauss/ACS-Manager/archive/refs/heads/main.zip"
,Data_vfile_raw : "https://raw.github.com/Gewerd-Strauss/ACS-Manager/main/dataversion.ini"
,Data_vfile : "https://raw.github.com/Gewerd-Strauss/ACS-Manager/main/dataversion.ini"
,Data_vfile_local : A_ScriptDir "\dataversion.ini"
,ErrorCache : []
,config : []
,configfile : A_ScriptDir "\INI-Files\" regexreplace(A_ScriptName, "\.\w+") ".ini"
,configfolder : A_ScriptDir "\INI-Files"}
;
if !script.requiresInternet() {
ExitApp
}
script.loadCredits(script.resfolder "\credits.txt")
;script.setIcon()
script.Update(,,1,,1)
global bSearchSnippets:=false
global bForceRestartOnEdit:=true
global GuiCommands:=["entered by prepending c::","rescale","reload","get sections","no restart on edit"]
FileGetVersion Version, %A_ProgramFiles%\AutoHotkey\AutoHotkey.exe
OnMessage(0x404, "f_TrayIconSingleClickCallBack")
; m(A_AhkVersion,Version)
; if bIsAuthor:=(script.computername==script.authorID)
; FileDelete, % script.configfile ;; for testing purposes and keeping the settings updated when adding/changing keys
if !script.Load(,1)
{ ;; default settings
str=
(LTRIM
[Map2]
;Map2 Hidden:
Ahk=AHK_Version
AU=Author
DA=Date
Dep=Dependencies
Fi=Library
Key=Keywords
Li=License
Lic=License
Na=Name
Ha=Hash
Se=Section
Sec=Section
Url=URL
Ver=Version
[Settings]
bDebugSwitch=0
;bDebugSwitch Do you want to enter debug mode when starting up the script? Debug mode can be entered by pressing Ctrl+T while the GUI is active. NOT IMPLEMENTED:This can be useful for debugging issues with the startup routine.
;bDebugSwitch Type: Checkbox
;bDebugSwitch CheckboxName: Enable Debugmode on startup?
;bDebugSwitch Default: 0
bNotifyDependenciesOnCopy=0
;bNotifyDependenciesOnCopy Notify user of dependencies when notifying a snippet.
;bNotifyDependenciesOnCopy Type: Checkbox
;bNotifyDependenciesOnCopy CheckboxName: Notify user of existing dependencies?
;bNotifyDependenciesOnCopy Default:0
;bNotifyDependenciesOnCopy Hidden:
bShowLoadUp=0
;bShowLoadUp Do you want to display the loading routine when starting the script?
;bShowLoadUp This is not recommended when loading _A LOT_ of snippets.
;bShowLoadUp Type: Checkbox
;bShowLoadUp Default: 0
;bShowLoadUp CheckboxName: Display GUI when loading?
bShowOnStartup=1
;bShowOnStartup Set whether or not to display the GUI on script startup or not.
;bShowOnStartup Type: Checkbox
;bShowOnStartup Default: 0
;bShowOnStartup CheckboxName: Show GUI on script-startup?
CopyDescriptionToOutput=1
;CopyDescriptionToOutput When checked, the contents of the "Description"-Editfield are added when copying the snippet to the clipboard
;CopyDescriptionToOutput Type: Checkbox
;CopyDescriptionToOutput Default: 1
;CopyDescriptionToOutput CheckboxName: Copy Description?
CopyExampleToOutput=1
;CopyExampleToOutput When checked, the contents of the "Example"-Editfield are added when copying the snippet to the clipboard
;CopyExampleToOutput Type: Checkbox
;CopyExampleToOutput Default: 1
;CopyExampleToOutput CheckboxName: Copy Example?
CopyLicenseToOutput=1
;CopyLicenseToOutput When checked, the License of the snippet is added when copying the snippet to the clipboard
;CopyLicenseToOutput Type: Checkbox
;CopyLicenseToOutput Default: 1
;CopyLicenseToOutput CheckboxName: Copy License?
CopyMetadataToOutput=1
;CopyMetadataToOutput When checked, the Metadata of the snippet is added when copying the snippet to the clipboard
;CopyMetadataToOutput Type: Checkbox
;CopyMetadataToOutput CheckboxName: Copy Metadata?
;CopyMetadataToOutput Default: 1
DateFormat=dd.MM.yyyy
;DateFormat Set the format with which to display dates.
;DateFormat Type: Text
;DateFormat Default: dd.MM.yyyy
DirectoryPath=A_ScriptDir\Sources
;DirectoryPath Set the folder to be loaded. The names of the firstlevel-subfolder will be the name of the "Library" within the script.
;DirectoryPath Type: Folder
;DirectoryPath Default: A_ScriptDir "\Sources"
Search_InString_MetaFields=1
;Search_InString_MetaFields Do you want to use InString instead of FullString-matching when searching within metadata-fields?
;Search_InString_MetaFields Type: Checkbox
;Search_InString_MetaFields CheckboxName: Use InStr()-Metadatasearch?
;Search_InString_MetaFields Default: 1
ShowRedraw=0
;ShowRedraw Do you want to display the Listview redrawing itself when searching?
;ShowRedraw Disable this if performance while doing so is too harsh.
;ShowRedraw Type: Checkbox
;ShowRedraw CheckboxName: Display Listview-Redraw when searching?
;ShowRedraw Default: 0
bSetSearchresultAlphabetically=1
;bSetSearchresultAlphabetically Do you want to sort searchresults alphabetically or by section and snippet identifier? This only affects searchresults.
;bSetSearchresultAlphabetically Type: Checkbox
;bSetSearchresultAlphabetically CheckboxName: Sort Searchresults alphabetically?
LibraryRelativeSI=0
;LibraryRelativeSI When checked, the SnippetIndex displayed in the GUI will be relative to the library said snippet is in, and not relative to the section overall.
;LibraryRelativeSI Type: Checkbox
;LibraryRelativeSI Default: 0
;LibraryRelativeSI Hidden:
Max_InDepth_Searchable=200
;Max_InDepth_Searchable Set the maximum number of snippets to be searched. DEPRECATED
;Max_InDepth_Searchable Type: Number
;Max_InDepth_Searchable Hidden:
Search_Code=0
;Search_Code Do you want to search within already loaded code, although it will be MUCH slower?
;Search_Code This does not affect unloaded snippets - they cannot be searched.
;Search_Code Type: Checkbox
;Search_Code CheckboxName: Search in loaded Code?
;Search_Code Default: 0
;Search_Code Hidden:
Search_Description=0
;Search_Description Do you want to search within already loaded Descriptions, although it will be MUCH slower?
;Search_Description This does not affect unloaded snippets - they cannot be searched.
;Search_Description Type: Checkbox
;Search_Description CheckboxName: Search in loaded Descriptions?
;Search_Description Default: 0
;Search_Description Hidden:
Search_Examples=0
;Search_Examples Do you want to search within already loaded Examples, although it will be MUCH slower?
;Search_Examples This does not affect unloaded snippets - they cannot be searched.
;Search_Examples Type: Checkbox
;Search_Examples CheckboxName: Search in loaded Examples?
;Search_Examples Default: 0
;Search_Examples Hidden:
SoundAlertOnDebug=1
;SoundAlertOnDebug Type: Checkbox
;SoundAlertOnDebug Checkboxname: Do you want to hear a sound alert when entering and exiting Debug mode?
;SoundAlertOnDebug This can be useful as Debug mode can seriously alter the behaviour of the program
;SoundAlertOnDebug Default: 1
)
FileAppend % str,% script.configfile, % "UTF-16"
script.Load(,1)
}
if script.config.settings.bShowLoadUp
{
script.config.settings.bShowOnStartup:=true
script.config.settings.ShowRedraw:=true
}
if (script.config.Map2.Count()=0 || script.config.Map2.count()="")
{
msgbox 8240,% script.name ":Settings Corrupted", % "The settings have been corrupted and the Keymap for translating searchquery-identifiers (""NA:"",""SE:"",...) could not been found.`nThe script will now restore the settings to default. If that does not alleviate the issue, please open an issue in the scripts' repository.`n`nSearching by anything but name is not possible until this warning disappears"
ExitApp
}
; script.Version:=script.config.Settings.ScriptVersion
script.config.Settings.DirectoryPath:=strreplace(script.config.Settings.DirectoryPath,"A_ScriptDir",A_ScriptDir)
global DirectoryPath:= ( (substr(script.config.settings.DirectoryPath,-1)!="\*") ?script.config.settings.DirectoryPath "\*":script.config.settings.DirectoryPath) ;; this is the path that contains all libraries which will be read. ;; Ensure that thes path is terminated in a "\*"
SnippetsStructure:=fLoadFolderLibraries(DirectoryPath)
; Clipboard:=""
; for k,v in SnippetsStructure[2]
; Clipboard.="`n" v
oArr:=SnippetsStructure.Clone()
SearchHistory:=[]
GUI_Mode:=1
bSwitchSize:=0
GuiNameMain:="TotallyNotAHKRAre"
GuiNameIngestion:="Ingestion Helper"
RESettings2 :=
( LTrim Join Comments
{
"TabSize": 4,
"Indent": "`t",
"FGColor": 0xEDEDCD,
"BGColor": 0x3F3F3F,
"Font": {"Typeface": "Consolas", "Size": 11},
"WordWrap": False,
"UseHighlighter": True,
"HighlightDelay": 200,
"Colors": {
"Comments": 0x7F9F7F,
"Functions": 0x7CC8CF,
"Keywords": 0xE4EDED,
"Multiline": 0x7F9F7F,
"Numbers": 0xF79B57,
"Punctuation": 0x97C0EB,
"Strings": 0xCC9893,
; AHK
"A_Builtins": 0xF79B57,
"Commands": 0xCDBFA3,
"Directives": 0x7CC8CF,
"Flow": 0xE4EDED,
"KeyNames": 0xCB8DD9,
; CSS
"ColorCodes": 0x7CC8CF,
"Properties": 0xCDBFA3,
"Selectors": 0xE4EDED,
; HTML
"Attributes": 0x7CC8CF,
"Entities": 0xF79B57,
"Tags": 0xCDBFA3,
; JS
"Builtins": 0xE4EDED,
"Constants": 0xF79B57,
"Declarations": 0xCDBFA3
}
}
)
gosub, lGUICreate_1New
f_CreateTrayMenu(vGUIWidth,vGUIHeight,GuiNameMain)
;; an armada of different search testing strings :
; Clipboard:="Au:Gew Se:menu Li:Un"
; Clipboard:="Au:Gew Se:menu Li:Un Da:07.10.2022"
; Clipboard:="Fi:Libr AU:ano"
; Clipboard:="Au:Gew Se:menu Ver:1.3"
; ; Clipboard:="Au:Gew Se:menu"
; Clipboard:="fi:Sec"
; Clipboard:="au:gew fi:ary1"
; Clipboard:="Na:1 fi:ary1"
; clipboard:="Na:1 fi:ary1 au:ano"
; clipboard:="fi:sec au:ano"
; clipboard:="fi:sec au:ano NA:alib"
; clipboard:="gui - to change"
; clipboard:="getcommstate"
; clipboard:="InvokeVerb"
; clipboard:="PostMessageUn"
; clipboard:="controlgettabs"
; clipboard:="WinGetPosEx"
; clipboard:="Ha:10550"
; Clipboard:="Au:anon na:1"
Clipboard:="c::no restart on edit"
CodeTimer("AutoExec")
return
lGUICreate_1New: ;; Fully Parametric-form, TODO: functionalise this thing
gui 1: destroy
gui 1: new, -SysMenu -ToolWindow -caption +Border +labelALG -Resize ;+MinSize1000x
gui 1: default
gui +hwndMainGUI
if vsdb || (A_DebuggerName="Visual Studio Code")
gui 1: -AlwaysOnTop
gui_control_options := "xm w220 " . cForeground . " -E0x200" ; remove border around edit field
, gui_control_options2 := cForeground . " -E0x200"
, cBackground := "c" . "1d1f21"
, cCurrentLine := "c" . "282a2e"
, cSelection := "c" . "373b41"
, cForeground := "c" . "c5c8c6"
, cComment := "c" . "969896"
, cRed := "c" . "cc6666"
, cOrange := "c" . "de935f"
, cYellow := "c" . "f0c674"
, cGreen := "c" . "b5bd68"
, cAqua := "c" . "8abeb7"
, cBlue := "c" . "81a2be"
, cPurple := "c" . "b294bb"
, vLastCreationScreenHeight:=vGuiHeight
, vLastCreationScreenWidth:=vGuiWidth
gui font, s9 cWhite, Segoe UI
SysGet Mon,MonitorWorkArea
if (!vGUIWidth and !vGuiHeight) || (((vGUIWidth!=(A_ScreenWidth-20)) || (vGuiHeight!=(A_ScreenHeight))) && !bSwitchSize) ; assign outer gui dimensions either if they don't exist or if the resolution of the active screen has changed - f.e. when undocking or docking to a higher resolution display. The lGuiCreate_1-subroutine is also invoked in total if the resolution changes, but this is the necessary inner check to reassign dimensions.
{
vGUIWidth:=A_ScreenWidth*1.0-20 ;-910 ; 0.6@1440 starts clipping
, vGUIHeight:=MonBottom*1.0-20
}
gui font, s7 cRed, Segoe UI
{
; checked values will be indented unto this level
; values which still seem a bit fishy or which I suspect to be at fault for some weird shit are indented to this line
; Define Parameters - Margins
WidthMargin_Global:=vGuiWidth*0.01
, HeightMargin_Global:=vGuiHeight*0.01
; Define Parameters - SearchBox:
;; ratio's checked on 100%-model
, xPos_Search_GroupBox:=vGuiWidth*0.47
, yPos_Search_GroupBox:=vGuiHeight*0.01
, Height_Search_GroupBox:=vGuiHeight*0.08
, Width_Search_GroupBox:=vGuiWidth-(xPos_Search_GroupBox+WidthMargin_Global)
gui add, groupbox, x%xPos_Search_GroupBox% y%yPos_Search_GroupBox% w%Width_Search_GroupBox% h%Height_Search_GroupBox%
; Define Parameters - Text XX Snippets
xPos_Text_XXSnippetsLoaded:=xPos_Search_GroupBox +WidthMargin_Global
, yPos_Text_XXSnippetsLoaded:=yPos_Search_GroupBox +(HeightMargin_Global/2)+2 ; add 2 to prevent clipping the groupbox control at the top
, Width_Text_XXSnippetsLoaded:=Width_Search_GroupBox*0.3
, Height_Text_XXSnippetsLoaded:=Height_Search_GroupBox*0.3
gui font, s11 cRed, Segoe UI
gui add, text,x%xPos_Text_XXSnippetsLoaded% y%yPos_Text_XXSnippetsLoaded% vvSearchFunctions, _____________________________________________
; Define Parameters - DDL Searchmode
xPos_DDL_SearchMode:=xPos_Text_XXSnippetsLoaded
, yPos_DDL_SearchMode:=yPos_Text_XXSnippetsLoaded+Height_Text_XXSnippetsLoaded +(HeightMargin_Global/2)
, Width_DDL_SearchMode:=100 ;; note: this seems extensively too large
, Height_DDL_SearchMode:=Height_Search_GroupBox-yPos_DDL_SearchMode -(HeightMargin_Global/2)
, Height_DDL_SearchMode2:=Height_Search_GroupBox-yPos_DDL_SearchMode -(HeightMargin_Global/2) - 10
xPos_DDL_SearchMode2:=xPos_Text_XXSnippetsLoaded+Width_DDL_SearchMode+WidthMargin_Global
gui font, s8
; gui, add, DDL,vSearchMethod x%xPos_DDL_SearchMode% y%yPos_DDL_SearchMode% h%Height_DDL_SearchMode% w%Width_DDL_SearchMode% r2 vCurrentMode glSetSearchMethod HwndCurrentModeHWND, InStr||RegEx
gui add, button, x%xPos_DDL_SearchMode% y%yPos_DDL_SearchMode% h%Height_DDL_SearchMode2% w%Width_DDL_SearchMode% vvExtraButton glIngestSnippet HwndExtraButtonHWND,% "&Ingest Snippet"
gui add, button, x%xPos_DDL_SearchMode2% y%yPos_DDL_SearchMode% h%Height_DDL_SearchMode2% w%Width_DDL_SearchMode% vvExtraButton2 glEditSnippet HwndExtraButton2HWND,% "&Edit Snippet"
gui font, s11 cWhite, Segoe
str:=ACS_Obj2Str(script.config.map2)
AddToolTip(ExtraButtonHWND,"Press Enter to Search.`n" str)
; Define Parameters: Fuzzy-Search Checkbox
xPos_FuzzySearchCheckbox:=xPos_DDL_SearchMode + Width_DDL_SearchMode +(WidthMargin_Global/2)
, yPos_FuzzySearchCheckbox:=yPos_DDL_SearchMode+5
, Width_FuzzySearchCheckbox:=144
gui font, s11 cBlack, Segoe
; gui, add, Text, x%xPos_FuzzySearchCheckbox%y%yPos_FuzzySearchCheckbox% w%Width_FuzzySearchCheckbox% gSearchParametersExplanation vbUseFuzzySearch HWNDFuzzySearchHWND,?
; Gui, Add, Text, x3 w55 h30 HwndMyText gMyText, RAM: %myString% `%
; Gui,+LastFound
; Gui,Show, X%DefaultX% Y%DefaultY% h16 w60 Noactivate,RAMOverview
; AddToolTip(MyText,"RAM free: " d:=substr(oMemState[10,"GB_AvailPhys"],1,5) "GB`nRAM used:" substr(oMemState[10,"GB_TotalPhys"]-oMemState[10,"GB_AvailPhys"],1,5) "GB")
AddToolTip(SearchParametersExplanation,"DEPRECATED:Not active in Regex-Searchmode")
; Define Parameters: Edit Searchmode
xPos_Edit_SearchMode:=xPos_DDL_SearchMode+Width_DDL_SearchMode*3+WidthMargin_Global
, yPos_Edit_SearchMode:=yPos_DDL_SearchMode
, Width_Edit_SearchMode:=Width_Search_GroupBox-Width_DDL_SearchMode*3-3*WidthMargin_Global
, Height_Edit_SearchMode:=Height_DDL_SearchMode
; , SuperviseSearchbar:=Func("fSuperviseSearchbar").Bind(GuiNameMain)
gui add, edit, x%xPos_Edit_SearchMode% y%yPos_Edit_SearchMode% w%Width_Edit_SearchMode% r1 cBlack gfSuperviseSearchbar vSearchString HwndSearchStringHWND, ; Search here
AddToolTip(SearchStringHWND,"Enter search string. Use key 'ID:xx' to search by function ID, and key 's:xx' to search by section index")
; Define Parameters - ListView
xPos_ListView:=WidthMargin_Global
, yFraction_ListView:=0.1
, HeightFraction_ListView:=0.40
, yPos_ListView:=vGuiHeight*yFraction_ListView
, Width_ListView:=vGuiWidth-2*WidthMargin_Global
, Height_ListView:=vGuiHeight*HeightFraction_ListView
gui font,s8
gui add, Listview, x%xPos_ListView% y%yPos_ListView% w%Width_ListView% h%Height_ListView% +Report ReadOnly Count%MaxSnippetCount% -vScroll vLVvalue gfLV_Callback, Section|Snippet Name|Hash|Library|Snippet Identifier|Ingestion-Order|License|Version|Author|Snippet Identifier
guicontrol font, LVvalue
; Define Parameters - Description Box
xPos_DescriptionBox:=WidthMargin_Global
, yPos_DescriptionBox:=(yPos_ListView+Height_ListView+(HeightMargin_Global)) ;;vGuiHeight*HeightFraction_UpToDescriptionBox:=(HeightFraction_ListView+yFraction_ListView+(HeightMargin_Global/100)) ;; yPos_ListView+HeightListView+1*Margin
, Width_DescriptionBox:=vGuiWidth*(0.135+0.02+0.005)
, Height_DescriptionBox:= vGuiHeight*((vGuiHeight-(yPos_DescriptionBox+2*HeightMargin_Global))/vGuiHeight) ;vGuiHeight*d:=(1-(HeightFraction_UpToDescriptionBox+(HeightMargin_Global/100)))
; yPos_DescriptionBox:=vGuiHeight*(0.71)
; Width_DescriptionBox:=vGuiWidth*(0.135+0.02+0.005)
; Height_DescriptionBox:=vGuiHeight*0.275
gui font, s12, Segoe UI
gui add, Link, y%yPos_DescriptionBox% x%xPos_DescriptionBox% w%Width_DescriptionBox% h%Height_DescriptionBox% vvEdit1, Edit1
; Define Parameters - Tab3
xPos_Tab3:=xPos_DescriptionBox+Width_DescriptionBox+(WidthMargin_Global/1)
, yPos_Tab3:=yPos_DescriptionBox
, Width_Tab3:=((vGuiWidth-(Width_DescriptionBox+3*WidthMargin_Global)))
, Height_Tab3:=Height_DescriptionBox
; FractionTab3:=(100-((xPos_Tab3-2*WidthMargin_Global))
gui font,
gui add, tab,y%yPos_Tab3% x%xPos_Tab3% w%Width_Tab3% h%Height_Tab3%, CODE||Examples|Description
; Define Parameters - Richfields
{ ;; Definition set 1
xPos_RichCode:=xPos_Tab3+WidthMargin_Global*2
, yPos_RichCode:=yPos_Tab3+HeightMargin_Global*2 + 2
, Width_RichCode:=Width_Tab3-2*WidthMargin_Global - 2
, Height_RichCode:=Height_Tab3-2*HeightMargin_Global - 4
; RichField1
gui tab, CODE
global RC:=new ACS_RichCode(RESettings2, "y" yPos_RichCode " x" xPos_RichCode " w" Width_RichCode " h" Height_RichCode,"MainGui", HighlightBound=Func("HighlightAHK"))
AddToolTip(RC,"Test")
}
RC.HighlightBound:=Func("HighlightAHK")
if script.config.settings.bShowOnStartup
fGuiShow_1(vGUIWidth,vGUIHeight,GuiNameMain)
References:=fPrePopulateLV(SnippetsStructure)
}
gui tab, Examples
global RC2:=new ACS_RichCode(RESettings2, "y" yPos_RichCode " x" xPos_RichCode " w" Width_RichCode " h" Height_RichCode,"MainGui", HighlightBound=Func("HighlightAHK"))
RC2.HighlightBound:=Func("HighlightAHK")
gui tab, Description
global RC3:=new ACS_RichCode(RESettings2, "y" yPos_RichCode " x" xPos_RichCode " w" Width_RichCode " h" Height_RichCode,"MainGui", HighlightBound=Func("HighlightAHK"))
RC3.HighlightBound:=Func("HighlightAHK")
, SearchIsFocused:=Func("ControlIsFocused").Bind("Edit1")
, ListViewIsFocused:=Func("ControlIsFocused").Bind("SysListView321")
, RCFieldIsClicked:=Func("ControlIsFocused").Bind("RICHEDIT50W1")
; , EditFieldIsClicked:=Func("ControlIsFocused").Bind("Edit3")
gui tab
gui add, statusbar, -Theme vStatusBarMainWindow gfCallBack_StatusBarMainWindow ; finish up statusbar - settings, updating library/adding additional libraries
SB_SetParts(370,273,70,80,500)
bIsAuthor:=(script.computername==script.authorID)
bIsDebug:=script.config.settings.bDebugSwitch
if (!bIsAuthor & !bIsDebug) || (bIsAuthor & !bIsDebug)
{ ;; public display
SB_SetText("Standard Mode Engaged. Click to enter debug-mode",2)
ListLines Off
; KeyHistory
}
else if (!bIsAuthor && bIsDebug) || (bIsAuthor && bIsDebug)
{
SB_SetText("Author/Debug Mode Engaged. Click to exit debug-mode",2)
ListLines On
}
; f_SB_Set()
SB_SetText("No Code from " script.name " on clipboard.", 1)
if (SnippetsStructure[4,"ahk"]!=SnippetsStructure[4,"ini"])
script.Error:="Critical Error [1]: Metadata for " SnippetsStructure[4,"ini"] " files has been found, but code is present for " SnippetsStructure[4,"ahk"] " snippets."
if (script.error!="")
SB_SetText(script.error,5)
else
SB_SetText("Errors:/",5)
SB_SetText("About this script",4)
SB_SetText("NE:Settings",3)
if script.config.settings.bShowOnStartup
fGuiShow_1(vGUIWidth,vGUIHeight,GuiNameMain)
Hotkey IfWinActive, % "ahk_id " MainGUI
Obj_TabLeft:=Func("fTabThroughTabControl").Bind(-1)
Obj_TabRight:=Func("fTabThroughTabControl").Bind(1)
Hotkey ^Tab,% Obj_TabRight
Hotkey ^+Tab,% Obj_TabLeft
Hotkey ^f, fFocusSearchBar
Hotkey ^s, fFocusSearchBar
Hotkey ^k, fFocusListView
Hotkey ^c, fCopySnippet
Hotkey ^P, fEditSettings
Hotkey ^+P, fEditSettings
; Hotkey, ^r, lGuiCreate_2
Obj_ExtraButton2:=Func("fEditSnippet").Bind(SnippetsStructure)
Hotkey !e, % Obj_ExtraButton2
Obj_ResetListView:=Func("fResetListView").Bind(SnippetsStructure)
Hotkey Del, % Obj_ResetListView
Hotkey if, % SearchIsFocused
HotKey ^BS, fDeleteWordFromSearchBar
Hotkey ^k, fFocusListView
Obj_SearchSnippets:=Func("fSearchSnippetsEnter").Bind(SnippetsStructure,References,DirectoryPath,SearchHistory)
Obj_MoveThroughSearchHistory:=Func("fMoveThroughSearchHistory").Bind(SnippetsStructure,References,DirectoryPath,SearchHistory)
Hotkey ~Enter, % Obj_SearchSnippets
Hotkey ~Up, % Obj_MoveThroughSearchHistory
Hotkey ~Down, % Obj_MoveThroughSearchHistory
Hotkey if, % ListViewIsFocused
Obj_MoveOnListView2:=Func("MoveOnListView").Bind(-1)
Obj_MoveOnListView:=Func("MoveOnListView").Bind(1)
; Hotkey, ~Up, % Obj_MoveOnListView2
; Hotkey, ~Down, % Obj_MoveOnListView
Obj_fLVCallback:=Func("fLV_Callback").Bind(SnippetsStructure,Matches)
; Hotkey, ~Up, fLV_Callback
; Hotkey, ~Down, fLV_Callback
Hotkey ~Up, % Obj_fLVCallback
Hotkey ~Down, % Obj_fLVCallback
hotkey if, % RCFieldIsClicked
Hotkey ~Up, % Obj_fLVCallback
Hotkey ~Down, % Obj_fLVCallback
Hotkey ~RButton, fCopySnippet
Hotkey ~LButton, fCopySnippet
hotkey if
; Gui, Color, 4f1f21, 432a2e
; fFocusListView()
; sleep, 300
fSelectFirstLVEntry(SnippetsStructure,Matches)
LastScaledSize:=[vGUIWidth,vGUIHeight]
lCheckClipboardContents()
if !script.config.settings.bShowOnStartup
ACS_ttip(script.name " has finished initialisation.")
return
Func1(Param1)
{
MsgBox % Param1
return
}
fPrePopulateLV(SnippetsStructure)
{
if !strsplit(script.config.settings.ShowRedraw,A_Space).1
GuiControl -Redraw, LVvalue
References:=fPopulateLVNew(SnippetsStructure[1],SnippetsStructure[2],SnippetsStructure[3])
if strsplit(script.config.settings.ShowRedraw,A_Space).1
GuiControl +Redraw, LVvalue
f_RescaleLV()
if !strsplit(script.config.settings.ShowRedraw,A_Space).1
GuiControl +Redraw, LVvalue
return References
}
fGuiHide_1()
{
gui 1: hide
return
}
fGuiShow_1(vGUIWidth,vGUIHeight,GuiNameMain)
{
gui 1: show, w%vGuiWidth% h%vGuiHeight%, % GuiNameMain
fFocusListView()
return
}
fFocusListView()
{
guicontrol focus, LVvalue
return
}
fSuperviseSearchBar()
{
if Instr(fGetSearchFunctionsString(),"?") && WinActive(GuiNameMain)
{
Object:={}
Object.Filters:=script.config.map2
Object.GuiCommands:=GuiCommands
str:=ACS_ttip(Object)
}
return
}
fDeleteWordFromSearchBar()
{
SendInput ^+{Left}{Del}{ShiftUp}{CtrlUp}
return
}
fResetListView(SnippetObj:="")
{
fClearSearchBar()
fPrePopulateLV(SnippetObj)
fSelectFirstLVEntry_Searches()
fLV_Callback(SnippetObj,Matches)
return
}
fClearSearchBar()
{
GuiControlGet currentSearch, , SearchString
if (currentSearch!="")
guicontrol,,SearchString
return
}
fTabThroughTabControl(Direction:=1)
{
SendInput % "^" (Direction=1?"{PgDn}":"{PgUp}")
fFocusListView()
return
}
fFocusSearchBar()
{
guicontrol focus, SearchString
return
}
fCopySnippet(IsDependency:=false)
{
global
MouseGetPos,,,,mVC
; if (mVC="RICHEDIT50W1") ; little safety to remove copying when clicking the DescriptionBox
{
Code:=""
searchstr:=fGetSearchFunctionsString()
SelectedLVEntry:=f_GetSelectedLVEntries()
if (searchstr!="") && !Instr(SnippetsStructure[1,SelectedLVEntry.3].Code,"Error 01: No code-file was found under the expected path")
Code:=SnippetsStructure[1,SelectedLVEntry.3].Code
else if !Instr(SnippetsStructure[1,SelectedLVEntry.3].Code,"Error 01: No code-file was found under the expected path")
Code:=SnippetsStructure[1,SelectedLVEntry.3].Code
if (Code="") && (searchstr!="")
fLoadFillDetails() ;(Matches,DirectoryPath)
else if (Code="") && (searchstr="")
fLoadFillDetails() ;(SnippetsStructure,DirectoryPath)
if script.config.Settings.CopyMetadataToOutput
{
Author:=Data.Metadata.Author
Date_Metadata:=Data.Metadata.Date
Date_ISO:=DateParse(Date_Metadata)
FormatTime Date_Displayed, % Date_ISO, % script.config.Settings.DateFormat
FormatTime Date,% Data.Metadata.Date, % script.config.Settings.DateFormat
if (Date="" && Data.Metadata.Date!="")
Date:=Data.Metadata.Date
License:=Data.Metadata.License
Name:=Data.Metadata.Name
Section:=Data.Metadata.Section
URL:=Data.Metadata.URL
Version:=Data.Metadata.Version
SectionInd:=Data.Metadata.SectionInd
Library:=Data.Metadata.Library
KeyWords:=Data.Metadata.KeyWords
AHK_Version:=(Data.Metadata.AHK_Version!=""?Data.Metadata.AHK_Version:"/")
Dependencies:=(Data.Metadata.Dependencies!=""?Data.Metadata.Dependencies:"/")
; Changelog:=Data.Metadata.Changelog ;; this one is a maybe because I would probably have to include an additional TAB+RC-Control cuz this would likely have to be its own file.
; KeyWords:=Data.Metadata.KeyWords
licenseURL:=Data.Metadata.licenseURL
InfoText:=[]
if (Name!="")
InfoText.push("Snippet: " Name)
if (Version!="")
InfoText.push(" (v." Version ")`n")
else
InfoText[InfoText.MaxIndex()].="`n"
if (Date!="") && (URL="")
InfoText.push((Version!=""?A_Space:"") Date "`n")
InfoText.push("--------------------------------------------------------------`n")
if (Author!="")
InfoText.push("Author: " Author "`n")
license_path:=strreplace(DirectoryPath,"*") DATA.Metadata.Library "\" DATA.Metadata.Hash ".license"
if (FileExist(license_path)) {
FileRead License_Text, % license_path
DATA.License:=License_Text
} else {
if (License!="")
{
InfoText.push("License: " License "`n")
if (licenseURL!="")
{
InfoText.Push("LicenseURL: " LicenseURL "`n")
if IsConnected(Data.Metadata.LicenseURL)
{
if InStr(Data.Metadata.LicenseURL,"github.com") || InStr(Data.Metadata.LicenseURL,"gist.githubusercontent.com") {
RAWLicenseURL:=StrReplace(Data.Metadata.LicenseURL,"github.com","raw.githubusercontent.com")
RAWLicenseURL:=StrReplace(RAWLicenseURL,"blob/","")
Data.License:=URLDownloadToVar(RAWLicenseURL)
if (Data.License=0)
Data.License:="License could not be copied, please retrieve manually from '" Data.Metadata.LicenseURL "'`n"
}
else {
Data.License:=URLDownloadToVar(Data.Metadata.LicenseURL)
if (Data.License=0) {
Data.License:="License could not be copied, please retrieve manually from '" Data.Metadata.LicenseURL "'`n"
}
}
}
/*
if a license is referenced by URL and downloaded as above, it will be written to disk on copy. If no internet connection exists, this will be checked instead.
TODO: this is a hotfix, and the license still must be read from here.
*/
if ((!FileExist(DATA.Metadata.Hash ".license")) && !InStr(Data.License,"License could not be copied")) {
fWriteTextToFile(Data.License,strreplace(DirectoryPath,"*") DATA.Metadata.Library "\" DATA.Metadata.Hash ".license")
ACS_ttip("Generated license-file for '" DATA.Metadata.Name "'")
}
}
}
}
if (URL!="")
InfoText.Push("Source: " URL "`n")
if (Date!="") && (URL!="")
InfoText.Push("(" Date ")`n")
; else {
; if (Date!="")
; InfoText.Push("(" Date ")`n")
; }
else if (URL!="")
InfoText.Push("`n")
if !Instr(InfoText[InfoText.MaxIndex()],"--------------------------------------------------------------") && !(Instr(InfoText[InfoText.MaxIndex()-1],"--------------------------------------------------------------") && InfoText[InfoText.MaxIndex()]="`n")
InfoText.push("--------------------------------------------------------------`n")
InfoText.push("Library: "Library "`n")
InfoText.push("Section: "SectionInd " - " Section "`n")
if (Dependencies!="")
InfoText.push("Dependencies: " Dependencies "`n")
if (AHK_Version!="")
InfoText.push("AHK_Version: " AHK_Version "`n")
if !Instr(InfoText[InfoText.MaxIndex()],"--------------------------------------------------------------") && !(Instr(InfoText[InfoText.MaxIndex()-1],"--------------------------------------------------------------") && InfoText[InfoText.MaxIndex()]="`n")
InfoText.push("--------------------------------------------------------------`n")
if (KeyWords!="")
InfoText.push("Keywords: " Keywords)
FinalInfoText:=""
for k,v in InfoText
FinalInfoText.= "; " v
if script.config.Settings.CopyLicenseToOutput
Data.License:=ALG_TF_InsertPrefix(RTrim(Data.License),1,, "; ") ;; prepend "; " before each line of Licensetext
}
if script.config.Settings.CopyExampleToOutput
{
if (searchstr!="") && !Instr(SnippetsStructure[1,SelectedLVEntry.3].Example,"Error 01: No example-file was found under the expected path")
Example:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Example,1,, "; ") ;; make sure the example is definitely a comment
else if !Instr(SnippetsStructure[1,SelectedLVEntry.3].Example,"Error 01: No example-file was found under the expected path")
Example:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Example,1,, "; ") ;; make sure the example is definitely a comment
}
else
{
if (searchstr!="") && !Instr(SnippetsStructure[1,SelectedLVEntry.3].Example,"Error 01: No example-file was found under the expected path")
Example:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Example,1,, "; ") ;; make sure the example is definitely a comment
else if !Instr(SnippetsStructure[1,SelectedLVEntry.3].Example,"Error 01: No example-file was found under the expected path")
Example:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Example,1,, "; ") ;; make sure the example is definitely a comment
}
if script.config.Settings.CopyDescriptionToOutput
{
if (searchstr!="") && !Instr(SnippetsStructure[1,SelectedLVEntry.3].Description,"Error 01: No description-file was 00found under the expected path")
Description:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Description,1,, "; ") ;; make sure the example is definitely a comment
else if !Instr(SnippetsStructure[1,SelectedLVEntry.3].Description,"Error 01: No description-file was found under the expected path")
Description:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Description,1,, "; ") ;; make sure the example is definitely a comment
}
else
{
if (searchstr!="") && !Instr(SnippetsStructure[1,SelectedLVEntry.3].Description,"Error 01: No description-file was found under the expected path")
Description:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Description,1,, "; ") ;; make sure the example is definitely a comment
else if !Instr(SnippetsStructure[1,SelectedLVEntry.3].Description,"Error 01: No description-file was found under the expected path")
Description:=ALG_TF_InsertPrefix(SnippetsStructure[1,SelectedLVEntry.3].Description,1,, "; ") ;; make sure the example is definitely a comment
}
;Code:=ALG_TF_InsertPrefix(Code,1,,A_Space )
Code:="; #region:Code`n" Code "`n; #endregion:Code`n"
if (Example!="") && !Instr(Example, "Error 01: No example-file was found under the expected path") {
;Code:=Code "#region:Example`n" Example "; #endregion:Example`n"
Code:=PrependTextBeforeString(Code,"; #region:Example`n" Example "`n; #endregion:Example`n")
}
if (Description!="") && !Instr(Description,"Error 01: No description-file was found under the expected path")
Code:=PrependTextBeforeString(Code, "`n; #region:Description:`n" Description "`n; #endregion:Description")
Code:=PrependTextBeforeString(Code, "`n; #region:Metadata:`n" FinalInfoText "`n; #endregion:Metadata")
Code:=ALG_st_Insert("; #region:" Name " (" SnippetsStructure[1,SelectedLVEntry.3].Metadata.Hash ")`n",Code) . "`n" ;; prepend uID-token
if (Data.License!="")
Code:=PrependTextBeforeString("`n; #region:License`n" Data.License "`n; #endregion:License",Code) ;; add "; License:`n" below Code
;Code:=PrependTextBeforeString(,Code) ;; add prepended licensetext below code
DependencyWarning:=""
if !(Data.Metadata.Dependencies="")
{
for k,v in strsplit(Data.Metadata.Dependencies,",")
DependencyWarning.="Warning: Dependency '" v "' may not be included. In that case, please search for it separately, or refer to the documentation.`n"
Code.=DependencyWarning
}
Code:=PrependTextBeforeString("; #endregion:" Name " (" SnippetsStructure[1,SelectedLVEntry.3].Metadata.Hash ")",Code)
Clipboard:=Code
nameStr:=SnippetsStructure[1,SelectedLVEntry.3,"MetaData","Name"]
Str:="On Clipboard: " SubStr(nameStr,1,20) (SnippetsStructure[1,SelectedLVEntry.3,"MetaData","Version"]!=""?" (v." SnippetsStructure[1,SelectedLVEntry.3,"MetaData","Version"] ")":"")
SB_SetText(Str , 1)
}
if IsDependency
return Code
Else
return
}
PrependTextBeforeString(Text,StringToInsert)
{ ;; adds 'StringToInsert' two lines before 'Text' and returns the result
return StringToInsert "`n`n" Text
}
FileCount(filter, mode)
{ ;-- count matching files in the working directory
loop,files,% filter,% mode
Count := A_Index
return Count
} ;</07.01.000017>
lIngestSnippet:
{
ACS_EditorImporter("Ingestion",SnippetsStructure)
}
return
lEditSnippet: ;; I have no idea how to bind a function to a gui-button itself.
{
fEditSnippet(SnippetsStructure)
}
return
fEditSnippet(SnippetsStructure:="")
{
gui 1: submit, NoHide
SelectedLVEntry:=f_GetSelectedLVEntries()
SearchStr:=fGetSearchFunctionsString()
fLoadFillDetails() ;(SnippetsStructure,DirectoryPath)
ACS_EditorImporter(SnippetsStructure[1,SelectedLVEntry.3] ,SnippetsStructure,,bForceRestartOnEdit)
return
}
fEditSettings()
{
; A_ThisHotkey
bIsAuthor:=(script.computername==script.authorID)
bIsDebug:=script.config.settings.bDebugSwitch
if ((!bIsAuthor & !bIsDebug) || (bIsAuthor & !bIsDebug)) && Instr(A_ThisHotkey,"+")
{
if ACS_InisettingsEditor(script.Name,script.configfile,1,1,1)
reload
}
else
if ACS_InisettingsEditor(script.Name,script.configfile,1,1,0)
reload
}
fCallBack_StatusBarMainWindow(Path:="")
{
global
gui submit, NoHide
if ((A_GuiEvent="DoubleClick") && (A_EventInfo=6)) || (Path=6) ;; get debug info
{
Clipboard:="Currently loaded Snippets (" CurrentLoaded[2] "):`n" CurrentLoaded[1]
}
if ((A_GuiEvent="DoubleClick") && (A_EventInfo=5)) || (Path=5) ;; trigger Error
{
if InStr(script.Error,"Critical Error [1]")
{
ErrorString=
(LTRIM
For the following snippets, the file indicated before the hash does not exist (.ini -> no ini-file. .ahk -> no .ahk-file)
Description- and Example-files are disregarded by this errorcheck.
)
ErrorString.= "`n" Object2String(SnippetsStructure[6])
Clipboard:=ErrorString
SB_SetText("Check your Clipboard for more information", 2)
SoundBeep 150, 150
SoundBeep 150, 150
SoundBeep 1750, 150
Func:=func("fResetSB").Bind(2)
Settimer % Func , -1300
}
}
if (((A_GuiEvent="DoubleClick") && (A_EventInfo=4))) || (Path=4) ;; trigger About
script.About()
if ((A_GuiEvent="DoubleClick") && (A_EventInfo=3)) || (Path=3) ;; trigger update
fEditSettings()
if ((A_GuiEvent="DoubleClick") && (A_EventInfo=2)) || (Path=2) ;; toggle debug mode
{
script.config.settings.bDebugSwitch:= !script.config.settings.bDebugSwitch
bIsAuthor:=(script.computername==script.authorID)
bIsDebug:=script.config.settings.bDebugSwitch
if (!bIsAuthor & !bIsDebug) || (bIsAuthor & !bIsDebug)
{ ;; public display
if script.config.settings.SoundAlertOnDebug
{
SoundBeep 150, 150
SoundBeep 150, 150
SoundBeep 150, 150
SB_SetText("Standard Mode Engaged. Click to enter debug-mode",2)
}
ACS_ttip("")
}
else if (!bIsAuthor & bIsDebug) || (bIsAuthor & bIsDebug)
{
if script.config.settings.SoundAlertOnDebug
{
SoundBeep 1750, 150
SoundBeep 1750, 150
SoundBeep 1750, 150
}
SB_SetText("Author/Debug Mode Engaged. Click to exit debug-mode",2)
}
if !strsplit(script.config.settings.ShowRedraw,A_Space).1
GuiControl -Redraw, LVvalue
if strsplit(script.config.settings.ShowRedraw,A_Space).1
GuiControl +Redraw, LVvalue
f_RescaleLV()
GuiControl +Redraw, LVvalue
StatusBarGetText currText, 2, % GuiNameMain
if (currText!="no Error")
if script.error
script.Debug(script.error.Level,script.error.Label,script.error.Message,script.error.AddInfo,script.error.Vars)
}
return
}
fResetSB(Ind)
{
if (Ind=2)
{
bIsAuthor:=(script.computername==script.authorID)
bIsDebug:=script.config.settings.bDebugSwitch
if (!bIsAuthor & !bIsDebug) || (bIsAuthor & !bIsDebug)
{ ;; public display