-
Notifications
You must be signed in to change notification settings - Fork 1
/
shorthand3.ahk
2998 lines (2840 loc) · 110 KB
/
shorthand3.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
#Persistent
#NoEnv ; Performance setting: http://www.autohotkey.com/docs/misc/Performance.htm
SetBatchLines -1 ; Performance setting: maximum speed for loops
ListLines Off ; Performance setting
; #Warn
#SingleInstance Force
#MaxThreadsPerHotkey 1 ; enable correction on accidental press of several hotkeys (only last pressed hotkey will fire)
OnExit, ExitSub ; when script exits, go to subroutine ExitSub
Process, Priority,, High ; increase performance for Hotkeys, Clicks, or Sends while the CPU is under heavy load
SetWorkingDir %A_ScriptDir% ; unconditionally use its own folder as its working directory
SetWinDelay,2 ; for smooth resizing
; SendMode InputThenPlay ; commented because it made the send not work all the time...
DetectHiddenWindows ON
SetTitleMatchMode 3 ; 3: A window's title must exactly match WinTitle to be a match.
FileGetTime, app_modtime, %A_ScriptFullPath%
FormatTime, app_modtime, %app_modtime%, yyyy-MMMM-dd HH:mm:ss
#include %A_ScriptDir%\inc\debugging.ahk ; for debugging purposes
#include %A_ScriptDir%\inc\Autoexec.ahk ; the autoexecute section
f_dbgtime(gen,dbg,A_LineNumber,"Bootup","start",0) ; sub_time shows in outputdebug how long a certain function/subroutine takes to run
#include %A_ScriptDir%\inc\PortableCheck.ahk ; checks where the userfiles should go (portable or user_app)
check_portable() ; this checks %A_ScriptDir%\portable.ini sets paths in the app_folder (=portable) or not (= not portable)
#include %A_ScriptDir%\inc\globals.ahk ; the global variables
#include %A_ScriptDir%\inc\lang.ahk ; language variables
#include %A_ScriptDir%\inc\history.ahk ; history functions for executed functions
#include %A_ScriptDir%\inc\plugin.ahk ; sorts plugin checking and loading
#include %A_ScriptDir%\inc\Calc.ahk ; takes care of the calculator function (enter "= " in the search window)
#include %A_ScriptDir%\inc\ShellRun.ahk ; to run programs non-elevated (because the script needs to run elevated, everything it runs will by default be elevated too)
Plugins()
read_ini()
StringReplace, ini_file_path, ini_file, %A_ScriptDir%
StringReplace, app_find_path, app_find, %A_ScriptDir%
StringReplace, app_findstr_path, app_findstr, %A_ScriptDir%
f_dbgoutput(gen,dbg,A_LineNumber,0,"portable = " portable)
f_dbgoutput(gen,dbg,A_LineNumber,0,"path = " A_ScriptDir)
f_dbgoutput(gen,dbg,A_LineNumber,0,"ini_file = " ini_file_path)
f_dbgoutput(gen,dbg,A_LineNumber,0,"app_find = " app_find_path)
f_dbgoutput(gen,dbg,A_LineNumber,0,"app_findstr = " app_findstr_path)
f_dbgoutput(gen,dbg,A_LineNumber,0,"logging = " logging)
f_dbgoutput(gen,dbg,A_LineNumber,0,"debugging = " debugging)
GoSub timer_load_custom ; needs to be before menu so menu populates correctly with (eventually, maybe) list of bound hotkeys and custom_files
SetTimer timer_load_custom
GoSub Menu
GoSub Checks
if gui_openonstartup = 1
GoSub GUI
Hotkey, IfWinActive, ahk_pid %script_PID%
Hotkey, !E, set_advanced
Hotkey, !F, toggle_set_filter_folders
Hotkey, !X, toggle_set_filter_extensions
Hotkey, !I, toggle_set_filter_ignores
Hotkey, !R, toggle_set_restricted
Hotkey, Delete, GUI_Add_deletebtn
Hotkey, !Enter, command_run_admin ; press alt-enter to run as admin
Hotkey, IfWinActive
use_everything := 1
f_dbgtime(gen,dbg,A_LineNumber,"Bootup","stop",0)
#include %A_ScriptDir%\inc\Crypt.ahk ; required for encrypting and decrypting a string
#include %A_ScriptDir%\inc\CryptFoos.ahk ; required for encrypting and decrypting a string
#include %A_ScriptDir%\inc\CryptConst.ahk ; required for encrypting and decrypting a string
; #include %A_ScriptDir%\inc\PasswordGUI.ahk ; required for encrypting and decrypting a string
#include %A_ScriptDir%\inc\MFT.ahk ; alternative to "everything.exe" and "es.exe"
Return
check_exist_folder(folder)
{
ifnotexist %folder%
FileCreateDir, %folder%
return
}
timer_load_custom: ; loads the custom_files, in which user can use shorthand and/or hotkeys to execute commands like run/send/send password
f_dbgtime(gen,dbg,A_LineNumber,"timer_load_custom","start",5)
; first, see which custom files are specified in the %ini_file%, if there is none, a custom file will be made
ini_file_modded :=
FileGetTime, ini_file_modded, %ini_file%
; check the modified timestamp against the previously loaded modified timestamp, if they're not the same,
if ini_file_modded <> %ini_file_modded_old%
{
empty_custom_number := ; clear the variable so it will be filled anew in this subroutine
ini_file_modded_old := ini_file_modded ; this is the new time to check against
loop, %max_custom% ; there's a maximum of custom_files
{
; the ini_file does not need to be loaded if it hasn't changed since the last time
; get the time the ini_file was modified
f_dbgoutput(gen,dbg,A_LineNumber,5,A_ThisLabel ": ini_file has changed so re-reading it")
IniRead, custom_file_%A_Index%, %ini_file%, Files, custom_file_%A_Index%, %A_Space%
if custom_file_%A_Index% =
{
; collect the first empty custom_file number we can later populate with a new file through GUI2
if empty_custom_number =
empty_custom_number := A_Index
; will the reasoning for A_Index = 1 below hold up? It should only do this on install, not every time
if A_Index = 1 ; so there is no custom_file in actuality, so appoint one and write it to ini FileAppend
{
custom_file_1 = %ini_location%\shorthand_custom.txt
IniWrite, %custom_file_1%, %ini_file%, Files, custom_file_1
ifnotexist %custom_file_1% ; just to be sure not to overwrite a file
{
FileAppend,
(
`; in this file you can specify lines to start certain programs with a custom name or hotkey
`; the correct syntax is:
`; name|path or contents|hotkey|choice
`; - name can be anything
`; - contents is applicable when with choice "send" or "password" is chosen
`; - hotkey is the hotkey that will execute the path or contents, using CTRL, ALT, SHIFT, SPACE, and any letters or numbers
`; - choice can be either send, run, runasadmin, password
`; example:
`; np|C:\Windows\System32\notepad.exe|WIN+N|run
`; In the Preferences (section "Custom") you can Add and remove files similar to this one.
`; I'd suggest making a separate one for your passwords, should you choose to use this tool to deploy them.
shorthand_show|show|ALT+Space|send
shorthand_setting|settings|CTRL+ALT+Space|send
shorthand_reload|reload|WIN+C|send
), %custom_file_1%
}
}
}
else
{
custom_files := A_Index ; the custom_file_A_Index that are not empty, so in effect the highest custom_file number
f_dbgoutput(gen,dbg,A_LineNumber,5,A_ThisLabel "found " custom_file_%A_Index% " which is file number " A_Index)
}
}
}
; now, read through the list of custom_files
Loop, %custom_files%
{
if custom_file_%A_Index% =
continue ; ignore empty vars
ifexist % custom_file_%A_Index%
{
; get the time the current custom_file was modified
FileGetTime, custom_file_%A_Index%_modded, % custom_file_%A_Index%
; check the modified timestamp against the previously loaded modified timestamp, if they're not the same,
if % custom_file_%A_Index%_modded <> custom_file_%A_Index%_modded_old
{
custom_file_%A_Index%_modded_old := custom_file_%A_Index%_modded ; this is the new time to check against
FileRead, custom, % custom_file_%A_Index% ; Add the content of each custom_file to the total_custom variable
custom_content_%A_Index% := custom
custom_file_updated = 1 ; so the new total_custom gets parsed
}
}
else
f_dbgoutput(gen,dbg,A_LineNumber,5,A_ThisLabel " " custom_file_%A_Index% " does not exist`, so skipped")
}
if custom_file_updated = 1 ; parsing is only needed if a custom_file was newly loaded or changed
{
total_custom :=
Loop, %custom_files%
{
if custom_content_%A_Index% <> ; if the variable is not empty
total_custom .= "`n" custom_content_%A_Index%
}
SORT, total_custom, U ; makes the variable only have unique lines, to minimise memory footprint
list_hotkeys := ; else an older command would still show up
GoSub parse_custom ; parse the newly made variable
}
f_dbgtime(gen,dbg,A_LineNumber,"timer_load_custom","stop",5)
return
parse_custom: ; parse the lines in %total_custom% (containing the contents of each custom_file)
f_dbgtime(gen,dbg,A_LineNumber,"parse_custom","start",1)
j = 0
lv_hotkeys_list :=
Loop, parse, total_custom, `n ; the total file, hotkeys only in the total_custom var
{
line := A_LoopField ; for the lv_hotkeys_list variable
if A_LoopField not contains | ; no | means it does not have the right format, so ignore it
continue
if A_LoopField contains `; ; ";" means the line is commented, so disregard it if it is in the start of the A_LoopField
{
; first, get rid of any spaces or tabs
StringReplace, commented, A_LoopField, %A_Space%,, All
StringReplace, commented, commented, %A_Tab%,, All
if SubStr(commented,1,1) = "`;"
{
f_dbgoutput(gen,dbg,A_LineNumber,3,"skipped custom_file line = """ A_LoopField """ because of ""`;""")
continue
}
}
Loop, parse, A_LoopField, |
{
if A_Index = 1 ; the second value should be the description or name
c_name := A_LoopField
if A_Index = 2 ; the second value should be the path/command/text
{
c_command := A_LoopField
if c_command =
continue ; if there's no c_command, ignore the rest, it won't do anything anyway
}
if A_Index = 3 ; the third value should be the hotkey
{
c_hotkey := A_LoopField
if c_hotkey <> ; to disregard if no hotkey has been set
{
; change hotkey text modifiers to chars that autohotkey can use in a hotkey
StringReplace,c_hotkey_expanded,c_hotkey,-,+,ALL
StringReplace,c_hotkey_expanded,c_hotkey_expanded,ALT+,!,ALL
StringReplace,c_hotkey_expanded,c_hotkey_expanded,CTRL+,^,ALL
StringReplace,c_hotkey_expanded,c_hotkey_expanded,SHIFT+,+,ALL
StringReplace,c_hotkey_expanded,c_hotkey_expanded,WIN+,#,ALL
StringReplace,c_hotkey_expanded,c_hotkey_expanded,SPACE+,SPACE,ALL
StringReplace,c_hotkey_expanded,c_hotkey_expanded,%A_Tab%,,ALL
if c_command = show ; custom command to call a subroutine from a custom_file
{
Hotkey, %c_hotkey_expanded%, GUI
c_hotkey_expanded :=
}
if c_command = settings ; custom command to call a subroutine from a custom_file
{
Hotkey, %c_hotkey_expanded%, GUI2
c_hotkey_expanded :=
}
if c_command = reload ; custom command to call a subroutine from a custom_file
{
Hotkey, %c_hotkey_expanded%, sub_reload
c_hotkey_expanded :=
}
}
}
if A_Index = 4 ; the fourth value should be the choice of command (run or send)
{
stringreplace, c_choice, A_LoopField, `r,, ALL ; for some reason, this is always needed for the last field in a line, else it'll Add what looks like a space at the end, messing up "if" statements
if c_hotkey <> ; to disregard if no hotkey has been set
{
j += 1 ; needs to be here so non-hotkeys don't take up hotkey lines
Array%j%_2 := c_command_expanded
Array%j%_3 := c_hotkey_expanded
if c_choice <>
Array%j%_4 := c_choice
else
Array%j%_4 := run
if c_hotkey_expanded <>
{
if list_hotkeys =
{
list_hotkeys = %c_hotkey_expanded%|%c_command%|%c_choice%
lv_hotkeys_list = %line%
}
else
{
list_hotkeys = %list_hotkeys%`n%c_hotkey_expanded%|%c_command%|%c_choice%
lv_hotkeys_list = %lv_hotkeys_list%`n%line%
}
hotkey, %c_hotkey_expanded%, hotkey_run ;attach default subroutine
}
}
}
}
}
Sort, lv_hotkeys_list, u
Sort, list_hotkeys, u
; this would be where we could append all the hotkeys to a list in, say, the settings GUI
f_dbgoutput(gen,dbg,A_LineNumber,4,"list_hotkeys = " list_hotkeys)
; empty all the variables
c_name :=
c_choice :=
c_hotkey :=
c_hotkey_expanded :=
c_command :=
c_command_expanded :=
custom_file_updated = 0 ; so parsing does not start again until a new custom_file has been loaded or a current one has changed
f_dbgtime(gen,dbg,A_LineNumber,"parse_custom","stop",1)
return
hotkey_run: ; this subroutine is fired when the user presses a hotkey, at which time the line it belongs to is found and the accompanying command is executed (run/send/password/whatever)
f_dbgtime(gen,dbg,A_LineNumber,"hotkey_run","start",2)
Loop, parse, list_hotkeys, `n ; the total file with all the hotkeys, hotkeys only in the total_custom var
{
Stringreplace, line, A_LoopField, `r`n,,all
Loop, parse, line, |
{
; hotkey|path|choice
if A_Index = 1
{
h_hotkey := A_LoopField
if h_hotkey <> %A_ThisHotkey% ; only continue if the hotkey is found in the line
break
}
else if A_Index = 2
h_command := A_LoopField
else if A_Index = 3
{
h_choice := A_LoopField
if(h_choice = "run") || (h_choice = "runasadmin")
{
if h_choice = runasadmin
RunAsAdmin = 1
Splitpath, h_command,, command_path, command_ext, command_name_noext
StringReplace, pressed_hotkey,A_ThisHotkey,+,SHIFT%A_Space%
StringReplace, pressed_hotkey,pressed_hotkey,^,CTRL%A_Space%
StringReplace, pressed_hotkey,pressed_hotkey,!,ALT%A_Space%
StringReplace, pressed_hotkey,pressed_hotkey,#,WIN%A_Space%
gosub sub_getextandrun
if h_choice = runasadmin
RunAsAdmin = 0
pressed_hotkey := ""
}
else if h_choice = password
SendRaw %h_command% ; this will need to be updated when the encrypt/decrypt module is Added
else if h_choice = sendraw
SendRaw %h_command%
else ; basically, this means "send"
Send %h_command%
f_dbgoutput(gen,dbg,A_LineNumber,3,"hotkey pressed: " h_hotkey " thereby executing """ h_command """ through " h_choice)
}
}
}
h_hotkey := ""
h_command := ""
h_choice := ""
f_dbgtime(gen,dbg,A_LineNumber,"hotkey_run","stop",2)
Return
sub_getextandrun:
; check if there's a parameter (it will be after the extension)
if command_ext contains %A_Space%
{
command_ext_split := Substr(command_ext,1,InStr(command_ext, A_Space))
StringReplace, arguments, command_ext, %command_ext_split%,, ALL
}
else
command_ext_split := command_ext
run_command = %command_name_noext%.%command_ext_split%
run_arguments = %arguments%
if command_run_with <> 1
selected_program := getprogram(command_ext_split) ; see if the extension in question is linked to a specified program
if command_name_noext <>
{
; show a traytip
if TrayTip = 1
{
if pressed_hotkey <>
TrayTip, Hotkey pressed and Command executing, %pressed_hotkey% pressed`nStarting "%run_command%"`nin "%command_path%",%traytime%
else
{
tray_path = 1
if selected_program =
TrayTip, Command executed, % "Starting " ((selected_program = "") ? selected_program : "" ) . run_command . arguments . ( ( command_path <> "" ) ? ((tray_path = 1 ) ? "`nin " . command_path : "") : "" ), %traytime%
else
TrayTip, Command executed, Starting %selected_program% %run_command% %arguments%`nin %command_path%,%traytime%
; TrayTip, Command executed, Starting %run_command% %arguments%`nin %command_path%,%traytime%
}
}
}
if command_name_noext =
{
firstchars := Substr(command,1,4)
if firstchars = http
run %command%, , UseErrorLevel
else
{
msgbox,, %msg_title%, Error %A_LastError%: %error_2%`n`n%msg_404%
f_dbgoutput(gen,dbg,A_LineNumber,2,"sub_getextandrun = " run_command " " arguments " in path " command_path)
}
}
else
{
if command_ext_split = lnk
ShellRun(command_path . "\" . run_command, Arguments, command_path)
else if RunAsAdmin = 1
{
if selected_program <>
run, *runAs "%selected_program%" "%run_command%" %arguments%, %command_path%, UseErrorLevel
else
run, *runAs "%run_command%" %arguments%, %command_path%, UseErrorLevel
}
else
ShellRun(run_command, Arguments, command_path)
GoSub sub_errorlevel ; needed so the msgbox contains the right feedback to the user pertaining the error
f_dbgoutput(gen,dbg,A_LineNumber,2,"sub_getextandrun = " run_command " " arguments " in path " command_path)
}
if ( use_history = 1 ) and ( pressed_hotkey = "" ) ; hotkeys don't need to be added to history
{
path_complete = %command_path%\%run_command%
fill_history(path_complete)
}
selected_program :=
gosub sub_clear
return
menu:
f_dbgtime(gen,dbg,A_LineNumber,"Menu","start",1)
; Menu, Tray, icon, %icon_shorthand% ; moved to as high in the script as possible, to prevent flickering
Menu, Tray, NoStandard
Menu, Tray, Tip, %app_name% %app_version% %beta%
Menu, Tray, Add, %app_name% %app_version% %beta%, GUI
Menu, Tray, Icon, %app_name% %app_version% %beta%, %icon_shorthand%
Menu, Tray, default, %app_name% %app_version% %beta%
Menu, Tray, Click, 1 ; click once to show
Menu, Tray, Add, Check for updates, check_update_manual
Menu, Tray, Add
Menu, menu_files, Add, Open ini file, open_ini
Menu, menu_files, Add, Open history file, open_history
Menu, menu_files, Add
Loop, %custom_files%
{
ifexist % custom_file_%A_Index%
Menu, menu_files, Add, % "Open " . custom_file_%A_Index%, menu_open ; beware of the StringTrimLeft in menu_open !
}
Menu, menu_files, Add
Menu, menu_files, Add, Add Custom file, lv_custom_file_add_existing
Loop, %A_ScriptDir%\plugins\*.ahk
{
if A_LoopFileName =
break
if A_Index = 1
{
Menu, plugins, Add, Enabled Plugins, menu_browse_plugins
}
Menu, plugins, Add, % "Open \plugins\" . A_LoopFileName, menu_open
}
Loop, %A_ScriptDir%\plugins\disabled\*.ahk
{
if A_LoopFileName =
break
if A_Index = 1
{
Menu, plugins, Add
Menu, plugins, Add, Disabled Plugins, menu_browse_plugins
}
Menu, plugins, Add, % "Open \plugins\disabled\" . A_LoopFileName, menu_open
}
Menu, plugins, Add
; this is where any plugin menu's will appear
Menu, menu_files, Add
Menu, Tray, Add, Files, :menu_files ; creates the subfolder "Files"
Menu, menu_files, Add, Plugins, :plugins ; creates the subsubfolder "plugins"
if A_IsCompiled <> 1
{
loop, %A_ScriptDir%\inc\*.ahk
{
if A_LoopFileName <>
Menu, Includes, Add, Open \inc\%A_LoopFileName%, menu_open
}
Menu, menu_files, Add, Includes, :Includes ; creates the subsubfolder "Includes"
}
Menu, Tray, Add
Menu, Tray, Add, Preferences, GUI2
Menu, Tray, Icon, Preferences, %icon_settings%
Menu, Tray, Add, Copy Path, sub_copypath_toggle
Menu, Tray, Add
Menu, Tray, Add, Send feedback, feedback
Menu, Tray, Add, About..., about
Menu, Tray, Add
if A_IsCompiled <> 1
{
Menu, Lists, Add, ListHotkeys, list_hotkeys
Menu, Lists, Add, KeyHistory, list_KeyHistory
Menu, Lists, Add, ListVars, list_vars
Menu, Lists, Add
Menu, Lists, Standard
Menu, Tray, Add, Lists, :lists ; creates the subsubfolder "Lists"
}
Menu, Tray, Add, Reload, sub_reload
Menu, Tray, Add, Exit, ExitSub
gosub sub_copypath_check
f_dbgtime(gen,dbg,A_LineNumber,"Menu","stop",1)
Return
sub_copypath_check:
if use_copypath = 1
Menu, Tray, Check, Copy Path
else
Menu, Tray, UnCheck, Copy Path
return
sub_copypath_toggle:
ifnotexist %app_folder%\copypath.exe
{
use_copypath = 0
GoSub sub_uninstall_copypath
}
else
{
use_copypath := !use_copypath
if use_copypath = 1
GoSub sub_install_copypath
else
GoSub sub_uninstall_copypath
}
IniWrite, %use_copypath%, %ini_file%, General, use_copypath
return
sub_install_copypath:
Menu, Tray, Check, Copy Path
; context menu for all files
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, *\Shell\CopyPath\command,, "%app_folder%\copypath.exe" /r "`%1"
RegWrite, REG_SZ, HKEY_CLASSES_ROOT, Folder\Shell\CopyPath\command,, "%app_folder%\copypath.exe" /r "`%1"
; context menu for all folders
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, *\SOFTWARE\Classes\Directory\shell\CopyPath\command,, "%app_folder%\copypath.exe" /r "`%1"
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, Folder\SOFTWARE\Classes\Directory\shell\CopyPath\command,, "%app_folder%\copypath.exe" /r "`%1"
return
sub_uninstall_copypath:
Menu, Tray, UnCheck, Copy Path
RegDelete, HKEY_CLASSES_ROOT, *\Shell\CopyPath,
RegDelete, HKEY_LOCAL_MACHINE, *\SOFTWARE\Classes\Directory\shell\CopyPath,
return
list_hotkeys:
ListHotkeys
return
list_KeyHistory:
KeyHistory
return
list_vars:
ListVars
return
menu_browse_plugins:
if A_ThisMenuItem = Disabled Plugins
command_path = %A_ScriptDir%\plugins\disabled\
else
command_path = %A_ScriptDir%\plugins\
ifexist %file_browser%
run, "%file_browser%" "%command_path%", %command_path%, UseErrorLevel
else
run, explore "%command_path%", %command_path%, UseErrorLevel
GoSub sub_errorlevel ; needed so the msgbox contains the right feedback to the user pertaining the error
return
menu_open: ; opens a certain file
IniRead, text_editor, %ini_file%, programs, text_editor, %A_Space%
file_open := SubStr(A_ThisMenuItem,6)
if not Instr( file_open, ":" ) ; if file_open contains a ":" it'll have a full path so don't add the script path
file_open := A_ScriptDir . "\" . file_open
; StringTrimLeft, file_open, A_ThisMenuItem, 5 ; gets rid of "Open " of the menu item
ifexist %text_editor%
run, %text_editor% "%file_open%"
else
run, %file_open%
return
open_ini:
IniRead, text_editor, %ini_file%, programs, text_editor, %A_Space%
ifexist %text_editor%
run, %text_editor% "%ini_file%"
else
run, %ini_file%
return
open_history:
IniRead, text_editor, %ini_file%, programs, text_editor, %A_Space%
ifexist %text_editor%
run, %text_editor% "%log_history%"
else
run, %log_history%
return
checks:
f_dbgtime(gen,dbg,A_LineNumber,"Checks","start",1)
if use_everything = 1
{
ifnotexist %app_find%
{
msgbox, 4, %msg_title%, %msg_filemissing%
ifmsgbox Yes
{
ifnotexist %app_folder%
FileCreateDir %app_folder%
ifnotexist %app_find%
URLDownloadToFile, http://www.voidtools.com/es.exe, %app_find%
ifnotexist %app_everything%
URLDownloadToFile, http://www.voidtools.com/Everything-1.2.1.371.exe, %app_everything%
}
exitapp
}
}
if check_for_updates_on_startup = 1
GoSub check_update_automatic
ifnotexist %app_folder%\copypath.exe
{
GoSub sub_uninstall_copypath
use_copypath = 0
IniWrite, %use_copypath%, %ini_file%, General, use_copypath
}
f_dbgtime(gen,dbg,A_LineNumber,"Checks","stop",1)
Return
GUI:
f_dbgtime(gen,dbg,A_LineNumber,"GUI","start",2)
GUI +MinSize
; check for apps\Everything.db ?
; if GUI_resize = 1
; GUI +resize -MaximizeBox ; +resize will activate the maximizebox, -MaximizeBox is to prevent that
if GUI_autohide = 1
SetTimer, timer_autohide, 1000
ifwinexist, %GUI_name% ; if the GUI already exists, just show it and do nothing else
{
GoSub GUI_show
f_dbgtime(gen,dbg,A_LineNumber,"GUI","stop",2)
return
}
; the two lines below are so the GUI does not flicker into a different spot before moving to it's saved position
GUI +LastFound +ToolWindow ; to be able to set the transparency easily
WinSet, Transparent, 0 ; starting at 0 to prevent GUI flickering on start
gui_w_edit := 250
gui_w_edit_s := gui_w_edit + 30
gui_w_edit2 := gui_w_edit + 37
gui_w_hitlist := gui_w_edit + 135
if gui_titlebar = 0
{
GUI -theme -sysmenu -caption +border
GUI color,, %gui_scheme_control%
GUI font, c%gui_scheme_font%
}
if gui_skin = 1
{
GUI Add, Picture, x4 y7 h28 w3 vgui_skin_left BackgroundTrans, %A_ScriptDir%\img\skin_left.png
GUI Add, Picture, x285 yp hp wp vgui_skin_right BackgroundTrans, %A_ScriptDir%\img\skin_right.png
GUI Add, Picture, x7 y8 h23 w%gui_w_edit_s% vgui_skin_back BackgroundTrans, %A_ScriptDir%\img\skin_back.png
GUI Add, Picture, xp y5 h4 w%gui_w_edit_s% vgui_skin_top BackgroundTrans, %A_ScriptDir%\img\skin_top.png
GUI Add, Picture, xp y29 h2 w%gui_w_edit_s% vgui_skin_bottom BackgroundTrans, %A_ScriptDir%\img\skin_bottom.png
GUI Add, Picture, x9 y13 h16 w16 vtarget_icon gGUIContextMenu Icon1, %icon_shorthand%
GUI Add, Edit, x30 y14 h12 w%gui_w_edit% -E0x200 vcommand_search gsearch section,
}
else
{
GUI Add, Picture, x7 y9 h16 w16 vtarget_icon gGUIContextMenu Icon1, %icon_shorthand%
GUI Add, Edit, x30 y6 w%gui_w_edit% vcommand_search gsearch section r1,
}
gui_xempty = 0
if gui_xempty = 1
GUI Add, Text, ys h17 w10 y8 vsub_clear ggui_xempty left, x
; row one of the main GUI (the simple portion, the command_search editbox, toggle simple/advanced and the settings)
GUIControl, focus, command_search
if advanced_border = 1
GUI Add, Button, ys+1 h20 w72 vset_advanced gset_advanced border center, %gui_advanced%
else
GUI Add, button, ys+1 h21 w72 vset_advanced gset_advanced center, %gui_advanced%
GUI Add, Picture, ys+3 h16 w16 vpreferences_icon gGUI2 Icon1, %icon_settings% ; this control to be moved through GUISize
GUI Add, Button, ys-1 gcommand_run default hidden,
; row two of the main GUI (the advanced portion, like the search_inside editbox)
; needs to start shown, to get the coordinates for advanced/simple toggle
GUI Add, Text, x32 h16 w60 vadvanced section, %gui_containing%
GUI Add, Edit, x100 ys-3 w%gui_w_edit2% vsearch_inside gsearch section r1, %parameter% ; the y of this control functions as the mark of the Y for the advanced section
GUIControlGet, search_inside, Pos ; to determine what Y the advanced controls are at, needed for moving the controls
; filter_extensions lets the user decide to filter the results based on extension
GUI Add, Checkbox, x9 h16 vfilter_extensions gset_filter_extensions Checked%filter_extensions% %advanced_status% section, %A_Space%%gui_extensions%
GUI Add, Edit, x100 ys-4 w%gui_w_edit2% r1 vlist_extensions gset_extensions right %advanced_status%, %list_extensions% ; this control to be resized through GUISize
; filter_folders lets the user decide to not show the folders
GUI Add, Checkbox, xs h16 vfilter_folders gset_filter_folders Checked%filter_folders% %advanced_status% section, %A_Space%%gui_hidefolders%
; filter_ignores lets the user decide to not show files with certain words
GUI Add, Checkbox, ys h16 vfilter_ignores gset_filter_ignores Checked%filter_ignores% %advanced_status%, %A_Space%%gui_ignorelist%
; restricted_mode lets the user only show hits in certain folder (pinned/startmenu/desktop)
GUI Add, Checkbox, ys h16 vrestricted_mode gset_restricted_mode Checked%restricted_mode% %advanced_status%, %A_Space%%gui_restrictedmode%
; the listbox which will hold the results
GUI Add, ListView, x7 r20 w%gui_w_hitlist% vhitlist gsub_lv_cmd AltSubmit -multi count%max_results% sort hidden, %gui_hitlist%
GUIControlGet, hitlist, Pos ; to determine what Y the hitlist is at, needed for moving the controls
GoSub select_hitlist
LV_ModifyCol(5,0) ; hides the run/runas column
if hide_extensions = 1 ; hides the ext column
LV_ModifyCol(2, 0)
; the status line with information about the search time and selected file
Gui, add, StatusBar, vstatus_text, %gui_statustext%
; SB_SetParts(20) ; The icon first
SB_SetIcon(icon_search)
; GUI Add, Text, x9 w%gui_w_hitlist% r1 vstatus_text hidden, %gui_statustext%
GUIControlGet, status_text, Pos
if GUI_statusbar = 1
GUIControl, show, status_text
; this next section hides/shows controls based on settings
if search_advanced <> 1
GoSub GUI_advanced_hide
else
GoSub GUI_advanced_show
LV_ModifyCol(1,200) ; resizes column 1
GoSub sub_select ; takes care of the up/down when results are being shown
GUI +MinSize ToolWindow +LastFound
; make sure that the GUI is not out of bounds (for instance after resolution switch)
GoSub GUI_check_bounds
GUI Add, Picture, x5 y5 w1 h1 gMoveGui vBackground BackgroundTrans, ; %A_ScriptDir%\img\black.png ; black.png is for troubleshooting
GoSub GUI_show
; WinSet, TransColor, FF00FF, %GUI_Name% ; for the edges of the GUI
f_dbgtime(gen,dbg,A_LineNumber,"GUI","stop",2)
return
MoveGui: ; berban : Allows for moving the GUI through the background image on the GUI
if gui_easymove = 1
PostMessage, 0xA1, 2,,, A
Return
GUI_hide:
f_dbgtime(gen,dbg,A_LineNumber,"GUI_hide","start",3)
CRITICAL ON ; critical so the fading is not interrupted by a hotkey starting the fadein
if GUI_fade = 1
{
transparency = 255
Loop
{
GUI +LastFound
transparency -= %transparency_step%
WinSet, Transparent, %transparency%
sleep 50
if transparency <= 0
break
}
transparency = 255
WinSet, Transparent, %transparency%
}
GUI_hidden = 1
GUI, hide
CRITICAL OFF
f_dbgtime(gen,dbg,A_LineNumber,"GUI_hide","stop",3)
return
gui_bg_resize: ; resizes the background label needed for easymove
GuiControl, MoveDraw, Background, x0 y0 h1 w1 ; first, make the bg as small as possible
GUI, Show, autosize ; then, autosize the GUI
if GUIHeight <>
GuiControl, MoveDraw, Background, % "x0 y0 h" GuiHeight " w" GuiWidth ; resize the bg to the maximal size
return
GUISize:
if A_GUIWidth =
return
GUIWidth := A_GUIWidth
GUIHeight := A_GUIHeight
gosub gui_bg_resize
return
GUI_show:
f_dbgtime(gen,dbg,A_LineNumber,"GUI_show","start",3)
CRITICAL ON ; critical so the fading is not interrupted by a hotkey starting the fadeout
if GUI_hidden <> 0
{
ifwinexist, %GUI_name%
{
if GUI_fade = 1
WinSet, Transparent, 0 ; invisible to start
}
}
if GUI_ontop = 1
GUI +AlwaysOnTop
GUI +MinSize445 ToolWindow ; +resize
gosub gui_bg_resize
GUI, Show, X%GUI_x% Y%GUI_y%, %GUI_name%
OnMessage(0x200, "GUI_MOUSEOVER") ; makes it so mouseover controls in the GUI will show a tooltip
if GUI_hidden <> 0
{
if GUI_fade = 1
{
GUI +LastFound ; to be able to set the transparency easily
WinSet, Transparent, 0 ; start at 0 : completely invisible
transparency = 0
Loop ; slowly loop until visibility is reached (default 255)
{
transparency += %transparency_step%
WinSet, Transparent, %transparency%
sleep 50
if transparency >= 255
break
}
}
else
WinSet, Transparent, 255
}
GUI_hidden = 0
gui, submit, nohide
if command_search =
{
outputdebug empty > %gui_statustext% : Fill search field...
SB_SetText(gui_statustext) ; just in case the search has been emptied before the subroutine was done searching
}
GUIControl, focus, command_search
if gui_xempty = 1
GUIControl,, sub_clear, x
CRITICAL OFF
f_dbgtime(gen,dbg,A_LineNumber,"GUI_show","stop",3)
return
GUI_save_pos:
f_dbgtime(gen,dbg,A_LineNumber,"GUI_save_pos","start",3)
if GUI_Hidden = 1 ; to prevent the subroutine getting the pos while the GUI is hidden
return
; get position and dimensions of the GUI
WinGetPos, GUI_x_new, GUI_y_new, GUI_w_new, GUI_h_new, %GUI_name%
; if the location or dimension has not changed, we don't need to write the position
if ( GUI_x_new <> %GUI_x% ) AND ( GUI_y_new <> %GUI_y% ) AND ( GUI_w_new <> %GUI_w% ) AND ( GUI_h_new <> %GUI_h% )
{
GUI_x := GUI_x_new
GUI_y := GUI_y_new
GUI_w := GUI_w_new
GUI_h := GUI_h_new
; make sure that the GUI is not out of bounds (for instance after resolution switch)
GoSub GUI_check_bounds
; write the position to the ini_file in case of restart
IniWrite, %GUI_x%, %ini_file%, GUI, GUI_x
IniWrite, %GUI_y%, %ini_file%, GUI, GUI_y
IniWrite, %GUI_w%, %ini_file%, GUI, GUI_w
IniWrite, %GUI_h%, %ini_file%, GUI, GUI_h
f_dbgoutput(gen,dbg,A_LineNumber,3,A_ThisLabel "new position : x" GUI_x " y" GUI_y " w" GUI_w " h" GUI_h)
}
f_dbgtime(gen,dbg,A_LineNumber,"GUI_save_pos","stop",3)
return
GUI_check_bounds:
f_dbgtime(gen,dbg,A_LineNumber,"GUI_check_bounds","start",3)
; make sure that the GUI is not out of bounds (for instance after resolution switch)
if GUI_x < 0
GUI_x := 0
if GUI_x + GUI_w > A_ScreenWidth
GUI_x := A_ScreenWidth - GUI_w
if GUI_y < 0
GUI_y := 0
if GUI_y + GUI_h > A_ScreenHeight
GUI_y := A_ScreenHeight - GUI_h
f_dbgtime(gen,dbg,A_LineNumber,"GUI_check_bounds","stop",3)
Return
GUI2: ; the GUI with the preferences and settings
f_dbgtime(gen,dbg,A_LineNumber,"GUI2","start",1)
GUI 2:destroy
GUI 2:Default ; Default needed for the treeview
GUI 2:+owner ; Will make it so preferences is always on top of the main GUI. This line has to be before any "GUI, 2:Add" is done, and after GUI 1: has been created.
GUI 2:-alwaysontop
ifwinexist, %GUI2_name% ; if the GUI already exists, just show it and do nothing else
{
GUI, 2:Show, AutoSize, %GUI2_name%
f_dbgtime(gen,dbg,A_LineNumber,"GUI2","stop",1)
return
}
; sort the menus in the preferences GUI
GoSub GUI2menu
; make the treeview
GUI, 2:Add, TreeView, r25 w150 vpref_tree gpref_treesel section
P1 := TV_Add(gui2_p1,0, "expand select") ; Program Options
P1C1 := TV_Add(gui2_p1c1, P1, "expand") ; Settings; Specify P1 to be this item's parent.
P1C1C1 := TV_Add(gui2_p1c1c1, P1C1) ; Results
P1C1C2 := TV_Add(gui2_p1c1c2, P1C1) ; Custom
; P1C1C3 := TV_Add(gui2_p1c1c3, P1C1) ; Hotkeys
P1C1C4 := TV_Add(gui2_p1c1c4, P1C1) ; Plugins
P1C2 := TV_Add(gui2_p1c2, P1) ; About
; P2 := TV_Add(gui2_p2, P2) ; Troubleshooting Log
GUIControlGet, pref_tree, Pos ; to determine what Y the top is
; status bar which fills with text that are hopefully helpful to the user
GUI, 2:Add, GroupBox, x10 w640 h35 section, %gui2_information%
GUI, 2:Add, Text, xs+10 yp+15 w620 r1 v2statusbar, %info_statusbar%
OnMessage(0x200, "GUI2_MOUSEOVER") ; makes it so mouseover controls in the GUI will update the statusbar text
GUI, 2:Add, Button, x300 yp-43 w100 vcheck_update_manual gcheck_update_manual, %gui2_checkforupdates%
GUI, 2:Add, Button, xp+135 YP w100 vGUI2_button_reload gsub_reload, %gui2_reload%
GUI, 2:Add, Button, xp+110 yp w100 default gGUI2_button_ok, %ok_button% ; default so it'll have focus, so an enter can just be pressed
; get the selected tree item
tree_sel_prev := TV_GetSelection()
TV_GetText(tree_sel_prev_text, tree_sel_prev)
StringReplace, tree_sel_prev_text, tree_sel_prev_text, %A_Space%, _, ALL ; we'll be using the text as a variable
GroupBoxX := pref_treex + pref_treew + 10
; "Program_Options" (shown at the start)
GUI, 2:Add, GroupBox, x%GroupBoxX% y%pref_treey% vp1_1_general w480 r6 section, %gui2_gen%
GUI, 2:Add, Checkbox, xp+20 yp+20 vautostart gsub_autostart_toggle Checked%autostart%, %A_Space%%A_Space%%gui2_gen_autostart%
GUI, 2:Add, Checkbox, xp yp+20 vcheck_for_updates_on_startup gGUI2_set_general Checked%check_for_updates_on_startup%, %A_Space%%A_Space%%gui2_gen_check%
GUI, 2:Add, Checkbox, xp yp+20 vtraytip gGUI2_set_general Checked%traytip%, %A_Space%%A_Space%%gui2_gen_traytip%
GUI, 2:Add, Checkbox, xp yp+20 vGUI_titlebar gGUI_titlebar Checked%GUI_titlebar%, %A_Space%%A_Space%%gui2_gen_titlebar%
GUI, 2:Add, Checkbox, xp yp+20 vGUI_easymove gGUI_easymove Checked%GUI_titlebar%, %A_Space%%A_Space%%gui2_gen_easymove%
/*
to Add:
- open ini_file
- portable (check for existing .ini file and ask user if they want to overwrite it with their current settings)
- showing icon on taskbar "toolwindow" when active
*/
; programs to open with
GUI 2:Add, GroupBox, xs w480 h225 vp1_1_progs, Programs
GUI 2:Add, Text, xp+20 yp+25 w90 vbrowser_text section, Internet browser
GUI 2:Add, Edit, xp+90 yp-3 vbrowser r1 w300 readonly, %browser%
GUI 2:Add, Button, xp+305 yp-1 w50 vselect_browser gselect_browser, browse
GUI 2:Add, Checkbox, xs+90 vuse_custom_browser gsub_custom_browser_toggle Checked%use_custom_browser%, %A_Space%%A_Space%%gui2_gen_custombrowser%
GUI 2:Add, Text, xs yp+35 w90 vtext_editor_text, Text editor
GUI 2:Add, Edit, xp+90 yp-3 vtext_editor r1 w300 readonly, %text_editor%
GUI 2:Add, Button, xp+305 yp-1 w50 vselect_text_editor gselect_text_editor, browse
GUI 2:Add, Text, xs yp+28 w90 vtext_editor_text2, Use with
GUI 2:Add, Edit, xp+90 yp-3 vtext_editor_ext r1 gGUI2_set w300, %text_editor_ext%
GUI 2:Add, Text, xs yp+35 w90 vgraphics_editor_text, Graphics editor
GUI 2:Add, Edit, xp+90 yp-3 vgraphics_editor r1 w300 readonly, %graphics_editor%
GUI 2:Add, Button, xp+305 yp-1 w50 vselect_graphics_editor gselect_graphics_editor, browse
GUI 2:Add, Text, xs yp+28 w90 vgraphics_editor_text2, Use with
GUI 2:Add, Edit, xp+90 yp-3 vgraphics_editor_ext gGUI2_set r1 w300, %graphics_editor_ext%
GUI 2:Add, Text, xs yp+35 w90 vfile_browser_text, File browser
GUI 2:Add, Edit, xp+90 yp-3 vfile_browser r1 w300 readonly, %file_browser%
GUI 2:Add, Button, xp+305 yp-1 w50 vselect_file_browser gselect_file_browser, browse
; this is a list of all the variables on this treeview selection, need it to easily hide/show
Program_Options = p1_1_general|autostart|traytip|GUI_titlebar|GUI_easymove|check_for_updates_on_startup|p1_1_progs|browser_text|browser|select_browser|use_custom_browser|text_editor_text|text_editor|select_text_editor|graphics_editor_text|graphics_editor|select_graphics_editor|file_browser_text|file_browser|select_file_browser|graphics_editor_text2|graphics_editor_ext|text_editor_text2|text_editor_ext
; "Settings"
GUI, 2:Add, GroupBox, x%GroupBoxX% y%pref_treey% vp1c1_1 w480 h160 section hidden, Settings
GUI, 2:Add, Checkbox, xp+20 yp+20 vGUI_ontop gGUI2_set Checked%GUI_ontop% hidden, %A_Space%%A_Space%Main window is &always on top
GUI, 2:Add, Checkbox, xp yp+20 vGUI_fade gGUI2_set Checked%GUI_fade% hidden, %A_Space%%A_Space%&Fade the main window in and out
GUI, 2:Add, Checkbox, xp yp+20 vGUI_statusbar gGUI2_set Checked%GUI_statusbar% hidden, %A_Space%%A_Space%&Status bar in the main window
GUI, 2:Add, Checkbox, xp yp+20 vGUI_autohide gGUI2_set Checked%GUI_autohide% hidden, %A_Space%%A_Space%&Hide the main window when it loses focus
GUI, 2:Add, Checkbox, xp yp+20 vGUI_hideafterrun gGUI2_set Checked%GUI_hideafterrun% hidden, %A_Space%%A_Space%H&ide the main window after running a command
GUI, 2:Add, Checkbox, xp yp+20 vGUI_emptyafterrun gGUI2_set Checked%GUI_emptyafterrun% hidden, %A_Space%%A_Space%&Clear search text after running a command
GUI, 2:Add, Checkbox, xp yp+20 vGUI_emptyafter30 gGUI2_set Checked%GUI_emptyafter30% hidden, %A_Space%%A_Space%C&lear search text after 30 seconds of non-typing
Settings = p1c1_1|GUI_ontop|GUI_autohide|GUI_fade|GUI_statusbar|GUI_hideafterrun|GUI_emptyafterrun|GUI_emptyafter30
; "Results"
GUI, 2:Add, GroupBox, x%GroupBoxX% y%pref_treey% vp1c1c1_1 w480 h200 section hidden, Results
GUI, 2:Add, Checkbox, xp+20 yp+20 vfilter_folders gGUI2_set Checked%filter_folders% hidden, %A_Space%%A_Space%Do not show folders in results
;GUI, 2:Add, Checkbox, xp yp+20 vfilter_systemfiles gGUI2_set Checked%filter_systemfiles% hidden, %A_Space%%A_Space%Do not show system files in results
;GUI, 2:Add, Checkbox, xp yp+20 vfilter_hiddenfiles gGUI2_set Checked%filter_hiddenfiles% hidden, %A_Space%%A_Space%Do not show hidden files in results
GUI, 2:Add, Checkbox, xp yp+20 vfilter_extensions gGUI2_set Checked%filter_extensions% hidden, %A_Space%%A_Space%Only show certain extensions in the result (separate with `,)
GUI, 2:Add, Edit, xp+20 yp+20 w420 vlist_extensions gGUI2_set_list r3 hidden, %list_extensions%
GUI, 2:Add, Checkbox, xp-20 yp+55 vfilter_ignores gGUI2_set Checked%filter_ignores% hidden, %A_Space%%A_Space%Use ignore list for files and folders (separate with `,)
GUI, 2:Add, Edit, xp+20 yp+20 w420 vlist_ignores gset_list_ignores r3 hidden, %list_ignores%
GUI, 2:Add, Text, xp yp+3 vuse_history gGUI2_set Checked%use_history% hidden, use History
; scoring
GUI, 2:Add, GroupBox, x%GroupBoxX% ys+210 vp1c1c1_2 w480 h200 section hidden, Scoring
GUI, 2:Add, Checkbox, xs+20 yp+20 vuse_score gGUI2_set Checked%use_score% hidden, %A_Space%%A_Space%Use scoring for files and folders (higher scores will be higher in the results list)
GUI, 2:Add, Edit, xs+20 yp+20 vscore_history w40 gGUI2_set number right hidden, %score_history%
GUI, 2:Add, Text, xp+50 yp+3 vscore_history_text w250 hidden, History
GUI, 2:Add, Edit, xs+20 yp+20 vscore_custom w40 gGUI2_set number right hidden, %score_custom%
GUI, 2:Add, Text, xp+50 yp+3 vscore_custom_text w250 hidden, Custom Files
Results = p1c1c1_1|filter_folders|filter_systemfiles|filter_hiddenfiles|filter_extensions|list_extensions|filter_ignores|list_ignores|p1c1c1_2|use_score|score_history|score_history_text|score_custom|score_custom_text
; Custom
GUI 2:Add, GroupBox, x%GroupBoxX% y%pref_treey% vp1c1c2_customfiles w480 h175 section hidden, Custom Files
GUI 2:Add, ListView, xs+20 yp+20 r5 w440 vlv_custom_files glv_custom_file_click AltSubmit -multi hidden, Number|Path
GoSub lv_custom_files_fill
GUI 2:Add, Button, xp yp+120 w50 vlv_custom_file_add_existing glv_custom_file_add_existing hidden, Add
GUI 2:Add, Button, xp+60 w50 vlv_custom_file_add_new glv_custom_file_add_new hidden, New
GUI 2:Add, Button, xp+60 yp w50 vlv_custom_file_Edit glv_custom_file_Edit hidden, Edit
GUI 2:Add, Button, xp+60 yp w50 vlv_custom_file_remove glv_custom_file_remove disabled hidden, Remove ; just removes the line, asks the user if the file needs to be deleted too
Custom = p1c1c2_customfiles|lv_custom_files|lv_custom_file_add_existing|lv_custom_file_add_new|lv_custom_file_Edit|lv_custom_file_remove
; Hotkeys
GUI 2:Add, GroupBox, x%GroupBoxX% y%pref_treey% vp1c1c3_hotkeys w480 h360 section hidden, Hotkeys
GUI 2:Add, ListView, xs+20 yp+20 r8 w440 vlv_hotkeys glv_hotkeys_click AltSubmit -multi hidden, Name|Hotkey|Command|Mode
GoSub lv_hotkeys_fill
GUI 2:Add, Text, xp yp+180 w440 vhotkeys_text hidden, Enter or edit hotkey lines below.
GUI 2:Add, Text, xp yp+25 w50 vc_name_text hidden, Name
GUI 2:Add, Edit, xp+60 yp-3 w315 vc_name gc_update hidden,
GUI 2:Add, Button, xp+325 yp w50 vlv_hotkeys_Edit2 glv_hotkeys_Edit disabled hidden, Edit
; look at shorthand2 for how to do this
GUI 2:Add, Text, xs+20 yp+30 w50 vc_hotkey_text hidden, Hotkey
GUI 2:Add, Hotkey, xp+60 yp-3 w315 vc_hotkey hidden uppercase,
GUI 2:Add, Button, xp+325 yp w50 vlv_hotkeys_add_new glv_hotkeys_add_new disabled hidden, Add
GUI 2:Add, Checkbox, xs+80 yp+25 w60 vc_hotkey_mod_win hidden, %A_Space%%A_Space%WIN
GUI 2:Add, Checkbox, xp+70 yp w60 vc_hotkey_mod_space hidden, %A_Space%%A_Space%SPACE
GUI 2:Add, Text, xs+20 yp+30 w50 vc_path_text hidden, Command
GUI 2:Add, Edit, xp+60 yp-3 w315 vc_path gc_update hidden,
GUI 2:Add, Button, xp+325 yp w50 vc_path_browse gc_path_browse hidden, Browse
; browse for path
GUI 2:Add, Text, xs+20 yp+30 w50 vc_mode_text hidden, Mode
GUI 2:Add, DropDownList, xp+60 yp-3 w315 vc_mode hidden, run|send|password
GUI 2:Add, Button, xp+325 yp w50 vlv_hotkeys_remove glv_hotkeys_remove disabled hidden, Remove
; add hotkey to which custom_file?
; add button
; clear button
hotkeys = p1c1c3_hotkeys|lv_hotkeys|lv_hotkeys_add_new|lv_hotkeys_Edit|c_hotkey_mod_win|c_hotkey_mod_space|lv_hotkeys_remove|hotkeys_text|c_name|c_path|c_hotkey|c_mode|c_name_text|c_path_text|c_hotkey_text|c_mode_text|c_path_browse