-
Notifications
You must be signed in to change notification settings - Fork 1
/
Max3.ahk
158 lines (130 loc) · 3.73 KB
/
Max3.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
#SingleInstance force
#NoEnv
SendMode Input
SetRegView 64
RegRead, X, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, X
if ErrorLevel
X = 1680
RegRead, Y0, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, Y0
if ErrorLevel
Y0 = -560
RegRead, Y1, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, Y1
if ErrorLevel
Y1 = 80
RegRead, Y2, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, Y2
if ErrorLevel
Y2 = 720
RegRead, W, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, W
if ErrorLevel
W = 1080
RegRead, H, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, H
if ErrorLevel
H = 640
RegRead, gitPath, HKEY_LOCAL_MACHINE, SOFTWARE\GitForWindows, InstallPath
If ErrorLevel
Hotkey, ^T, Off
Else
gitBash := gitPath . "\git-bash.exe"
RegRead, ahkPath, HKEY_LOCAL_MACHINE, SOFTWARE\AutoHotkey, InstallDir
If ErrorLevel
Hotkey, #A, Off
Else
ahkHelp := ahkPath . "\AutoHotkey.chm"
Gui, Add, Text, x12 y12 w460, To setup with the moinitor you want to split, move this window to the target monitor. Then press OK.
Gui, Add, Button, x420 y48 w60 h30 Default, OK
Gui, +MaximizeBox
RegRead, FirstRun, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, FirstRun
if ErrorLevel {
FormatTime, FirstRun, , yyyy/M/d HH:mm:ss
RegWrite, REG_SZ, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, FirstRun, %FirstRun%
GoSub, SetupHandler
}
Gui, About: New, , About Mario's Max3
Gui, About: Add, Text, x12 y12, This is a handy tool for you to vertically split a monitor into three.
Gui, About: Add, Text, x12 y36 w480, Use the hotkeys Win + Numpad 8`, Win + Numpad 5 and Win + Numpad 2 to place your active window to one of the three parts in your target monitor.
Gui, About: Add, Text, x12 y72 w480, Hotkeys Win + Numpad 4 and Win + Numpad 6 are used for maximization.
Gui, About: Add, Text, x12 y108, Copyright Mario Studio`, all rights reserved.
Menu, Tray, Tip, Mario's Max3
Menu, Tray, NoStandard
Menu, Tray, Add, Locate Monitor, SetupHandler
If %A_IsCompiled%
Menu, Tray, Icon, 1&, %A_ScriptFullPath%, -997, 64
Menu, Tray, Default, 1&
Menu, Tray, Add, About Max3, AboutHandler
If %A_IsCompiled%
Menu, Tray, Icon, 2&, %A_ScriptFullPath%, -998, 64
Menu, Tray, Add
Menu, Tray, Add, Exit, ExitHandler
If %A_IsCompiled%
Menu, Tray, Icon, 4&, %A_ScriptFullPath%, -999, 64
Return
ButtonOK:
Gui, Maximize
WinGetPos, X, Y, W, H
X += 3
Y += 3
W -= 6
H -= 6
H /= 3
Y0 = %Y%
Y += H
Y1 = %Y%
Y += H
Y2 = %Y%
RegWrite, REG_SZ, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, X, %X%
RegWrite, REG_SZ, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, Y0, %Y0%
RegWrite, REG_SZ, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, Y1, %Y1%
RegWrite, REG_SZ, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, Y2, %Y2%
RegWrite, REG_SZ, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, W, %W%
RegWrite, REG_SZ, HKEY_CURRENT_USER, SOFTWARE\Mario Studio\Mario's Max3, H, %H%
Gui, Hide
Return
SetupHandler:
Gui, Show, Restore, Mario's Max3 - Monitor Locator
Gui, Flash
Return
AboutHandler:
Gui, About: Show
Return
ExitHandler:
ExitApp
Return
#Numpad8::
WinRestore, A
WinMove, A, , X, Y0, W, H
Return
#Numpad5::
WinRestore, A
WinMove, A, , X, Y1, W, H
Return
#Numpad2::
WinRestore, A
WinMove, A, , X, Y2, W, H
Return
#Numpad4::
WinRestore, A
WinMove, A, , 0, 0
WinMaximize, A
Return
#Numpad6::
WinRestore, A
WinMove, A, , X, Y0
WinMaximize, A
Return
#A::
IfWinNotExist, AutoHotkey Help
Run, %ahkHelp%
Else
WinActivate
Return
^T::
WinGetTitle, title, A
IfEqual, title, MINGW64:/, Return
IfInString, title, MINGW64:/
{
Run, %gitBash%, %gitPath%
WinWaitActive, MINGW64:/
cmd := "cd " . SubStr(title, 9) . "`n"
Send, %cmd%
}
Return