-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathHotstrings.ahk
15760 lines (15016 loc) · 739 KB
/
Hotstrings.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
/*
Author: Maciej Słojewski (mslonik, http://mslonik.pl)
Purpose: Facilitate maintenance of (triggerstring, hotstring) concept.
Description: Hotstrings AutoHotkey concept expanded, editable with GUI and many more options.
License: MIT License
Year: 2022 / 2023
*/
; -----------Beginning of auto-execute section of the script, directives and general settings -------------------------------------------------
; After the script has been loaded, it begins executing at the top line, continuing until a Return, Exit, hotkey/hotstring label, or the physical end of the script is encountered (whichever comes first).
#Requires AutoHotkey v1.1.34+ ; Displays an error and quits if a version requirement is not met.
#SingleInstance, force ; Only one instance of this script may run at a time!
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
#LTrim ; Omits spaces and tabs at the beginning of each line. This is primarily used to allow the continuation section to be indented. Also, this option may be turned on for multiple continuation sections by specifying #LTrim on a line by itself. #LTrim is positional: it affects all continuation sections physically beneath it.
#KeyHistory, 10 ; KeyHistory is necessary for A_PriorKey
#HotkeyInterval, 1000 ; Specifies the rate of hotkey activations beyond which a warning dialog will be displayed. Default value = 2000 ms.
#MaxHotkeysPerInterval, 200 ; Specifies the rate of hotkey activations beyond which a warning dialog will be displayed. Default value = 70.
#MenuMaskKey, vkE8 ; vkE8 is something unassigned; this is important for F_Undo if triggerstring contained "l" and #z (Win + z) is applied as undo character
ListLines, Off ; ListLines is disabled to make it harder to determine how script works.
SendMode, Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir, % A_ScriptDir ; Ensures a consistent starting directory.
FileEncoding, UTF-16 ; Sets the default encoding for FileRead, FileReadLine, Loop Read, FileAppend, and FileOpen(). Unicode UTF-16, little endian byte order (BMP of ISO 10646). Useful for .ini files which by default are coded as UTF-16. https://docs.microsoft.com/pl-pl/windows/win32/intl/code-page-identifiers?redirectedfrom=MSDN Warning! UTF-16 is not recognized by Notepad++ editor (2021), which recognizes correctly UCS-2 (defined by the International Standard ISO/IEC 10646). BMP = Basic Multilingual Plane.
CoordMode, Caret, Screen ; Only Screen makes sense for functiofirmadd/ns prepared in this script to handle position of on screen GUIs.
CoordMode, ToolTip, Screen ; Only Screen makes sense for functions prepared in this script to handle position of on screen GUIs.
CoordMode, Mouse, Screen ; Only Screen makes sense for functions prepared in this script to handle position of on screen GUIs.
; - - - - - - - - - - - - - - - - - - - - - - - E X E CONVERSION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;Parameters in this section can be used to prepare executable file of ahk2exe.exe without GUI interface. All options are set within this file. The executable is made as little as possible by exchanging .exe with .bin file. Also other tricks are applied.
global AppIcon := "hotstrings.ico" ; Imagemagick: convert hotstrings.svg -alpha off -resize 96x96 -define icon:auto-resize="96,64,48,32,16" hotstrings.ico
;@Ahk2Exe-Let U_AppIcon=%A_PriorLine~U)^(.+"){1}(.+)".*$~$2% ; Keep this line and the previous one together
;@Ahk2Exe-SetMainIcon %U_AppIcon%
global AppVersion := "3.6.24" ;release on 2024-05-13 (Monday).
;@Ahk2Exe-Let U_AppVersion=%A_PriorLine~U)^(.+"){1}(.+)".*$~$2% ; Keep this line and the previous one together
;The compiler will be run at least once for each Base directive line. Only for .exe Base it is possible to encrypt content!
; @Ahk2Exe-Base Unicode 64-bit.bin,, 65001
;@Ahk2Exe-Base ..\AutoHotkeyU64.exe,, 65001
;EXE file header, settings common for commercial and free releases
;@Ahk2Exe-SetFileVersion %U_AppVersion%
;@Ahk2Exe-SetInternalName Hotstrings
;@Ahk2Exe-SetLanguage 0x0409
;@Ahk2Exe-SetLegalTrademarks Damian Damaszke Dam IT
;@Ahk2Exe-SetVersion %U_AppVersion%
;@Ahk2Exe-SetDescription Advanced tool for text replacement management.
;@Ahk2Exe-Let U_BinExe=%A_BasePath~.*[\.]% ;only extension
;@Ahk2Exe-Obey U_bits, = %A_PtrSize% * 8
;@Ahk2Exe-Obey U_type, = "%A_IsUnicode%" ? "Unicode" : "ANSI"
;@Ahk2Exe-ExeName %A_ScriptName~\.[^\.]+$%_%U_type%_%U_bits%_%U_BinExe%
;#c/* commercial only beginning
;#c*/ commercial only end
;#f/* free version only beginning
;@Ahk2Exe-SetCompanyName http://mslonik.pl Maciej Słojewski
;@Ahk2Exe-SetCopyright MIT License
;@Ahk2Exe-SetName %A_ScriptName~\.[^\.]+$%
;@Ahk2Exe-SetOrigFilename Free release
;@Ahk2Exe-SetProductName %A_ScriptName~\.[^\.]+$%
;@Ahk2Exe-SetProductVersion %U_AppVersion%
;#f*/ free version only end
;#c/* commercial only beginning
;#c*/ commercial only end
;@Ahk2Exe-Debug End of processing: %A_ScriptName~\.[^\.]+$%_%U_type%_%U_bits%_%U_BinExe%
; - - - - - - - - - - - - - - - - - - - - - - - S E C T I O N O F G L O B A L V A R I A B L E S - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
;#c/* commercial only beginning
;#c*/ commercial only end
;#f/* free version only beginning
global v_SilentMode := "" ;
;#f*/ free version only end
, v_LogCounter := 0
, v_CntCumGain := 0 ;for logging, Counter Cumulative Gain
, f_MainGUIresizing := true ;when Hotstrings Gui is displayed for the very first time; f_ stands for "flag"
, TT_C1Hwnd := 0 ;Triggerstring Tips Composition no. 1: triggestring tips only; must be declared explicitly because is used in #if directives (pre processed).
, TT_C2Hwnd := 0 ;Triggerstring Tips Composition no. 2: triggestring tips + triggers (2 columns); must be declared explicitly because is used in #if directives (pre processed).
, TT_C3Hwnd := 0 ;Triggerstring Tips Composition no. 3: triggestring tips + triggers + hotstrings (3 columns); must be declared explicitly because is used in #if directives (pre processed).
, TT_C4Hwnd := 0 ;Triggerstring Tips Composition no. 3: static window; must be declared explicitly because is used in #if directive (pre processed)
, HMenuCLIHwnd := 0
, HMenuAHKHwnd := 0
, HS3GuiHwnd := 0
, HS3SearchHwnd := 0
, HS4GuiHwnd := 0
, MoveLibsHwnd := 0
, TDemoHwnd := 0
, HDemoHwnd := 0 ;This is a trick to initialize global variables in order to not get warning (#Warn) message
, ATDemoHwnd := 0
, HotstringDelay := 0
, WhichMenu := "" ;available values: CLI or MSI
, v_EndChar := "" ;initialization of this variable is important in case user would like to hit "Esc" and GUI TT_C4 exists.
, AppStartTime := "" ;When application got started, this parameter is used for performance statistics
, v_EnDis := true
, v_TotalHotstringCnt := 0
, v_LibHotstringCnt := 0 ;no of (triggerstring, hotstring) definitions in single library
, ini_TTCn := 0 ;this variable could be triggered by left mouse click when script is initialized.
, v_Qinput := "" ; to store substring of v_InputString related to possible question mark (inside) option
, c_MB_I_Error := 16 ;constant, MsgBox icon hand (stop/error)
, c_MB_I_Question := 32 ;constant, MsgBox icon question
, c_MB_I_Exclamation := 48 ;constant, MsgBox icon exclamation
, c_MB_I_Info := 64 ;constant, MsgBox icon asterisk (info)
, c_MB_B_OK := 0 ;constant, MsgBox button, OK
, c_MB_B_YesNo := 4 ;constant, MsgBox buttons, Yes/No
, c_MB_M_AonTop := 4096 ;constant, MsgBox modality, System Modal (always on top)
, c_MB_DB_2nd := 256 ;constant, MsgBox default button, second
, v_Triggerstring := "" ;to store d(t, o, h) -> t entered by user in GUI.
, ini_ShowWhiteChars := false ;future: show white characters (e.g. space) within GUI in form of special characters. For example <space> = U+2423 (open box ␣)
;#f/* free version only beginning
, v_LicenseType := "free" ;"pro" or "free"
;#f*/ free version only end
;#c/* commercial only beginning
;#c*/ commercial only end
;#c/* commercial only beginning
;#c*/ commercial only end
;#f/* free version only beginning
, v_LicenseName := "GNU GPL v3.x license"
;#f*/ free version only end
, c_xmarg := 10 ;pixels, default value (it can be changed by user)
, c_ymarg := 10 ;pixels, default value (it can be changed by user)
, c_FontColor := "Black"
, c_FontColorHighlighted := "Blue"
, c_WindowColor := "Default"
, c_ControlColor := "Default"
, c_FontSize := 10 ;points
, c_FontType := "Consolas"
, f_100msRun := false ;global flag: timer is running, 100 ms, for concurrent press of Shift keys
, f_WasReset := false ;global flag: Shift key memory reset (to reset hotstring recognizer)
, c_MHDelimiter := "¦" ;global constant: unique character applied as delimiter for menu hotstrings
, c_TextDelimiter := "‖" ;global constant: unique character applied as delimiter for text
, c_dHK_UndoLH := "~#z" ;global constant: default (d) hotkey (HK) for Undo
, c_dHK_CopyClip := "~^#c" ;global constant: default (d) hotkey (HK) for Copy to clipboard future hotstring content
, c_dHK_CallGUI := "#^h" ;global constant: default (d) hotkey (HK) for calling main application GUI
, c_dHK_ToggleTt := "none" ;global constant: default (d) hotkey (HK) for toggling the triggestring tips
, c_AppDataLocal := SubStr(A_Desktop, 1, -7) . "AppData\Local" ;default location for folders of Hotstrings application: ;C:\Users\<User>\AppData\Local\. The same location is used in the NSIS installer.
, IdTT_C4_LB1 := 0 ;in order to get rid of warnings in specific situation: file BOM is incorrect and user clicked somethint
, IdTT_C4_LB2 := 0 ;in order to get rid of warnings in specific situation: file BOM is incorrect and user clicked somethint
, IdTT_C4_LB3 := 0 ;in order to get rid of warnings in specific situation: file BOM is incorrect and user clicked somethint
;#c/* commercial only beginning
;#c*/ commercial only end
, f_EndChar := false ;global flag, set when RWin key is pressed and if user configured RWin to trigger EndChar
, ini_LicenseKey := "" ;global variable
, v_ScriptDir := c_AppDataLocal . "\" . SubStr(A_ScriptName, 1, -4) ;default value
, ini_HADConfig := v_ScriptDir . "\" . "Config.ini" ;default value
, ini_HADL := v_ScriptDir . "\" . "Libraries" ;default value
, ini_THLog := ""
, ini_Language := "English.txt" ;default value
, ini_GuiReload := false ;default value, if true, application will be reloaded
, ini_CheckRepo := false ;default value, if true GitHub server is asked for presence of new application version
, ini_DownloadRepo := false ;default value, if true new version should be downloaded
, ini_RWin_EndChar := false ;default value, if true RWin key acts as EndChar
;#c/* commercial only beginning
;#c*/ commercial only end
; - - - - - - - - - - - - - - - - - - - - - - - B E G I N N I N G O F I N I T I A L I Z A T I O N - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Critical, On
F_LoadCreateTranslationTxt() ;Initially this function is run without arguments and then it loads default (English) text strings into memory, so they can be used at any moment when necessary. If run with arguments (later in the code flow) it loads definition from localization file defined in Config.ini. Until localization file is loaded, all the messages are displayed in English.
F_CheckFileEncoding(A_ScriptFullPath) ;Checks, as early as possible, if script is utf-8 compliant. it has plenty to do wiith github download etc. If it's not compliant, it tries to change encoding. If it is not successful, it exits.
F_CheckDuplicates() ;Checks if second instance of script or executable isn't running
F_CheckCreateConfigIni() ;Try to load up configuration file. If this file do not exists, create it. If it isn't possible, script exits.
F_Validate_IniParam(ini_Language, ini_HADConfig, "GraphicalUserInterface", "Language")
F_CheckCreateLanguageTxt(ini_Language) ; -> F_LoadCreateTranslationTxt. This is not only about the file creation, but also about loading of content. If everything is fine since this moment all messagges and GUIs are localized.
;#c/* commercial only beginning
;#c*/ commercial only end
; F_CheckIfMoveToProgramFiles() ;Checks if move Hotstrings folder to Program Files folder and then restarts application.
; F_CheckIfRemoveOldDir() ;Checks content of Config.ini in order to remove old script directory.
F_Validate_IniParam(ini_GuiReload, ini_HADConfig, "GraphicalUserInterface", "GuiReload")
F_Validate_IniParam(ini_CheckRepo, ini_HADConfig, "Configuration", "CheckRepo")
F_Validate_IniParam(ini_DownloadRepo, ini_HADConfig, "Configuration", "DownloadRepo")
if (ini_CheckRepo) ;if user selected tick "Check if update is availabe on startup" then information about version is displayed.
F_VerUpdCheckServ("OnStartUp") ;param[1] := {"OnStartUp", "ReturnResult" or by default just show server version}
if (ini_DownloadRepo) ;if user selected tick "Download if update is available on startup" then application is restarted (.ahk or .exe)
and (F_VerUpdCheckServ("ReturnResult")) ;param[1] := {"OnStartUp", "ReturnResult" or by default just show server version}
{
ini_GuiReload := true
F_Validate_IniParam(ini_GuiReload, ini_HADConfig, "GraphicalUserInterface", "GuiReload")
F_VerUpdDownload() ;-> F_ReloadApplication. Downloads, overwrites with new version and restarts script or executable.
}
if (ini_GuiReload) and (FileExist(A_ScriptDir . "\" . "temp.exe")) ;flag ini_GuiReload is set also if Update function is run with Hostrings.exe. So after restart temp.exe is removed.
{
try
FileDelete, % A_ScriptDir . "\" . "temp.exe"
catch e
{
MsgBox, 16, % SubStr(A_ScriptName, 1, -4) . ":" . A_Space . TransA["error"], % "ErrorLevel" . A_Tab . ErrorLevel ;16 = Icon Hand (stop/error)
. "`n`n" . "A_LastError" . A_Tab . A_LastError ;183 : Cannot create a file when that file already exists.
. "`n`n" . "Exception" . A_Tab . e
}
}
F_Validate_IniParam(ini_HADL, ini_HADConfig, "Configuration", "HADL")
F_Validate_IniParam(ini_RWin_EndChar, ini_HADConfig, "Configuration", "RWin_EndChar")
F_CheckCreateLibraryFolder()
F_ValidateIniLibSections() ;fills in ini_LoadLib[] and ini_ShowTipsLib[]
F_CheckCreateLogFolder()
F_LoadSignalingParams() ;tu jestem
; 3. Load content of configuration file into configuration variables. The configuration variable names start with "ini_" prefix.
;Read all variables from specified language .ini file. In order to distinguish GUI text from any other string or variable used in this script, the GUI strings are defined with prefix "t_".
F_LoadGUIPos()
F_LoadGUIstyle()
F_LoadFontSize()
F_LoadSizeOfMargin()
F_LoadFontType()
F_LoadTTStyling()
F_LoadHMStyling()
F_LoadATStyling()
F_LoadHTStyling()
F_LoadUHStyling()
F_LoadConfiguration()
F_LoadEndChars() ; Read from Config.ini values of EndChars. Modifies the set of characters used as ending characters by the hotstring recognizer.
F_InitiateTrayMenus(v_SilentMode)
F_GuiHS3_Create()
F_HS3_DefineConstants()
F_GuiHS3_DetermineConstraints()
F_GuiHS4_Create()
F_GuiHS4_DetermineConstraints()
if (ini_Sandbox)
{
GuiControl, Show, % IdEdit10
GuiControl, Show, % IdEdit10b
}
else
{
GuiControl, Hide, % IdEdit10
GuiControl, Hide, % IdEdit10b
}
F_UpdateSelHotLibDDL()
if (ini_HK_IntoEdit != "none")
{
Hotkey, IfWinExist, % "ahk_id" HS3GuiHwnd
Hotkey, % ini_HK_IntoEdit, F_PasteFromClipboard, On
Hotkey, IfWinExist, % "ahk_id" HS4GuiHwnd
Hotkey, % ini_HK_IntoEdit, F_PasteFromClipboard, On
Hotkey, IfWinExist ;To turn off context sensitivity (that is, to make subsequently-created hotkeys work in all windows)
}
; 4. Load definitions of (triggerstring, hotstring) from Library subfolder.
Gui, 1: Default ;this line is necessary to not show too many Guis on time of loading hotstrings from library
F_LoadHotstringsFromLibraries() ;→ F_LoadDefinitionsFromFile() -> F_CreateHotstring
F_LoadTTperLibrary()
F_Sort_a_Triggers(a_Combined, ini_TipsSortAlphabetically, ini_TipsSortByLength)
F_InitiateInputHook()
TrayTip, % A_ScriptName, % TransA["Hotstrings have been loaded"], , 1 ;1 = Info icon
SetTimer, HideTrayTip, -5000 ;more general approach; for details see https://www.autohotkey.com/docs/commands/TrayTip.htm#Remarks
Loop, Files, % v_ScriptDir . "\Languages\*.txt"
Menu, SubmenuLanguage, Add, %A_LoopFileName%, F_ChangeLanguage
F_ChangeLanguage()
Menu, Tray, UseErrorLevel ;This line is necessary for both Menus to make future use of UseErrorLevel parameter.
Menu, StyleGUIsubm, Add, % TransA["Light (default)"], F_StyleOfGUI
Menu, StyleGUIsubm, Add, % TransA["Dark"], F_StyleOfGUI
F_StyleOfGUI()
Menu, ConfGUI, Add, % TransA["Save position of application window"] . "`tCtrl + S", F_SaveGUIPos
Menu, ConfGUI, Add, % TransA["Change language"], :SubmenuLanguage
Menu, ConfGUI, Add ;To add a menu separator line, omit all three parameters.
Menu, ConfGUI, Add, % TransA["Show Sandbox"] . "`tCtrl + F6", F_ToggleSandbox
if (ini_Sandbox)
Menu, ConfGUI, Check, % TransA["Show Sandbox"] . "`tCtrl + F6"
else
Menu, ConfGUI, UnCheck, % TransA["Show Sandbox"] . "`tCtrl + F6"
Menu, ConfGUI, Add, % TransA["Toggle main GUI"] . "`tF4", F_ToggleRightColumn
if (ini_WhichGui = "HS3")
Menu, ConfGUI, Check, % TransA["Toggle main GUI"] . "`tF4"
else
Menu, ConfGUI, UnCheck, % TransA["Toggle main GUI"] . "`tF4"
Menu, ConfGUI, Add ;To add a menu separator line, omit all three parameters.
Menu, ConfGUI, Add, % TransA["Style of GUI"], :StyleGUIsubm
F_CreateMenu_SizeOfMargin()
Menu, ConfGUI, Add, % TransA["Size of margin:"] . A_Space . "x" . A_Space . TransA["pixels"], :SizeOfMX
Menu, ConfGUI, Add, % TransA["Size of margin:"] . A_Space . "y" . A_Space . TransA["pixels"], :SizeOfMY
Menu, SizeOfFont, Add, 8, F_SizeOfFont
Menu, SizeOfFont, Add, 9, F_SizeOfFont
Menu, SizeOfFont, Add, 10, F_SizeOfFont
Menu, SizeOfFont, Add, 11, F_SizeOfFont
Menu, SizeOfFont, Add, 12, F_SizeOfFont
Menu, SizeOfFont, Check, % c_FontSize
Menu, ConfGUI, Add, % TransA["Size of font"], :SizeOfFont
Menu, FontTypeMenu, Add, Arial, F_FontType
Menu, FontTypeMenu, Add, Calibri, F_FontType
Menu, FontTypeMenu, Add, Consolas, F_FontType
Menu, FontTypeMenu, Add, Courier, F_FontType
Menu, FontTypeMenu, Add, Verdana, F_FontType
Menu, FontTypeMenu, Check, % c_FontType
Menu, ConfGUI, Add, % TransA["Font type"], :FontTypeMenu
Menu, Submenu1Shortcuts, Add, % TransA["Call Graphical User Interface"] . "`t" . F_ParseHotkey(ini_HK_Main, "space"), F_GuiShortDef
Menu, Submenu1Shortcuts, Add, % TransA["Copy clipboard content into ""Enter hotstring"""] . "`t" . F_ParseHotkey(ini_HK_IntoEdit, "space"), F_GuiShortDef
Menu, Submenu1Shortcuts, Add, % TransA["Undo the last hotstring"] . "`t" . F_ParseHotkey(ini_HK_UndoLH, "space"), F_GuiShortDef
Menu, Submenu1Shortcuts, Add, % TransA["Toggle triggerstring tips"] . "`t" . F_ParseHotkey(ini_HK_ToggleTt, "space"), F_GuiShortDef
Menu, Configuration, Add, % TransA["Shortcut (hotkey) definitions"], :Submenu1Shortcuts
;Warning: order of SubmenuEndChars have to be alphabetical. Keep an eye on it. This is because after change of language specific menu items are related with associative array which also keeps to alphabetical order.
Menu, SubmenuEndChars, Add, % TransA["Apostrophe '"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Backslash \"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Closing Curly Bracket }"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Closing Round Bracket )"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Closing Square Bracket ]"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Colon :"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Comma ,"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Dot ."], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Enter"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Exclamation Mark !"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Minus -"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Opening Curly Bracket {"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Opening Round Bracket ("], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Opening Square Bracket ["], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Question Mark ?"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Quote """], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Semicolon `;"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Slash /"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Space"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Tab"], F_ToggleEndChars
Menu, SubmenuEndChars, Add, % TransA["Underscore _"], F_ToggleEndChars
F_ToggleEndChars()
Menu, Configuration, Add, % TransA["Events: signalling"], F_GuiEvents
Func_GuiStylingMenu := func("F_EventsStyling")
Menu, Configuration, Add, % TransA["Events: styling"], % Func_GuiStylingMenu
Func_GuiStylingMenu.Call(true) ;tu jestem
Menu, Configuration, Add, % TransA["Graphical User Interface"], :ConfGUI
Menu, Configuration, Add
Menu, Configuration, Add, % TransA["Toggle trigger characters (↓ or EndChars)"], :SubmenuEndChars
Menu, Configuration, Add
Menu, Configuration, Add, % TransA["Restore default configuration"], F_RestoreDefaultConfig
Menu, Configuration, Add, % TransA["Open Config.ini folder in Windows Explorer"], F_OpenConfigIniLocation
Menu, Configuration, Add, % TransA["Open Config.ini in your default editor"], F_OpenConfigIniInEditor
Menu, Configuration, Add, % TransA["Copy Config.ini folder path to Clipboard"], F_PathtoClipboard
Menu, Configuration, Add ;line separator
;#c/* commercial only beginnin
;#c*/ commercial only end
Menu, Configuration, Add
Menu, Configuration, Add, % TransA["Key to trigger definition"] . "`t" . TransA["Right Windows Key"],F_MenuTriggerRWin
;#f/* free version only beginning
Menu, SubmenuPath, Add, % TransA["User Data: restore it to default location"], F_Empty
Menu, SubmenuPath, Add, % TransA["User Data: move it to new location"], F_Empty
Menu, SubmenuPath, Add
Menu, SubmenuPath, Add, % TransA["Config.ini file: restore it to default location"], F_Empty
Menu, SubmenuPath, Add, % TransA["Config.ini file: move it to script / app location"], F_Empty
Menu, SubmenuPath, Add
Menu, SubmenuPath, Add, % TransA["Application Data: restore it to default location"], F_Empty
Menu, SubmenuPath, Add, % TransA["Application Data: move it to new location"], F_Empty
Menu, Configuration, Add, % TransA["Location of application specific data"], :SubmenuPath
Menu, SubmenuPath, Disable, % TransA["User Data: restore it to default location"]
Menu, SubmenuPath, Disable, % TransA["User Data: move it to new location"]
Menu, SubmenuPath, Add
Menu, SubmenuPath, Disable, % TransA["Config.ini file: restore it to default location"]
Menu, SubmenuPath, Disable, % TransA["Config.ini file: move it to script / app location"]
Menu, SubmenuPath, Add
Menu, SubmenuPath, Disable, % TransA["Application Data: restore it to default location"]
Menu, SubmenuPath, Disable, % TransA["Application Data: move it to new location"]
Menu, Configuration, Disable, % TransA["Location of application specific data"]
;#f*/ free version only end
Menu, HSMenu, Add, % TransA["Configuration"], :Configuration
Menu, HSMenu, Add, % TransA["Search (F3)"], F_Searching
;#c/* commercial only beginning
;#c*/ commercial only end
;#f/* free version only beginning
Menu, LibrariesSubmenu, Add, % TransA["Enable/disable libraries"], F_Empty
Menu, LibrariesSubmenu, Disable, % TransA["Enable/disable libraries"]
;#f*/ free version only end
;#c/* commercial only beginning
;#c*/ commercial only end
;#f/* free version only beginning
Menu, LibrariesSubmenu, Add, % TransA["Enable/disable triggerstring tips"], F_Empty
Menu, LibrariesSubmenu, Disable, % TransA["Enable/disable triggerstring tips"]
;#f*/ free version only end
F_RefreshListOfLibraries() ; this function calls F_RefreshListOfLibraryTips() as both options are interrelated
Menu, LibrariesSubmenu, Add ;To add a menu separator line, omit all three parameters.
Menu, LibrariesSubmenu, Add, % TransA["Visit public libraries webpage"], F_PublicLibraries
Menu, LibrariesSubmenu, Add, % TransA["Open libraries folder in Windows Explorer"], F_OpenLibrariesFolderInExplorer
Menu, LibrariesSubmenu, Add, % TransA["Download public libraries"], F_DownloadPublicLibraries
Menu, LibrariesSubmenu, Add ;To add a menu separator line, omit all three parameters.
Menu, LibrariesSubmenu, Add, % TransA["Import from .ahk to .csv"], F_ImportLibrary
Menu, ExportSubmenu, Add, % TransA["Static hotstrings"], F_ExportLibraryStatic
Menu, ExportSubmenu, Add, % TransA["Dynamic hotstrings"], F_ExportLibraryDynamic
Menu, LibrariesSubmenu, Add, % TransA["Export from .csv to .ahk"], :ExportSubmenu
Menu, LibrariesSubmenu, Add ;line separator
Menu, LibrariesSubmenu, Add, % TransA["Add new library file"], F_GuiAddLibrary
Menu, LibrariesSubmenu, Add, % TransA["Rename selected library filename"], F_RenameLibrary
Menu, LibrariesSubmenu, Add, % TransA["Delete selected library file"], F_DeleteLibrary
Menu, LibrariesSubmenu, Add, % TransA["Copy Libraries folder path to Clipboard"], F_PathtoClipboard
Menu, LibrariesSubmenu, Add ;line separator
Menu, LibrariesSubmenu, Add, % TransA["Edit library header"], F_EditLibHeader
Menu, LibrariesSubmenu, Add, % TransA["Show library header"], F_ShowLibHeader
Menu, HSMenu, Add, % TransA["Libraries"], :LibrariesSubmenu
Menu, HSMenu, Add, % TransA["Clipboard Delay (F7)"], F_GuiHSdelay
Menu, SubmenuReload, Add, % TransA["Reload in default mode"] . "`tShift + Ctrl + R", F_ReloadApplication
;#c/* commercial only beginning
;#c*/ commercial only end
;#f/* free version only beginning
Menu, SubmenuReload, Add, % TransA["Reload in silent mode"], F_Empty
Menu, SubmenuReload, Disable, % TransA["Reload in silent mode"]
;#f*/ free version only end
Menu, AppSubmenu, Add, % TransA["Reload"], :SubmenuReload
Menu, AppSubmenu, Add, % TransA["Suspend Hotstrings and all tips"] . "`tF10", F_SuspendTipsAndHotkeys
Menu, AppSubmenu, Add, % TransA["Suspend all tips"] . "`tF11", F_SuspendAllTips
Menu, AppSubmenu, Add, % TransA["Exit"], F_Exit
Menu, AppSubmenu, Add ;To add a menu separator line, omit all three parameters.
Menu, AppSubmenu, Add, % TransA["Application hotstrings && hotkeys"], F_InternalHot
Menu, AppSubmenu, Add ;To add a menu separator line, omit all three parameters.
Menu, AutoStartSub, Add, % TransA["Default mode"], F_AddToAutostart
Menu, AutoStartSub, Add, % TransA["Silent mode"], F_AddToAutostart
Menu, AppSubmenu, Add, % TransA["Add to Autostart"], :AutoStartSub
; F_CompileSubmenu() ;no longer used
;#c/* commercial only beginning
;#c*/ commercial only end
;#f/* free version only beginning
Menu, AppSubmenu, Add, % TransA["Log triggered hotstrings"], F_Empty
Menu, AppSubmenu, Add, % TransA["Open log folder in Windows Explorer"], F_Empty
Menu, AppSubmenu, Add, % TransA["Open current log (view only)"], F_Empty
Menu, AppSubmenu, Add, % TransA["Copy Log folder path to Clipboard"], F_Empty
Menu, AppSubmenu, Disable, % TransA["Log triggered hotstrings"]
Menu, AppSubmenu, Disable, % TransA["Open log folder in Windows Explorer"]
Menu, AppSubmenu, Disable, % TransA["Open current log (view only)"]
Menu, AppSubmenu, Disable, % TransA["Copy Log folder path to Clipboard"]
;#f*/ free version only end
Menu, AppSubmenu, Add
Menu, AppSubmenu, Add, % TransA["Application statistics"] . "`tShift + Ctrl + S", F_AppStats
Menu, AboutHelpSub, Add, % TransA["Help: Hotstrings application"] . "`tF1", F_GuiAboutLink1
Menu, AboutHelpSub, Add, % TransA["Help: AutoHotkey Hotstrings reference guide"] . "`tCtrl+F1", F_GuiAboutLink2
Menu, AboutHelpSub, Add
;#c/* commercial only beginning
;#c*/ commercial only end
Menu, AboutHelpSub, Add, % TransA["About this application..."], F_GuiAbout
Menu, AboutHelpSub, Add
Menu, AboutHelpSub, Add, % TransA["Show intro"], F_GuiShowIntro
Menu, HSMenu, Add, % TransA["Application"], :AppSubmenu
Menu, HSMenu, Add, % TransA["About / Help"], :AboutHelpSub
Gui, HS3: Menu, HSMenu
Gui, HS4: Menu, HSMenu
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Menu / Context menus - - - - - - - - - - - - - - - - - -
Menu, ListView1_ContextMenu, Add, % TransA["Show library header"], F_ShowLibHeader
Menu, ListView1_ContextMenu, Add, % TransA["Edit library header"], F_EditLibHeader
Menu, ListView1_ContextMenu, Add
Menu, ListView1_ContextMenu, Add, % TransA["Move definition to another library"], F_MoveList
Menu, ListView1_ContextMenu, Add, % TransA["Delete selected definition"] . A_Space . "(F8 / Del)", F_DeleteHotstring
Menu, ListView1_ContextMenu, Add, % TransA["Enable/disable selected definition"], F_LV1_EnDisDefinition
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Menu / Context menus - - - - - - - - - - - - - - - - - -
F_MenuTriggerRWin()
if (ini_RWin_EndChar)
Hotkey, ~RWin, F_ProcessRWin, On
F_MenuLogEnDis() ;Position in Menu about loging
F_GuiAbout_CreateObjects()
F_GuiAbout_DetermineConstraints()
F_GuiVersionUpdate_CreateObjects()
F_GuiVersionUpdate_DetermineConstraints()
if (ini_ShowIntro)
F_GuiShowIntro()
if (ini_OHTtEn) ;Ordinary Hostring Tooltip Enable
F_Tt_HWT() ;prepare Gui → Tooltip (HWT = Hotstring Was Triggered)
if (ini_UHTtEn) ;Undid Hotstring Tooltip Enable
F_Tt_ULH() ;prepare Gui → Tooltip (ULH = Undid the Last Hotstring)
F_LoadGUIstatic()
if (ini_TTCn = 4) ;static triggerstring / hotstring GUI
F_GuiTrigTipsMenuDefC4()
if (ini_GuiReload) and (v_SilentMode != "l")
F_GUIInit()
;block for handling GuiEvents
F_GuiEvents_CreateObjects()
F_GuiEvents_DetermineConstraints()
F_GuiEvents_LoadValues() ;load values to guicontrols
F_EvBH_R1R2()
F_EvBH_R3R4()
F_EvBH_R7R8()
F_EvBH_S1()
F_EvBH_S2()
F_EvBH_S3()
F_EvMH_R3R4()
F_EvMH_S1()
F_EvMH_S2()
F_EvUH_R1R2()
F_EvUH_R3R4()
F_EvUH_R7R8()
F_EvUH_S1()
F_EvUH_S2()
F_EvUH_S3()
F_EvTt_R1R2()
F_EvTt_R3R4()
F_EvTt_S1()
F_EvTt_S2()
F_EvSM_R1R2()
;#c/* commercial only beginning
;#c*/ commercial only end
AppStartTime := A_Now ;Date and time math can be performed with EnvAdd and EnvSub. Also, FormatTime can format the date and/or time according to your locale or preferences.
Critical, Off
; -------------------------- SECTION OF HOTKEYS ---------------------------
#If WinExist("ahk_id" TT_C1Hwnd) ;Triggerstring Tips Composition no. 1: triggestring tips only;
or WinExist("ahk_id" TT_C2Hwnd) ;Triggerstring Tips Composition no. 2: triggestring tips + triggers (2 columns)
or WinExist("ahk_id" TT_C3Hwnd) ;Triggerstring Tips Composition no. 3: triggestring tips + triggers + hotstrings (3 columns)
^Tab:: ;new thread starts here
+^Tab::
^Up::
^Down::
^Enter::
^WheelUp::
^WheelDown::
^MButton::
~Control::
Critical, On
; OutputDebug, % "1)A_ThisHotkey:" . A_ThisHotKey . "`n"
SetTimer, TurnOff_Ttt, Off
F_TTMenu_Keyboard()
return
~Control UP::
F_DestroyTriggerstringTips(ini_TTCn)
Hotstring("Reset")
return
~LButton:: ;if LButton is pressed outside of MenuTT then MenuTT is destroyed; but when mouse click is on/in, it runs hotstring as expected → F_TTMenu_Mouse().
; OutputDebug, % "~LButton" . "`n"
F_TTMenu_Mouse() ;the priority of g F_TTMenuStatic_Mouse is lower than this "interrupt"
return
;#c/* commercial only beginning
;#c*/ commercial only end
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If WinExist("ahk_id" HMenuAHKHwnd) or WinExist("ahk_id" HMenuCLIHwnd) ;this part of code will be run after InputHook processed a character; If HMenu is present on the screen
Esc::
Gui, HMenuAHK: Destroy
Gui, HMenuCLI: Destroy
SendRaw, % v_InputString ;SendRaw in order to correctly produce escape sequences from v_InputString ({}^!+#)
v_InputString := ""
, v_InputH.VisibleText := true
return
Tab:: ;new thread starts here
+Tab::
Up::
Down::
WheelUp::
WheelDown::
MButton::
1::
2::
3::
4::
5::
6::
7::
Critical, On
; OutputDebug, % "A_ThisHotkey:" . A_ThisHotKey . "`n"
SetTimer, TurnOff_Ttt, Off
if (WinExist("ahk_id" HMenuAHKHwnd))
F_HMenu_Keyboard("MSI")
if (WinExist("ahk_id" HMenuCLIHwnd))
F_HMenu_Keyboard("MCL")
return
Enter::
if (WinExist(SubStr(A_ScriptName, 1, -4) . ":" . A_Space . TransA["information"])) ;if msgbox explaining shortcuts for this menu is open, close it upon enter
{
WinClose, % SubStr(A_ScriptName, 1, -4) . ":" . A_Space . TransA["information"]
return
}
else ;if not, handle choice made by user
{
Critical, On
; OutputDebug, % "A_ThisHotkey:" . A_ThisHotKey . "`n"
SetTimer, TurnOff_Ttt, Off
if (WinExist("ahk_id" HMenuAHKHwnd))
F_HMenu_Keyboard("MSI")
if (WinExist("ahk_id" HMenuCLIHwnd))
F_HMenu_Keyboard("MCL")
return
}
~LButton UP:: ;if LButton is UP; the UP modifier is crucial here
Critical, On
if (WinExist("ahk_id" HMenuAHKHwnd))
F_HMenu_Mouse("MSI")
if (WinExist("ahk_id" HMenuCLIHwnd))
F_HMenu_Mouse("MCL")
return
?:: ;to display short-hand information about hotkeys active for HMenu
MsgBox, 64, % SubStr(A_ScriptName, 1, -4) . ":" . A_Space . TransA["information"], % TransA["Shortcuts available for hotstring menu:"] . "`n`n" ;it cannot be modal (always on top) as HMenuAHKHwnd has already feature "always on top"
. "Tab" . A_Tab . A_Tab . A_Tab . TransA["down"] . "`n"
. "Shift + Tab" . A_Tab . A_Tab . TransA["up"] . "`n"
. "↓" . A_Tab . A_Tab . A_Tab . TransA["down"] . "`n"
. "↑" . A_Tab . A_Tab . A_Tab . TransA["up"] . "`n"
. "Enter" . A_Tab . A_Tab . A_Tab . TransA["enter selected hotstring"] . "`n"
. "Left Mouse Button" . A_Tab . A_Tab . TransA["enter selected hotstring"] . "`n"
. "Esc" . A_Tab . A_Tab . A_Tab . TransA["Close and interrupt"]
return
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If WinActive("ahk_id" HS3SearchHwnd)
;if Enter:: or Del:: is pressed while the ListView has focus, see F_HSLV2
^f::
^s::
F3:: ;To disable all hotstrings definitions within search window.
Suspend, Permit ;Any hotkey/hotstring subroutine whose very first line is Suspend, Permit will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON.
HS3SearchGuiEscape()
return ;end of this thread
Down::
Suspend, Permit ;Any hotkey/hotstring subroutine whose very first line is Suspend, Permit will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON.
F_DestroyTriggerstringTips(ini_TTCn)
F_HS3Search_Down()
return
Up::
Suspend, Permit ;Any hotkey/hotstring subroutine whose very first line is Suspend, Permit will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON.
F_DestroyTriggerstringTips(ini_TTCn)
F_HS3Search_Up()
return
Right::
Suspend, Permit ;Any hotkey/hotstring subroutine whose very first line is Suspend, Permit will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON.
F_DestroyTriggerstringTips(ini_TTCn)
F_HS3SearchRight()
return
Left::
Suspend, Permit ;Any hotkey/hotstring subroutine whose very first line is Suspend, Permit will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON.
F_DestroyTriggerstringTips(ini_TTCn)
F_HS3SearchLeft()
return
Tab::
Suspend, Permit ;Any hotkey/hotstring subroutine whose very first line is Suspend, Permit will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON.
return
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If WinActive("ahk_id" HotstringDelay)
F7::
HSDelGuiClose() ;Gui event!
HSDelGuiEscape() ;Gui event!
return
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If WinActive("ahk_id" HS3GuiHwnd) or WinActive("ahk_id" HS4GuiHwnd) ; the following hotkeys will be active only if Hotstrings windows are active at the moment.
F1:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
F_GuiAboutLink1()
return
^F1:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
F_GuiAboutLink2()
return
F2:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
Switch F_WhichGui()
{
Case "HS3":
Gui, HS3: Submit, NoHide
if (!v_SelectHotstringLibrary) or (v_SelectHotstringLibrary = TransA["↓ Click here to select hotstring library ↓"])
{
MsgBox, 64, % SubStr(A_ScriptName, 1, -4) . ":" . A_Space . TransA["information"], % TransA["In order to display library content please at first select hotstring library"] . "."
return
}
GuiControl, HS3: Focus, v_SelectHotstringLibrary
GuiControl, Focus, % IdListView1
if (LV_GetNext(0, "Focused"))
LV_Modify(LV_GetNext(0, "Focused"), "+Select +Focus")
else
LV_Modify(1, "+Select +Focus")
return
Case "HS4": return
}
^s:: ;new thread starts here
F_SaveGUIPos()
return
^f::
F3:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
Suspend, Permit ;Any hotkey/hotstring subroutine whose very first line is Suspend, Permit will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON.
F_Searching() ;To disable all hotstrings definitions within search window.
return
F4:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
F_ToggleRightColumn()
return
F5:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
F_WhichGui()
F_Clear()
return
F6:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
if (!ini_Sandbox) or (A_Gui = "HS4")
return
else
GuiControl, Focus, % IdEdit10
return
F7:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
Gui, % F_WhichGui() . ": +Disabled" ;thanks to this line user won't be able to interact with main hotstring window if TTStyling window is available
F_GuiHSdelay()
return
F9:: ;new thread starts here
F_DestroyTriggerstringTips(ini_TTCn)
F_AddHotstring()
v_InputString := "" ;in order to reset internal recognizer and let triggerstring tips to appear
return
F10:: ;new thread starts here
F_SuspendTipsAndHotkeys() ;suspend hotstrings
return
F11::
F_SuspendAllTips("toggle", true)
return
^+r:: ;new thread starts here
F_ReloadApplication() ;reload into default mode of operation
return
^F6:: ;new thread starts here; only on time of degugging HS3GuiSize will be initiated!
F_DestroyTriggerstringTips(ini_TTCn)
F_ToggleSandbox()
return
+^s::
F_AppStats() ;show application statistics
return
F12::
F_DestroyTriggerstringTips(ini_TTCn)
return
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If WinActive("ahk_id" MoveLibsHwnd)
F8::
F_Move()
return
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If F_IsItEdit()
AppsKey:: ;blocks default context menu for Edit fields
#If
;section of build-in hotstrings (system wide!)
:*:hshelp/:: ;run web browser and enter Hotstrings application help on Github.
F_GuiAboutLink2()
return
:*:hsquit/::
:*:hsstop/::
:*:hsexit/:: ;exit Hotststrings application
F_Exit()
return
:*:hstoggle/:: ;toggle triggerstring tips
:*:hstrig/:: ;toggle triggerstring tips
ini_TTTtEn := !ini_TTTtEn
MsgBox, 64, % SubStr(A_ScriptName, 1, -4) . ":" . A_Space . TransA["information"], % TransA["Triggerstring tips are now"] . A_Space . (ini_TTTtEn ? TransA["ENABLED"] : TransA["DISABLED"]) . "."
if (ini_TTTtEn)
{
v_InputString := ""
Hotstring("Reset")
}
return
:*:hsenable/::
F_SuspendTipsAndHotkeys("enable")
return
:*:hsdisable/::
F_SuspendTipsAndHotkeys("disable")
return
:*:hssuspend/:: ;toggle suspend hotstrings and triggerstrings
F_SuspendTipsAndHotkeys()
return
:*:hsrestart/:: ;reload into default mode of operation
:*:hsreload/:: ;reload into default mode of operation
F_ReloadApplication()
return
:*:hsstats/:: ;show application statistics
F_AppStats()
return
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
~*LShift::
~*RShift:: ;Actually "Shifts" work a bit different as some keys like @ or ? are available only after pressing Shift.
ToolTip, ;this line is necessary to close tooltips.
Gui, Tt_HWT: Hide ;Tooltip _ Hotstring Was Triggered
Gui, Tt_ULH: Hide ;Tooltip _ Undid the Last Hotstring
F_DestroyTriggerstringTips(ini_TTCn)
return
~*F1:: ;pressed any function key destroy triggerstring tips
~*F2::
~*F3::
~*F4::
~*F5::
~*F6::
~*F7::
~*F8::
~*F9::
~*F10::
~*F11::
~*F12::
~*F13::
~*F14::
~*F15::
~*F16::
~*F17::
~*F18::
~*F19::
~*F20::
~*F21::
~*F22::
~*F23::
~*F24::
~*LAlt:: ;if commented out, only for debugging reasons
~RAlt:: ;no * allowed as it is part of AltGr (LControl & RAlt) and AltGr is used for diacritic letters in many keyboard layouts
~*WheelDown::
~*WheelUp::
~*MButton::
~*RButton::
~*LWin::
~*Down::
~*Up::
~*Left::
~*Right::
~*Home::
~*End::
~*PgUp::
~*PgDn::
~*WheelLeft::
~*WheelRight::
~*LButton::
; OutputDebug, % "LButton down:" . "`n"
ToolTip, ;this line is necessary to close tooltips.
Gui, Tt_HWT: Hide ;Tooltip _ Hotstring Was Triggered
Gui, Tt_ULH: Hide ;Tooltip _ Undid the Last Hotstring
F_DestroyTriggerstringTips(ini_TTCn)
if (!WinExist("ahk_id" HMenuCLIHwnd)) and (!WinExist("ahk_id" HMenuAHKHwnd))
v_InputString := ""
; OutputDebug, % "v_InputString after:" . v_InputString . "|" . "`n"
return
~*Insert:: ;in particular Shift + Insert, Shift + Del
~*Del::
Hotstring("Reset")
ToolTip, ;this line is necessary to close tooltips.
Gui, Tt_HWT: Hide ;Tooltip _ Hotstring Was Triggered
Gui, Tt_ULH: Hide ;Tooltip _ Undid the Last Hotstring
F_DestroyTriggerstringTips(ini_TTCn)
if (!WinExist("ahk_id" HMenuCLIHwnd)) and (!WinExist("ahk_id" HMenuAHKHwnd))
v_InputString := ""
return
~*Control:: ;whenever any combination with control (e.g. ctrl + v) is applied on time when triggestring is entered AND active triggerstrings are disabled, hotstring recognizer is reset.
; OutputDebug, % "Ordinary control" . "`n"
ToolTip, ;this line is necessary to close tooltips.
Gui, Tt_HWT: Hide ;Tooltip _ Hotstring Was Triggered
Gui, Tt_ULH: Hide ;Tooltip _ Undid the Last Hotstring
; if (ini_TTCn = 4) ;absolutely crucial line for static window; v_InputString cannot be cleared, triggerstring tips cannot be destroyed
; return
F_DestroyTriggerstringTips(ini_TTCn)
if (!WinExist("ahk_id" HMenuCLIHwnd)) and (!WinExist("ahk_id" HMenuAHKHwnd))
{
; OutputDebug, % "Hotstring(""reset"")" . "`n"
Hotstring("Reset")
v_InputString := ""
}
return
~*Esc:: ;the only difference in comparison to previous section is that Esc also resets hotstring recognizer.
; OutputDebug, % "~Esc:" . "`n"
ToolTip, ;this line is necessary to close tooltips.
Gui, Tt_HWT: Hide ;Tooltip _ Hotstring Was Triggered
Gui, Tt_ULH: Hide ;Tooltip _ Undid the Last Hotstring
F_DestroyTriggerstringTips(ini_TTCn)
if (!WinExist("ahk_id" HMenuCLIHwnd)) and (!WinExist("ahk_id" HMenuAHKHwnd))
v_InputString := ""
Hotstring("Reset")
return
~*LButton UP:: ;if user switches between windows by mouse clicking and e.g. "Search Hotstring" window was active
; OutputDebug, % "LButton UP:" . "`n"
Suspend, Permit ;Suspend, On is set for "Search Hotstrings" window
if (WinActive("ahk_id" HS3SearchHwnd))
{
; OutputDebug, % "A_ThisHotkey:" . A_ThisHotkey . A_Space . "!WinActive(""ahk_id"" HS3GuiHwnd):" . !WinActive("ahk_id" HS3SearchHwnd) . A_Space . "!WinExist(""ahk_id"" HS3SearchHwnd):" . !WinExist("ahk_id" HS3SearchHwnd) . "`n"
Suspend, On
; OutputDebug, % "S On" . "`n"
}
else
{
Suspend, Off
; OutputDebug, % "S Off" . "`n"
}
return
~*Enter UP:: ;if user switches between windows by keyboard (Alt+Tab or Win+Alt) clicking and e.g. "Search Hotstring" window was active
~*Alt UP:: ;for hotkeys applicable to switch between operating system windows it is important to add "up" modifier. When windows are switched, switch off suspend for hotkeys and hotstrings.
Suspend, Permit ;Suspend, On is set for "Search Hotstrings" window
; OutputDebug, % "A_ThisHotkey:" . A_ThisHotkey . "`n"
Sleep, 100 ;100 ms = default value of SetWinDelay; for some reasons SetWinDelay isn't set for WinActive command. A window sometimes needs a period of "rest" after being activated (description copied from SetWinDelay).
if (WinActive("ahk_id" HS3SearchHwnd))
{
Suspend, On
; OutputDebug, % "S On" . "`n"
}
else
{
Suspend, Off
; OutputDebug, % "S Off" . "`n"
}
return
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If WinActive("ahk_id" TT_C4Hwnd) ;Static triggerstring tips (inside separate window). User case scenario: if user decided to switch into static window (makes it active)
Tab::
+Tab::
1::
2::
3::
4::
5::
6::
7::
Enter::
Up::
Down::
OutputDebug, % "WinActive(ahk_id TT_C4Hwnd)" . "`n"
F_StaticMenu_Keyboard(CheckPreviousWindowID := true)
return
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If WinExist("ahk_id" TT_C4Hwnd) ;Static triggerstring tips (inside separate window)
~Tab:: ;There must be "~" as this code will be run even if IdTT_C4_LB4 is empty
~+Tab::
~1::
~2::
~3::
~4::
~5::
~6::
~7::
~Enter::
~^Enter:: ;valid only for Triggerstring Menu
~Up::
~^Up:: ;valid only for Triggerstring Menu
~Down::
~^Down:: ;valid only for Triggerstring Menu
; OutputDebug, % "WinExist(ahk_id TT_C4Hwnd)" . "`n"
F_StaticMenu_Keyboard()
return
~*Control UP::
F_DestroyTriggerstringTips(ini_TTCn)
return
~Esc:: ;tilde in order to run function TT_C4GuiEscape
GuiControl,, % IdTT_C4_LB4, % c_TextDelimiter
OutputDebug, % "v_InputString:" . A_Tab . v_InputString . A_Tab . "v_EndChar:" . A_Tab . v_EndChar
v_InputString := ""
return
#If
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#If ActiveControlIsOfClass("Edit") ;https://www.autohotkey.com/docs/commands/_If.htm
^BS::
Send, ^+{Left}{Del}
F_DestroyTriggerstringTips(ini_TTCn)
return
^Del::
Send, ^+{Right}{Del}
F_DestroyTriggerstringTips(ini_TTCn)
return
#If