-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVariousFunctions.ahk
2986 lines (2633 loc) · 82.1 KB
/
VariousFunctions.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
#Requires AutoHotkey v1.1.33+ ; 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.
#Persistent
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#KeyHistory, 500 ; Long key history on purpose, for debugging other scripts.
; - - - - - - - - - - - - - - CONVERSION TO EXE: BEGINNING- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
global AppVersion := "1.2.0" ;wersja głowna.uzupełnienie o funkcje.łatanie bagów
global AppIcon := "vh.ico" ; Imagemagick: convert hotstrings.svg -alpha off -resize 96x96 -define icon:auto-resize="96,64,48,32,16" hotstrings.ico
;@Ahk2Exe-Let vAppIcon=%A_PriorLine~U)^(.+"){1}(.+)".*$~$2% ; Keep these lines together
;@Ahk2Exe-Let vAppVersion=%A_PriorLine~U)^(.+"){1}(.+)".*$~$2% ; Keep these lines together
;Overrides the custom EXE icon used for compilation
;@Ahk2Exe-SetMainIcon %U_vAppIcon%
;@Ahk2Exe-SetCopyright GNU GPL 3.x
;@Ahk2Exe-SetDescription Advanced tool for various functions management.
;@Ahk2Exe-SetProductName Original script name: %A_ScriptName%
;@Ahk2Exe-Set OriginalScriptlocation, https://github.com/mslonik/VariousFunctions
;@Ahk2Exe-SetCompanyName http://mslonik.pl
;@Ahk2Exe-SetFileVersion %U_vAppVersion%
FileInstall, vh.ico, %A_SCriptDir%\%AppIcon%, 0
FileInstall, Lib\UIA_Interface.ahk, %A_ScriptDir%\Lib\UIA_Interface.ahk, 0 ; From unknown reason it works without Lib folder.
FileInstall, LICENSE, LICENSE, 0
; - - - - - - - - - - - - - - CONVERSION TO EXE: END- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Menu, Tray,Icon, %A_SCriptDir%\%AppIcon%
#include %A_ScriptDir%\Lib\UIA_Interface.ahk
;------------------ SECTION OF GLOBAL VARIABLES: BEGINNING ----------------------------
global English_USA := 0x0409 ; see AutoHotkey help: Language Codes https://www.autohotkey.com/docs/misc/Languages.htm
, PolishLanguage := 0x0415 ; https://www.autohotkey.com/docs/misc/Languages.htm
, TransFactor := 255
, WordTrue := -1 ; ComObj(0xB, -1) ; 0xB = VT_Bool || -1 = true
, WordFalse := 0 ; ComObj(0xB, 0) ; 0xB = VT_Bool || 0 = false
, OurTemplateEN := "S:\OrgFirma\Szablony\Word\OgolneZmakrami\TQ-S440-en_UserDoc.dotm"
, OurTemplatePL := "S:\OrgFirma\Szablony\Word\OgolneZmakrami\TQ-S440-pl_DokUzyt.dotm"
, OurTemplateOldPL := "S:\OrgFirma\Szablony\Word\OgolneZmakrami\TQ-S402-pl_OgolnyTechDok.dotm"
, OurTemplateOldEN := "S:\OrgFirma\Szablony\Word\OgolneZmakrami\TQ-S402-en_OgolnyTechDok.dotm"
, OurTemplate := ""
;---------------- Variables for the autosave function ----------------
, size := 0
, size_org := 0
, table := []
, AutosaveFilePath := "C:\temp1\KopiaZapasowaPlikowWord\"
, interval := 10*60*1000 ;10 min.
;--------------- Variables to switch windows ---------------
, id := []
, order := []
;---------------------------------------------------------------
, MyTemplate := ""
, template := ""
, ToRemember := "", OldClipBoard := ""
;------------------- SECTION OF GLOBAL VARIABLES: END----------------------------
Hotkey, +#v, ChooseFunctions ;Hotkey to open a various functions gui
;//////////////////////////////////////////////////////////////// - PREPARATION OF GUI ELEMENTS AN INI - //////////////////////////////////////////////////////////////////////////////////////////////////////////
F_PrepareChooseBrowserGui()
F_PrepareOpenTabsGui()
F_IniRead()
F_PrepareGuiElements()
;//////////////////////////////////////////////////////////////// - ACTIVATION OF SELECTED FUNCTIONS - //////////////////////////////////////////////////////////////////////////////////////////////////////////
F_CB1_AlwaysOnTop() ;Always on top
F_CB2_AutomatePaint() ;Automate Paint
F_CB3_ChromeTabSwitcher() ;Browser tab switcher
F_CB4_OpenTabs() ;Open tabs in Chrome
F_CB5_ParenthesisWatcher() ;Parenthesis watcher
F_CB6_USKeyboard() ;US Keyboard
F_CB7_RightClick() ;Right click context menu
F_CB8_VolumeUpDown() ;Volume up and down
F_CB9_WindowSwitcher() ;Window switcher
F_CB10_CAPSLOCK() ;Capitalization switcher CAPS LOCK
F_CB11_SHIFTF3() ;Capitalization switcher SHIFT +F3
F_CB12_FootswitchF13() ;FOOTSWITCH F13
F_CB13_FootswitchF14() ;FOOTSWITCH F14
F_CB14_FootswitchF15() ;FOOTSWITCH F15
F_CB15_TranslateEN_PL() ;Google translate en - pl
F_CB16_TranslatePL_EN() ;Google translate pl - en
F_CB17_Suspend() ;Power PC suspend
F_CB18_Reboot() ;Power PC reboot
F_CB19_Shutdown() ;Powe PC shutdown
F_CB20_TransparencyMouse() ;Transparency switcher - mouse
F_CB21_TransparencyKeys() ;Transparency switcher - keys
F_CB22_AlignLeft() ;Align left
F_CB23_ApplyStyles() ;Apply styles
F_CB24_Autosave() ;Autosave
F_CB25_DeleteLine() ;Delete line
F_CB26_Hide() ;Hide
F_CB27_Show() ;Show
F_CB28_HyperLink() ;Hyperlink
F_CB29_OpenAndShowPath() ;Open and show path
F_CB30_StrikethroughText() ;Strikethrough text
F_CB31_Table() ;Table
F_CB32_AddTemplate() ;Add template
F_CB33_TemplateOff() ;Template off
F_CB34_KeePass() ;Run KeePass
F_CB35_MSWord() ;Run MS Word
F_CB36_Paint() ;Run Paint
F_CB37_TotalCommander() ;Run Total Commander
F_CB38_PrintScreen() ;Run print screen
F_CB39_LineUp() ;Line Up and down
if (AutosaveIni)
F_AutoSave()
;//////////////////////////////////////////////////////////////// - MENU TRAY - //////////////////////////////////////////////////////////////////////////////////////////////////////////
Menu, Tray, NoStandard
Menu, Tray, Add, ChooseFunctions
Menu, Tray, Add
Menu, Tray, Standard
Menu, Tray, Default, ChooseFunctions ;Menu, MenuName, Default [, MenuItemName]
return ;End of initialization
;////////////////////////////////////////////////////////////////////////// - GUI - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ChooseFunctions()
{
Gui, Main: Submit, Hide
Gui, Main: Show, w833 h512, Various functions
}
MainGuiEscape()
{
Gui, Main: submit, Hide
Gui, Main: Hide
}
;////////////////////////////////////////////////////////////////// - ABOUT - ///////////////////////////////////////////
F_About1()
{
Gui, submit, NoHide
MsgBox,
(
Authors:`nMaciej Słojewski, Hanna Ziętak, Jakub Masiak, Kasandra Krajewska`n`nInterface Author:`nKasandra Krajewska`n`nVersion:
) %AppVersion%
Return
}
;//////////////////////////////////////////////////////////////////// - ALWAYS ON TOP (1) - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button1_AlwaysOnTop()
{
Gui, submit, NoHide
Msgbox,
(
Toggle window parameter always on top, by pressing {Ctrl} + {Windows} + {F8}.
)
Return
}
F_CB1_AlwaysOnTop()
{
global ;assume-global mode of operation
Gui, Main: Submit, NoHide
Switch Check1 ;0, 1, -1
{
Case 0:
Hotkey, ^#F8, F_always, off
IniWrite, NO, VariousFunctions.ini, Menu memory, Always on top
Case 1:
Hotkey, ^#F8, F_always, on
IniWrite, YES, VariousFunctions.ini, Menu memory, Always on top
}
}
F_always()
{
static OnOffToggle := false
WinSet, AlwaysOnTop, toggle, A
OnOffToggle := !OnOffToggle
WinGetTitle, OutputVar, A
MsgBox, 4096, % A_ScriptName . ":" . A_Space . "information", % "Changed AlwaysOnTop feature for the following window:" . "`n" . OutputVar . A_Space . "to:" . A_Space . (OnOffToggle ? "true" : "false")
Return
}
;/////////////////////////////////////////////////////////////////// - AUTOMATE PAINT (2)- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button2_AutomatePaint()
{
Gui, Submit, NoHide
Msgbox,
(
Rotate image by pressing F2,
resize image by pressing F3,
choose red rectangle by pressing F4,
"save as" by pressing F5,
cut selected shape, by pressing F6.
)
}
F_CB2_AutomatePaint()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check2 ;0, 1, -1
{
Case 0:
Hotkey, IfWinActive, AHK_class MSPaintApp
Hotkey, F2, F_rotate, off
Hotkey, F3, F_resize, off
Hotkey, F4, F_choose, off
Hotkey, F5, F_saveas, off
Hotkey, F6, F_cut, off
Hotkey, +/, F_GUI, off
Hotkey, IfWinActive
IniWrite, NO, VariousFunctions.ini, Menu memory, AutomatePaint
Case 1:
Hotkey, IfWinActive, AHK_class MSPaintApp
Hotkey, F2, F_rotate, on
Hotkey, F3, F_resize, on
Hotkey, F4, F_choose, on
Hotkey, F5, F_saveas, on
Hotkey, F6, F_cut, on
Hotkey, +/, F_GUI, on
Hotkey, IfWinActive
IniWrite, YES, VariousFunctions.ini, Menu memory, AutomatePaint
}
}
F_rotate()
{
UIA := UIA_Interface() ; Initialize UIA interface
WinWaitActive, ahk_exe mspaint.exe
paint1 := UIA.ElementFromHandle(WinExist("ahk_exe mspaint.exe"))
paint1.FindFirstByNameAndType("Obróć", "SplitButton").Click()
paint1.WaitElementExistByName("Obrót w prawo o 90°").Click()
UIA := ""
, paint1 := ""
}
F_resize()
{
UIA := UIA_Interface() ; Initialize UIA interface
WinWaitActive, ahk_exe mspaint.exe
paint1 := UIA.ElementFromHandle(WinExist("ahk_exe mspaint.exe"))
paint1.FindFirstByNameAndType("Zmień rozmiar", "Button").Click()
paint1.WaitElementExistByNameandType("Piksele","RadioButton").Click()
paint1.FindFirstByNameandType("Zmień rozmiar w poziomie","Edit").SetValue("800")
paint1.FindFirstByNameandType("OK","Button").Click()
UIA := ""
, paint1 := ""
}
F_choose()
{
UIA := UIA_Interface() ; Initialize UIA interface
WinWaitActive, ahk_exe mspaint.exe
paint1 := UIA.ElementFromHandle(WinExist("ahk_exe mspaint.exe"))
paint1.FindFirstByNameAndType("Kształty", "Button").Click() ;in polish language version
paint1.WaitElementExistByName("Zaokrąglony prostokąt").Click()
Sleep,50
paint1.FindFirstByNameAndType("Edytuj kolory", "Button").Click()
paint1.FindFirstByNameandType("Odc.:","Edit").SetValue(0)
paint1.FindFirstByNameandType("Nas.:","Edit").SetValue(240)
paint1.FindFirstByNameandType("Jaskr.:","Edit").SetValue(120)
paint1.FindFirstByNameandType("Czerw.:","Edit").SetValue(255)
paint1.FindFirstByNameandType("OK","Button").Click()
UIA := ""
, paint1 := ""
}
F_saveas()
{
UIA := UIA_Interface() ; Initialize UIA interface
WinWaitActive, ahk_exe mspaint.exe
paint1 := UIA.ElementFromHandle(WinExist("ahk_exe mspaint.exe"))
paint1.FindFirstByNameAndType("Karta Plik", "Button").Click()
paint1.WaitElementExistByNameandType("Zapisz jako", "SplitButton").Click()
UIA := ""
, paint1 := ""
}
F_cut()
{
UIA := UIA_Interface() ; Initialize UIA interface
WinWaitActive, ahk_exe mspaint.exe
paint1 := UIA.ElementFromHandle(WinExist("ahk_exe mspaint.exe"))
paint1.WaitElementExistByNameandType("Przytnij", "Button").Click()
UIA := ""
, paint1 := ""
}
F_GUI()
{
Gui, PaintHelp: New
Gui, PaintHelp: Font, s11, Arial
Gui, PaintHelp: Add, Text, , F2: Right image rotation
Gui, PaintHelp: Add, Text, , F3: Change image size to 800 px
Gui, PaintHelp: Add, Text, , F4: Choose red rectangle
Gui, PaintHelp: Add, Text, , F5: Save as
Gui, PaintHelp: Add, Text, , F6: Cut selected shape
Gui, PaintHelp: Show, w350, Shortcuts hints for MS Paint
}
PaintHelpGuiEscape()
{
Gui, submit, Hide
Gui, Hide
}
;/////////////////////////////////////////////////////////////////// - CHROME TAB SWITCHER (3)- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button3_ChromeTabSwitcher()
{
Gui, Submit, NoHide
Msgbox,
(
ReturnSwitch tabs in Browser, by pressing {Xbutton1} and {Xbutton2}.
)
Return
}
F_CB3_ChromeTabSwitcher()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check3 ;0, 1, -1
{
Case 0:
Hotkey, Xbutton1, F_mybutton1, off
Hotkey, Xbutton2, F_mybutton2, off
IniWrite, NO, VariousFunctions.ini, Menu memory, Browser Win Switcher
Case 1:
Hotkey, Xbutton1, F_mybutton1, on
Hotkey, Xbutton2, F_mybutton2, on
IniWrite, YES, VariousFunctions.ini, Menu memory, Browser Win Switcher
}
}
F_mybutton1()
{
if !WinExist("ahk_class Chrome_WidgetWin_1")
{
Run, chrome.exe
}
if WinActive("ahk_class Chrome_WidgetWin_1") or WinActive("ahk_class TTOTAL_CMD")
{
Send, ^+{Tab}
}
else
{
WinActivate ahk_class Chrome_WidgetWin_1
}
return
}
F_mybutton2()
{
if !WinExist("ahk_class Chrome_WidgetWin_1")
{
Run, chrome.exe
}
if WinActive("ahk_class Chrome_WidgetWin_1") or WinActive("ahk_class TTOTAL_CMD")
{
Send, ^{Tab}
}
else
{
WinActivate ahk_class Chrome_WidgetWin_1
}
return
}
;/////////////////////////////////////////////////////////////////// - OPEN TABS IN BROWSER (4) - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button4_OpenTabs()
{
global
Gui, ChooseBrowser: Submit, Hide
Gui, ChooseBrowser: Show,, Choose Browser
}
F_SaveBrowser()
{
global
Gui, ChooseBrowser: submit, Hide
IniWrite, %F_Chrome%, VariousFunctions.ini, ChooseBrowser, Chrome
IniWrite, %F_Edge%, VariousFunctions.ini, ChooseBrowser, Edge
Browser1 := F_Chrome
Browser2 := F_Edge
; IniWrite, %F_Firefox%, VariousFunctions.ini, ChooseBrowser, Firefox
Gui, OpenTabs: Show, w318 h395, Open tabs in Browser
}
F_SAVE()
{
global
Gui, OpenTabs: Submit, Hide
IniWrite, % Tab1, VariousFunctions.ini, OpenTabs, Tab1
IniWrite, % Tab2, VariousFunctions.ini, OpenTabs, Tab2
IniWrite, % Tab3, VariousFunctions.ini, OpenTabs, Tab3
IniWrite, % Tab4, VariousFunctions.ini, OpenTabs, Tab4
IniWrite, % Tab5, VariousFunctions.ini, OpenTabs, Tab5
IniWrite, % Tab6, VariousFunctions.ini, OpenTabs, Tab6
IniWrite, % Tab7, VariousFunctions.ini, OpenTabs, Tab7
IniWrite, % Tab8, VariousFunctions.ini, OpenTabs, Tab8
IniWrite, % Tab9, VariousFunctions.ini, OpenTabs, Tab9
IniWrite, % Tab10, VariousFunctions.ini, OpenTabs, Tab10
Temp1 := Tab1 . A_space . Tab2 . A_space . Tab3 . A_space . Tab4 . A_space . Tab5 . A_space . Tab6 . A_space . Tab7 . A_space . Tab8 . A_space . Tab9 . A_space . Tab10
}
F_CB4_OpenTabs()
{
global ;assume-global mode of operation
Gui, Main: Submit, NoHide
Switch Check4 ;0, 1, -1
{
Case 0:
IniWrite, NO, VariousFunctions.ini, Menu memory, Browser
Case 1:
IniWrite, YES, VariousFunctions.ini, Menu memory, Browser
if (Browser1 == 1)
{
Try
{
Run, % "chrome.exe" . A_space . Temp1
}
Catch
{
MsgBox, 16, % A_ScriptName, Chrome.exe wasn't found., 5
return
}
WinWait, ahk_class Chrome_WidgetWin_1 ahk_exe chrome.exe
WinMaximize,
}
else if (Browser2 == 1)
{
Try
{
Run, % "msedge.exe" . A_space . Temp1
}
Catch
{
MsgBox, 16, % A_ScriptName, msedge.exe wasn't found., 5
return
}
WinWait, ahk_class Chrome_WidgetWin_1 ahk_exe msedge.exe
WinMaximize,
; IniWrite, YES, VariousFunctions.ini, Menu memory, Browser
}
}
}
;/////////////////////////////////////////////////////////////////// - PARENTHESIS WATCHER (5)- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button5_ParenthesisWatcher()
{
Gui, Submit, NoHide
Msgbox,
(
After pressing keys like: { [ ( `" , the closing symbols } ] ) `" will also appear. Aditionally a caret will jump between the parenthesis/quotation marks. It works also, when you have already written a text and want to put it between parenthesis/quotation marks. You have to select words and press parenthesis/quotation marks.
)
Return
}
F_CB5_ParenthesisWatcher()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check5 ;0, 1, -1
{
Case 0:
Hotkey, ~{ , F_Parenthesis, Off
Hotkey, ~" , F_Parenthesis, Off
Hotkey, ~( , F_Parenthesis, Off
Hotkey, ~[ , F_Parenthesis, Off
Hotkey, ~+Right Up, F_Parenthesis, Off ;events related to keyboard; order matters!
Hotkey, ~+Left Up, F_Parenthesis, Off
Hotkey, ~^+Left Up, F_Parenthesis, Off
Hotkey, ~^+Right Up, F_Parenthesis, Off
IniWrite, NO, VariousFunctions.ini, Menu memory, Parenthesis
Case 1:
Hotkey, ~{ , F_Parenthesis, On
Hotkey, ~" , F_Parenthesis, On
Hotkey, ~( , F_Parenthesis, On
Hotkey, ~[ , F_Parenthesis, On
Hotkey, ~+Right Up, F_Parenthesis, On ;events related to keyboard; order matters!
Hotkey, ~+Left Up, F_Parenthesis, On
Hotkey, ~^+Left Up, F_Parenthesis, On
Hotkey, ~^+Right Up, F_Parenthesis, On
IniWrite, YES, VariousFunctions.ini, Menu memory, Parenthesis
}
}
F_Parenthesis()
{
global
local ThisHotkey := A_ThisHotkey, f_Parenthesis := false
, LastPressedKey := A_PriorKey
, PreviousHotkey := A_PriorHotkey
, f_Cliboard := false
, OldClipboard := ""
static ToRemember := "", PreviousClipboard := ""
if (InStr(ThisHotkey, "{"))
f_Parenthesis := true
if (InStr(ThisHotkey, """"))
f_Parenthesis := true
if (InStr(ThisHotkey, "("))
f_Parenthesis := true
if (InStr(ThisHotkey, "["))
f_Parenthesis := true
if (InStr(ThisHotkey, "+Right Up"))
f_Cliboard := true
if (InStr(ThisHotkey, "+Left Up"))
f_Cliboard := true
if (InStr(ThisHotkey, "^+Right Up"))
f_Cliboard := true
if (InStr(ThisHotkey, "^+Left Up"))
f_Cliboard := true
{
Send, ^c
ClipWait, 0 ;wait until clipboard is full with anything
PreviousClipboard := Clipboard
OutputDebug, % "PreviousClipboard:" . A_Tab . PreviousClipboard . "`n"
}
if (PreviousHotkey = "~LButton Up") and (InStr(LastPressedKey, Shift))
{
ToRemember := PreviousClipboard
PreviousClipboard := ""
f_Parenthesis := true
}
if (f_Parenthesis)
{
ThisHotkey := SubStr(ThisHotkey, 0) ;extract last character
Switch ThisHotkey
{
Case "(":
if (ToRemember)
{
Send, % ToRemember . ")"
ToRemember := ""
F_tooltip()
}
else
Send, % ")" . "{Left}"
F_tooltip()
Case "[":
if (ToRemember)
{
Send, % ToRemember . "]"
ToRemember := ""
F_tooltip()
}
else
Send, % "]" . "{Left}"
F_tooltip()
Case "{":
if (ToRemember)
{
Send, % ToRemember . "{}}"
ToRemember := ""
F_tooltip()
}
else
{
Send, % "{}}" . "{Left}"
F_tooltip()
}
Case """":
if (ToRemember)
{
Send, % ToRemember . """"
ToRemember := ""
F_tooltip()
}
else
{
Send, % """" . "{Left}"
F_tooltip()
}
}
}
f_Parenthesis := false
if (f_Cliboard)
{
OldClipBoard := ClipboardAll
Clipboard := ""
Send, ^c
ClipWait, 0 ;wait until clipboard is full with anything
ToRemember := Clipboard
Clipboard := OldClipBoard
OldClipBoard := ""
}
}
F_tooltip()
{
ToolTip, Parenthesis watcher (VariousFunctions.ahk), A_CaretX, A_CaretY - 20
SetTimer, TurnOffTooltip, -1000
}
;/////////////////////////////////////////////////////////////////// - US KEYBORD (6) - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button6_USKeyboard()
{
Gui, Submit, NoHide
Msgbox,
(
Change keyboard settings (from Polish keyboard to English keyboard)
)
Return
}
F_CB6_USKeyboard()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check6 ;0, 1, -1
{
Case 0:
SetDefaultKeyboard(PolishLanguage)
TrayTip, VariousFunctions.ahk, Keyboard style: PolishLanguage, 5, 0x1
IniWrite, NO, VariousFunctions.ini, Menu memory, Set English Keyboard
Case 1:
SetDefaultKeyboard(English_USA)
TrayTip, VariousFunctions.ahk, Keyboard style: English_USA, 5, 0x1
IniWrite, YES, VariousFunctions.ini, Menu memory, Set English Keyboard
}
}
SetDefaultKeyboard(LocaleID)
{
static SPI_SETDEFAULTINPUTLANG := 0x005A, SPIF_SENDWININICHANGE := 2
WM_INPUTLANGCHANGEREQUEST := 0x50
Language := DllCall("LoadKeyboardLayout", "Str", Format("{:08x}", LocaleID), "Int", 0)
VarSetCapacity(binaryLocaleID, 4, 0)
NumPut(LocaleID, binaryLocaleID)
DllCall("SystemParametersInfo", UINT, SPI_SETDEFAULTINPUTLANG, UINT, 0, UPTR, &binaryLocaleID, UINT, SPIF_SENDWININICHANGE)
WinGet, windows, List
Loop % windows
{
PostMessage WM_INPUTLANGCHANGEREQUEST, 0, % Language, , % "ahk_id " windows%A_Index%
}
}
;/////////////////////////////////////////////////////////////////// - RIGHT-CLICK CONTEXT MENU (7) - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button7_RightClick()
{
Gui, Submit, NoHide
Msgbox,
(
Redirects AltGr -> context menu`n
(only in English keyboard layout)
)
Return
}
F_CB7_RightClick()
{
global
Gui, Submit, NoHide
Switch Check7 ;0, 1, -1
{
Case 0:
Hotkey, RAlt, F_JustAlt, Off
IniWrite, NO, VariousFunctions.ini, Menu memory, AltGr
Case 1:
Hotkey, RAlt, F_JustAlt, On
IniWrite, YES, VariousFunctions.ini, Menu memory, AltGr
}
}
F_JustAlt()
{
Send, {AppsKey}
}
;/////////////////////////////////////////////////////////////////// - VOLUME UP AND DOWN (8) - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button8_VolumeUpDown()
{
Gui, Submit, NoHide
Msgbox,
(
ReturnTurn the volume up and down, by moving a mouse wheel. Works only when a caret is over the system tray.
)
Return
}
#If MouseIsOver("ahk_class Shell_TrayWnd")
#If
F_CB8_VolumeUpDown()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check8 ;0, 1, -1
{
Case 0:
Hotkey, If, MouseIsOver("ahk_class Shell_TrayWnd")
Hotkey, WheelUp, F_mywheelup, off
Hotkey, WheelDown, F_mywheeldown, off
IniWrite, NO, VariousFunctions.ini, Menu memory, Volume Up & Down
Hotkey, If
Case 1:
Hotkey, If, MouseIsOver("ahk_class Shell_TrayWnd")
Hotkey, WheelUp, F_mywheelup, on
Hotkey, WheelDown, F_mywheeldown, on
IniWrite, YES, VariousFunctions.ini, Menu memory, Volume Up & Down
Hotkey, If
}
}
MouseIsOver(WinTitle)
{
MouseGetPos,,, Win
return WinExist(WinTitle . " ahk_id " . Win)
}
F_mywheelup()
{
Send {Volume_Up}
}
F_mywheeldown()
{
Send {Volume_Down}
}
;/////////////////////////////////////////////////////////////////// - WINDOW SWITCHER (9)- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
F_Button9_WindowSwitcher()
{
Gui, Submit, NoHide
Msgbox,
(
Switches between windows by pressing {Left Windows} key and {Left Alt} key, then you can move between windows by using ← → ↑ ↓
)
Return
}
F_CB9_WindowSwitcher()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check9 ;0, 1, -1
{
Case 0:
Hotkey, LWin & LAlt, F_windowswitch, Off
Hotkey, LAlt & LWin, F_windowswitch, Off
IniWrite, NO, VariousFunctions.ini, Menu memory, Window Switcher
Case 1:
Hotkey, LWin & LAlt, F_windowswitch, On
Hotkey, LAlt & LWin, F_windowswitch, On
IniWrite, YES, VariousFunctions.ini, Menu memory, Window Switcher
}
}
F_windowswitch()
{
Critical, On
Send, {Ctrl Down}{LAlt Down}{Tab}
Sleep, 100 ;added additional delay as sometimes windows do not switch quick enough
Send, {Blind}{LAlt Up}{Ctrl Up}
Critical, Off
}
;/////////////////////////////////////////////////////////////////// - CAPITALIZATION SWITCHER (10) (11)- //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;CAPSLOCK
F_Button10_CAPSLOCK()
{
Gui, Submit, NoHide
Msgbox,
(
Press Capslock to change capitalization of the letters.
EXAMPLES:
Dog is jumping -> DOG IS JUMPING
Dog -> DOG
DOG IS JUMPING -> dog is jumping
DOG -> dog
dog is jumping -> Dog is jumping
dog -> Dog
It works everywhere exept Word, because in Word Application this function already exists.
)
Return
}
F_CB10_CAPSLOCK()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check10 ;0, 1, -1
{
Case 0:
Hotkey, Capslock, ForceCapitalize, off
IniWrite, NO, VariousFunctions.ini, Menu memory, Capitalize Capslock
Case 1:
Hotkey, IfWinNotActive, ahk_exe WINWORD.EXE
Hotkey, Capslock, ForceCapitalize, on
IniWrite, YES, VariousFunctions.ini, Menu memory, Capitalize Capslock
}
}
;SHIFT + F3
F_Button11_SHIFTF3()
{
Gui, Submit, NoHide
Msgbox,
(
Press {Shift} + {F3} to change capitalization of the letters.
EXAMPLES:
Dog is jumping -> DOG IS JUMPING
Dog -> DOG
DOG IS JUMPING -> dog is jumping
DOG -> dog
dog is jumping -> Dog is jumping
dog -> Dog
It works everywhere exept Word, because in Word Application this function already exists.
)
Return
}
F_CB11_SHIFTF3()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check11 ;0, 1, -1
{
Case 0:
Hotkey, +F3, ForceCapitalize, off
IniWrite, NO, VariousFunctions.ini, Menu memory, Capitalize Shift
Case 1:
Hotkey, IfWinNotActive, ahk_exe WINWORD.EXE
Hotkey, +F3, ForceCapitalize, on
IniWrite, YES, VariousFunctions.ini, Menu memory, Capitalize Shift
}
}
ForceCapitalize() ; by Jakub Masiak, revised by Hania Ziętak on 2021-12-20
{
SelectWord := false ;Select Word := no (false)
OldClipboard := ClipboardAll ;save content of clipboard to variable OldClipboard
Clipboard := "" ;clear content of clipboard
Send, ^c ;copy to clipboard (ctrl + c)
if (Clipboard = "") ;if clipboard is still empty, mark and copy word where caret is located
{
SelectWord := true ;Select Word := yes (true)
Send, {Ctrl Down}{left}{Shift Down}{Right}{Shift Up}{Ctrl Up} ;mark entire word ; do przerobienia
Send, ^c
}
ClipWait, 0 ;wait until clipboard is full with anything
state := "FirstState" ;Initial state
Loop, Parse, Clipboard ;each character of Clipboard will be treated as a separate substring.
{
if A_LoopField is upper
{
if (state = "FirstState")
{
state := "UpperCaseState" ; "UpperCaseState" - a considered letter is uppercase
}
}
else if A_LoopField is lower
{
if (state = "FirstState")
{
state := "LowerCaseState" ; "LowerCaseState" - a considered letter is lowercase
}
}
if (state = "UpperCaseState")
{
if A_Loopfield is lower
{
state := "AfterUpperCaseState" ; "AfterUpperCaseState" - a considered letter is after a uppercase letter
}
}
if (state = "LowerCaseState")
{
if A_Loopfield is upper
{
state := "AfterUpperCaseState"
}
}
} ;end of loop ; the script is exiting the loop with the last letter status
if (state = "AfterUpperCaseState")
{
StringUpper, Clipboard, Clipboard
TooltipCap()
}
if (state = "UpperCaseState")
{
StringLower, Clipboard, Clipboard
TooltipCap()
}
if (state = "LowerCaseState")
{
FirstLetter := "" ; exit state of the loop ; a previous letter (in a word) in second loop
NotAgain := true ; flag: preventing capitalizing next letters
Loop, Parse, Clipboard ; this loop is for the case that we have a word or sentence with all small letters (eg. dog/dog is jumping) and the next case is one capital then all small letters (eg. Dog/Dog is jumping)
{
WhoAmI := A_LoopField ; what is first or after the first letter: space, dot, end of line or next letter (which has to be small)
if (WhoAmI = A_Space)
{
FirstLetter := % FirstLetter . A_Space
TooltipCap()
}
else if (WhoAmI = ".") or (WhoAmI = "`n")
{
NotAgain := true
FirstLetter := FirstLetter . WhoAmI
TooltipCap()
}
else if (NotAgain = true) and (WhoAmI != A_Space)
{
StringUpper, WhoAmI, WhoAmI
NotAgain := false
FirstLetter := FirstLetter . WhoAmI
TooltipCap()
}
else
{
FirstLetter := FirstLetter . WhoAmI
TooltipCap()
}
}
Clipboard := FirstLetter
}
Send, % "{Text}" . Clipboard
Sleep, 100
Clipboard := OldClipboard
OldClipboard := ""
return
}
TooltipCap()
{
ToolTip, Capitalization switcher (VariousFunctions.ahk), A_CaretX, A_CaretY - 20
SetTimer, TurnOffTooltip, -1000
}
;/////////////////////////////////////////////////////////////////// - FOOT SWITCH (12) (13) (14) - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
;F13
F_Button12_FootswitchF13()
{
Gui, Submit, NoHide
Msgbox,
(
Switch windows in the system tray, by pressing {F13}.
)
Return
}
F_CB12_FootswitchF13()
{
global ;assume-global mode of operation
Gui, Submit, NoHide
Switch Check12 ;0, 1, -1
{
Case 0:
Hotkey, F13, F_f13key, off
IniWrite, NO, VariousFunctions.ini, Menu memory, F13
Case 1:
Hotkey, F13, F_f13key, on
IniWrite, YES, VariousFunctions.ini, Menu memory, F13
}
}
F_f13key()
{
Send, #t
SoundBeep, 1000, 200
}
;F14
F_Button13_FootswitchF14()
{
Gui, Submit, NoHide
Msgbox,