-
Notifications
You must be signed in to change notification settings - Fork 9
/
AutoHotkey.ahk
3559 lines (2545 loc) · 68.3 KB
/
AutoHotkey.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
;
; AutoHotKey file for Windows powerusers and DJs
; Created by Pedro Estrela, 2021
;
; Please see the complete list of shortcuts at the very bottom of this file
;
;
;
; Ideas:
; https://www.reddit.com/r/AutoHotkey/comments/7y4k8m/automatically_search_selected_text_in_youtube_and/
; https://autohotkey.com/board/topic/51282-auto-copy-url/
;
; References:
; https://www.autohotkey.com/docs/Hotkeys.htm
; https://www.autohotkey.com/docs/FAQ.htm
; https://www.autohotkey.com/docs/Tutorial.htm
; https://jszapp.com/autohotkey-scripting-operators/#Assignment
;
; String functions:
; https://www.autohotkey.com/boards/viewtopic.php?t=32985
;
; Functions:
; https://www.autohotkey.com/docs/commands/SetTitleMatchMode.htm
; https://www.autohotkey.com/docs/misc/WinTitle.htm
; https://www.autohotkey.com/docs/commands/WinGetPos.htm
; https://www.autohotkey.com/docs/Variables.htm#CoordMode
; https://www.autohotkey.com/docs/commands/CoordMode.htm
; https://www.autohotkey.com/docs/commands/Click.htm
; https://www.autohotkey.com/docs/Variables.htm
;
;
; AHK Quoting Guide:
; commands:
; variables need "%"
; strings NOT quoted
; = (assignment)
;
; expressions:
; variables unquoted
; strings NEED quotes
; := (expression assignment)
; .= (string append)
; . (concatenate)
; (on commands, with the "%" operator)
;
;
; IDE / syntax highlighting:
; https://www.autohotkey.com/boards/viewtopic.php?t=50 (lazy theme)
; https://github.com/maestrith/AHK-Studio/wiki/File
;
;
; Ideas:
; https://superuser.com/questions/1203029/wsl-trailing-whitespaces-being-added-to-bash-code-pasted-into-cmd-wsl-tty-per
;
; "cant live" little programs: https://www.neogaf.com/threads/some-of-my-cant-live-without-progams-what-are-yours.1482889/
; Clipboard History Lite - 10 clipboard with caps lock
; Everything for windows file search
; Link Clump - Chrome Extension - Open Multiple Links with "Z" key
;
; Puretext - Strips formatting when pasting.
; ShareX - Screenshot tool (very comprehensive )
; Directory Opus - File Manager
; Directory Report - find wasted space, duplicates, etc
;
; update:
; list of functions: https://autohotkey.com/board/topic/72918-my-ahk-stuff/
; ahk grid (depends on the mouse position) https://gist.github.com/dcai/ec6f5a9a6d066fcf3c8f0e61f8d01e4f
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Print and Debug functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
print( values* )
{
print2( " ", False, values* )
}
error( values* )
{
print("Error:", values*)
}
warning( values* )
{
print("Warning:", values*)
}
die( values* )
{
error( values* )
; raise exception ?
}
printd( values* )
{
print(values*)
;print2( "|", True, values* )
}
pause( )
{
print("Press enter to continue")
}
print1( var )
{
st := "<" . var . ">"
msgbox, %st%
}
print2( sep, surround := False , values* )
{
#sep := " "
st := ""
for index, value in values {
if(len(value) == 0 ){
value := "<EMPTY>"
}
st .= sep . value . sep
}
if(surround){
st := sep . st . sep
}
msgbox, %st%
}
print_debug( debug, var* )
{
debug_print( debug, var* )
}
debug_print( debug, var* )
{
global_do_debug := True
; global_do_debug := False
if(global_do_debug){
if(debug){
printd(var*)
}
}
}
print_kv(key, value){
if(len(value) == 0 ){
value := "<empty>"
}
msgbox, %key% = |%value%|
}
debug_print_kv(debug, key, value){
global_do_debug := True
; global_do_debug := False
if(global_do_debug){
if(debug){
print_kv(key, value)
}
}
}
debug_print_array(debug, name, array, show_elements := false)
{
show_elements := true
if(debug){
print_array(name, array, show_elements)
}
}
print_array(name, array, show_elements := true)
{
debug := true
count := array.count()
if(count == ""){
count := 0 ; needed ??
}
print("Array '" . name . "' has " . count . " elements")
if(!show_elements)
return
for index, element in array
{
print("Element " . index . ": <" . element . ">")
}
}
int(x)
{
return floor(x)
}
strip(String, OmitChars := " `t"){
return Trim(String, OmitChars)
}
len(String){
return StrLen(String)
}
init_beep(){
; SoundBeep, 3000, 100
}
beep(){
; SoundBeep, 5000, 100
}
debug_beep(){
; SoundBeep, 7000, 100
}
get_active_window_id()
{
WinGet, current_ID, ID, A
return current_ID
}
set_active_window_id(new_id)
{
WinActivate, ahk_id %new_id%
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Array support
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
array_to_ml(Array, sep="`n")
{
ret := ""
For k, v In Array
{
ret .= v . sep
}
return ret
}
array_to_ml_space(Array, sep=" ")
{
return array_to_ml(Array, sep)
}
duplicate_string(st, count=2)
{
ret :=
;debug(count)
Loop, %count%
{
;debug(ret)
ret .= ret . st
}
;debug(ret)
return ret
}
array_to_ml_spaced(Array, seperator_lines=2)
{
sep := duplicate_string("`n", seperator_lines)
;debug(sep)
return array_to_ml(Array, sep)
}
array_append_string_to_entries(array, st)
{
ret := array()
for index, value in array {
new_st := value . st
ret.push( new_st )
}
return ret
}
array_prepend_string_to_entries(array, st)
{
; print_array("prepend", sarray)
ret := array()
for index, value in array {
new_st := st . value
ret.push( new_st )
;print(new_st)
}
return ret
}
array_remove_duplicates(arr)
{
; Leaves the original intact, only loops once, preserves order:
hash := {}, newArr := []
for e, v in arr
if (!hash.Haskey(v))
hash[(v)] := 1, newArr.push(v)
return newArr
}
array_concat(array1, array2)
{
for index, value in array2
{
array1.push(value)
}
return array1
}
array_to_clipboard(array)
{
st := array_to_ml(array)
clipboard_set(st)
}
array_limit(array, top := 5)
{
count := 0
ret := Array()
for index, value in array
{
count += 1
if(count > top)
break
ret.push(value)
}
return ret
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; mouse control
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ahk_reload()
{
; warning("Going to reload AHK script")
reload
}
mouse_move(win_x, win_y)
{
;velocity := 10
velocity := 0
MouseMove, %win_x%, %win_y%, %velocity%
sleep 50
}
mouse_click(win_x, win_y)
{
mouse_move(win_x, win_y)
click
sleep 200
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; WSL and shell stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Find correct bash.exe file
get_bash_exe()
{
;; options to launching WSL commands in windows
; https://stackoverflow.com/questions/41225711/wsl-run-linux-from-windows-without-spawning-a-cmd-window
; https://devblogs.microsoft.com/commandline/a-guide-to-invoking-wsl/
; bash_exe = %A_WinDir%\sysnative\bash.exe
; https://github.com/goreliu/wsl-terminal/blob/master/src/open-wsl.ahk
; debug_print("bash found at: " %bash_exe% )
; Run, "%bash_exe%" -c 'tmux new-window -c "$PWD"', , Hide
; Run, "%bash_exe%" -c 'source ${HOME}/.bashrc.pestrela ; cd ${HOME}/links/youtube-dl; youtube_dl.sh %url% ; pause'
; ShellRun("C:\vim\vim80\gvim.exe", "+SLoad", "", "", 3)
; run, bash.exe -c 'source ${HOME}/.bashrc.pestrela ; cd ${HOME}/links/youtube-dl; youtube_dl.sh %url% ; pause
; run, C:\windows\system32\bash.exe ; -c 'echo ola '
bash_exe = %A_WinDir%\sysnative\bash.exe
if (!FileExist(bash_exe)) {
bash_exe = %A_WinDir%\system32\bash.exe
} if (!FileExist(bash_exe)) {
MsgBox, 0x10, , WSL(Windows Subsystem for Linux) must be installed.
ExitApp, 1
}
return bash_exe
}
run_shell_get_output(program, command)
{
; source: https://www.autohotkey.com/boards/viewtopic.php?t=17910
shell := ComObjCreate("WScript.Shell")
exec := shell.Exec(program " /c " command)
if (A_LastError)
return A_LastError
ret := exec.StdOut.ReadAll()
;print(ret)
return ret
}
run_cmd_get_output(command)
{
return run_shell_get_output("cmd", command)
}
run_wsl_get_output(command)
{
; %windir%\system32\wsl.exe
return run_shell_get_output("bash", command)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; unit tests
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
test_arrays()
{
t := Object()
t[20] := 22
t[22] := 22
t[4] := 8
t[8] := 1
t[1] := 5
t[5] := 22
t[3] := 7
t[7] := 2
t[2] := 5
x := t[4]
k := 5
y := t[k]
print(k, t[5], x, y )
}
test_objects(x,y)
{
ret := Object()
ret["k1"] := x
ret.k2 := y
xx := ret["k1"]
yy := ret.k2
print1("Testing objects")
print1(x)
print(y)
print1(xx)
print1(yy)
print1(ret["k1"])
print1(ret["k2"])
return
}
test_scale_loc()
{
loc := Location_abs( 1010, 1010, 1020, 1020)
mon1 := Monitor_abs(1, 1000, 1000, 1100, 1100)
mon2 := Monitor_abs(2, 2000, 2000, 2200, 2200)
new_loc_correct := Location_abs(2020, 2020, 2040, 2040)
new_loc_test := mon_scale_loc(loc, mon1, mon2)
loc_same_assert(new_loc_test, new_loc_correct)
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; FancyZones PowerToys Extension
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This package implements window movement shortcuts. This is similar to the standard windows Win+Arrow
; (settings / multitasking / snap windows "ON" / other settings "OFF"
;
; Similarities:
; general feel
; it scales random windows to the monitor size and location
;
; Differences:
; Win+left does NOT move between windows (too confusing)
; maximize bit is always unset.
; There is no intermediate step between L2 and R2
; no swapping "behind" screens (going from 1 to 3)
;
;;;;;;;;;;;;;;;;;;;;;;;
;
; standard windows 10 behavior:
; left: r2 -> rr -> l2 -> r2 (other screen) -> rr -> l2 -> etc
; down+left: l2 -> bl2 -> br2 (othr screen) -> does not pass trough "rr"
; (to return from bl2 to l2 you need to press "up")
;
; These WERE the windows standard shortcuts:
; Win+arrow: movement on corners + expand columns + move columns
; ctrl+win: virtual desktops (disabled)
; ctrl+alt: nothing
; ctrl+win+alt: resize window (up to maximized)
;
;
; AHK Customized shortcuts:
; Win+Arrows:
; pressing ONCE creates corners / moves corners around
; pressing TWICE always generates half-sizes
; note: this shortcut never swaps screens
;
; Shift+Win+Arrows:
; Swaps between screens. Does not "wrap behind" (screen1 -> screen3)
; if keeping on the same screen, performs regular enlargement
;
;
;
;;;
;;; Fancyzones REQUIRED configuration on windows 10
;;;
;
; PowerToys fancyzones:
; info:
; manual: https://docs.microsoft.com/en-us/windows/powertoys/fancyzones
; multiple overlapping zones discussion: https://github.com/microsoft/PowerToys/issues/6744
;
; Zones:
; vertical monitor, 8 squares
; horizontal monitor, 6 squares + 3 columns (sizes: 1048, 1055, 969)
;
; Options:
; hold shift: "OFF"
; use non primary mouse button: ON
; show zones in all monitors: OFF
; allow zones to span across monitors: OFF
; multiple zones overlap: split the overlapped area into multiple...
;
; Override windows snap: ON
; Win+Up move windows based on relative position ON
; Keep windows in their zones when the resolution changes ON
; during a zone layout change... ON
; move newly created windows to last known zone: ON
; move newly created windows to active monitor: ON
; restore original size when unsnapping: OFF <<<<<<<<<<
;
; quicklayout: OFF
; make dragged window transparent: ON
; zone opacity: 78%
;
; Windows 10 Multitasking:
; Options:
; snap windows OFF
; show suggestions on timeline OFF
; on taskbar show only desktop I'm using
; alt+tab show only desktop I'm using
;
;
;
;;;;;;;;
;;;;;;;; fancyzones alternatives
;;;;;;;;
;
; WindowGrid:
; this is a great program. It both Resizes and moves windows locked to a grid
;
; settings: 6x6 grid, disable aero shake, show dragged contents OFF
; graphics: fill window OFF / radial gradient OFF
;
; http://windowgrid.net/
;
; Divvy:
; https://mizage.com/help/windivvy/
;
;
; gridmove:
; https://www.ghacks.net/2007/01/14/grid-move-divides-your-desktop-into-grids/
;
; winlayout:
; https://www.ghacks.net/2009/03/11/windows-desktop-management-software-win-layout/
;
; tictac:
; https://www.ghacks.net/2010/08/23/align-windows-on-the-windows-desktop/
;
; (list ataken from https://www.ghacks.net/2019/05/29/windowgrid-improve-window-moving-resizing-and-aligning-on-windows/)
;
; gridy:
; https://www.ghacks.net/2010/07/26/align-windows-on-the-desktop-easily-with-gridy/
;
;
;;;;;;;;;;
;;;;;;;;;; MONITOR definitions
;;;;;;;;;;
;; note1: parameter sequence is always: location, monitor, case
;; note2: my classes always receive width/heighth, but then store eveything in absolute numbers.
;; absolute 0,0 is the top left corner of the primary monitor
Monitor_abs(number, c1_x, c1_y, c2_x, c2_y)
{
w := c2_x - c1_x
h := c2_y - c1_y
return Monitor_wh(number, c1_x, c1_y, w, h)
}
Monitor_wh(number, x, y, w, h)
{
;; note: input is weight and
mon := Object()
mon.number := number
; more info: https://github.com/pacobyte/AutoHotkey-Lib-WinGetPosEx/blob/master/WinGetPosEx.ahk
margin := 8
;x := x - margin
;y := y - margin
;w := w - margin * 1
;h := h - margin * 1
mon.x0 := x
mon.x1 := x + floor(w/3)
mon.x2 := x + floor(w/2)
mon.x3 := x + floor(w*2/3)
mon.x4 := x + w
mon.y0 := y
mon.y1 := x + floor(h/3)
mon.y2 := y + floor(h/2)
mon.y3 := x + floor(h*2/3)
mon.y4 := y + h
return mon
}
mon_2_st(mon)
{
st := ""
st .= " Monitor(#" . mon.number . ", "
st .= "" . mon.x0 . " _ " . mon.x4 . ", "
st .= "" . mon.y0 . " _ " . mon.y4 . ") "
return st
}
print_mon(mon)
{
print( mon_2_st(mon))
}
mon_span_x(mon){
return mon.x4 - mon.x0
}
mon_span_y(mon){
return mon.y4 - mon.y0
}
mon_scale_x(mon1, mon2)
{
; idea: https://autohotkey.com/board/topic/32874-moving-the-active-window-from-one-monitor-to-the-other/
a1 := mon_span_x(mon1)
a2 := mon_span_x(mon2)
scale := a2/a1
return scale
}
mon_scale_y(mon1, mon2)
{
a1 := mon_span_y(mon1)
a2 := mon_span_y(mon2)
scale := a2/a1
return scale
}
point_scale(p, abs1, abs2, scale)
{
p := p - abs1
p := p * scale
p := p + abs2
p := int(p)
return p
}
mon_scale_loc(loc, mon1, mon2, max:=0)
{
;
; example, for the X location only:
; loc: 1010 .. 1020
; monitor1: 1000 .. 1100 (10px)
; monitor2: 2000 .. 2200 (20px)
;
; new_loc: 2020 .. 2040
;
;
; scale calculation
; 1100 - 1000 = 100
; 2200 - 2000 = 200
; 200 / 100 = 2x
;
; final calcs:
; 1010 - 1000 = 10
; 10 x 2 = 20
;
; 2000 + 20
debug := False
scale_x := mon_scale_x(mon1, mon2)
scale_y := mon_scale_y(mon1, mon2)
;print(scale_x, scale_y)
x0 := point_scale(loc.x0, mon1.x0, mon2.x0, scale_x)
x4 := point_scale(loc.x4, mon1.x0, mon2.x0, scale_x)
y0 := point_scale(loc.y0, mon1.y0, mon2.y0, scale_y)
y4 := point_scale(loc.y4, mon1.y0, mon2.y0, scale_y)
;print(x0, y0, x4, y4, max)
new_loc := Location_abs(x0, y0, x4, y4, max)
;print_loc(loc)
;print_loc(new_loc)
;debug := True
print_debug(debug, scale_x, scale_y)
print_debug(debug, loc_2_st(loc), " -> ", loc_2_st(new_loc))
return new_loc
}
;;;;;;;;;;
;;;;;;;;;; LOCATIONS definitions
;;;;;;;;;;
Location_abs(c1_x, c1_y, c2_x, c2_y, max := 0)
{
loc := {}
loc.x0 := c1_x
loc.y0 := c1_y
loc.x4 := c2_x
loc.y4 := c2_y
loc.max := max
return loc
}
Location_wh(x, y, w, h, max :=0 )
{
return Location_abs(x, y, x+w, y+h, max)
}
Location_cycle_maximized(loc)
{
if(loc.max == -1){
loc.max := 0
} else if(loc.max == 0){
loc.max := 1
} else if(loc.max == 1){
;loc.max := -1
loc.max := 0
} else {
error("unknown minmax")
}
return loc
}
Location_set_minimized(loc)
{
loc.max := -1
return loc
}
loc_same(loc1, loc2, assert:=False)
{
st1 := loc_2_st(loc1)
st2 := loc_2_st(loc2)
ret := st1 == st2
if(assert){
if(ret == False){
print("Error: loc different:", st1, st2)
}
}
return ret
}
loc_same_assert(loc1, loc2, assert:=True)
{
return loc_same(loc1, loc2, assert)
}
loc_2_st(loc)
{
st := ""
st .= "Location(" . loc.x0 . " _ " . loc.x4 . ", "
st .= loc.y0 . " _ " . loc.y4 . ", "
if(loc.max == 1){
st .= " Maximized"
} else if(loc.max == -1){
st .= " Minimized"
} else if(loc.max == 0){
st .= " Normal"
} else {
st .= " error_maximize"
}
st .= ") "
return st
}
print_loc(loc)
{
print( loc_2_st(loc))
}
get_location()
{
WinGetPos, x, y, w, h, A
WinGet, wc_Max, MinMax, A ; are we maximized? https://www.autohotkey.com/docs/commands/WinGet.htm#MinMax
;print1(wc_X)
x := x + 7
loc := Location_wh(x, y, w, h, wc_Max)
return loc
}
loc_is_equal(l1, l2)
{
return l1.x0 == l2.x0 and l1.y0 == l2.y0 and l1.x4 == l2.x4 and l1.y4 == l2.y4
}
loc_span_x(loc){
return loc.x4 - loc.x0
}