-
Notifications
You must be signed in to change notification settings - Fork 0
/
autohotkey-zoom-wrangler.ahk
102 lines (80 loc) · 2.35 KB
/
autohotkey-zoom-wrangler.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
#Requires AutoHotkey v2.0
; AutoHotKey-Zoom-Wrangler
; Version 0.0.3
; Created by James Swift
; https://github.com/JamesSwift/AutoHotKey-Zoom-Wrangler
; Which monitor should zoom be displayed on?
UseMonitor := 1
; Show zoom fullscreen on the monitor specified when the key is pressed.
F9::{
DetectHiddenWindows 1
if WinExist("Zoom ahk_class ZPContentViewWndClass", "", "Zoom Meeting"){
WinShow
WinActivate
WinMoveTop
MakeFullscreen()
}
}
; Move zoom behind other applications when the key is pressed
F10::{
DetectHiddenWindows 1
if WinExist("Zoom ahk_class ZPContentViewWndClass", "", "Zoom Meeting"){
WinMoveBottom
WinHide
}
}
MakeFullscreen(){
; If window isn't fullscreen, make it so
WinGetPos &OutX, &OutY, &OutWidth, &OutHeight
if (OutWidth < MW || OutHeight < MH){
CoordMode "Mouse", "Screen"
MouseGetPos &StartX, &StartY
MouseClick "Left", Round( OutX + (OutWidth / 2) ), Round(OutY + (OutHeight / 2)), 2
MouseMove StartX, StartY
}
}
; ------------ Startup Setup ----------------
try
{
MonitorGet UseMonitor, &ML, &MT, &MR, &MB
MW := MR - ML
MH := MB - MT
; Gve zoom a chance to settle down
WinWait("Zoom ahk_class ZPContentViewWndClass", "", , "Zoom Meeting")
Sleep 5000
; If the window isn't on the correct monitor, make it so
if WinExist("Zoom ahk_class ZPContentViewWndClass", "", "Zoom Meeting"){
WinGetPos &OutX, &OutY, &OutWidth, &OutHeight
if ( OutX + OutWidth > MR || OutX < ML || OutY + OutHeight > MB || OutY < MT ){
WinMove (ML + 50), (MB - 300 - 50), 300, 300
}
; Make the window maximized, then fullscreen it. Sleep required while zoom sorts itself out.
WinMaximize
Sleep 1000
MakeFullscreen()
Sleep 1000
}
; Hide the window by default
WinWait("Zoom ahk_class ZPContentViewWndClass", "", , "Zoom Meeting")
WinMoveBottom
WinHide
; Hide the splash zoom window
if WinExist("Zoom ahk_class ZPPTMainFrmWndClassEx", ""){
WinMoveBottom
WinMinimize
}
; Send the main zoom window to the back
; if WinExist("Zoom Meeting ahk_class ZPContentViewWndClass", ""){
; WinMoveBottom
; }
}
catch
MsgBox "An error occured with autohotkey-zoom-wrangler. Perhaps monitor " UseMonitor " doesn't exist? Check the config file."
Persistent
OnExit ExitFunc
ExitFunc(ExitReason, ExitCode){
DetectHiddenWindows 1
if WinExist("Zoom ahk_class ZPContentViewWndClass", "", "Zoom Meeting"){
WinShow
}
}