-
Notifications
You must be signed in to change notification settings - Fork 0
/
AutoHotkey.ahk
127 lines (99 loc) · 2.7 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
;
; Initialization
;
paneWidth := 400
;
; Paste
;
^NumPad1::
PasteText("aserio@blizzard.com")
return
^NumPad2::
PasteText("sc2smurf001@gmail.com")
return
^NumPad3::
PasteText("h4tf4k@gmail.com")
return
^NumPad4::
PasteText("alexserio")
return
^NumPad5::
PasteText("4100390516689235")
return
;
; Window Snap
;
#,::
window := DllCall("GetForegroundWindow")
GetFrameWindowRect(window, frameX, frameY, frameWidth, frameHeight)
WinGetPos, windowX, windowY, windowWidth, windowHeight, A
monitor := DllCall("MonitorFromWindow", "Ptr", window, "UInt", 0)
GetMonitorWorkRect(monitor, workX, workY, workWidth, workHeight)
newX := workX + windowX - frameX
newY := workY + windowY - frameY
newWidth := paneWidth + (windowWidth - frameWidth)
newHeight := workHeight + (windowHeight - frameHeight)
WinRestore, A
WinMove, A, , newX, newY, newWidth, newHeight
return
#.::
window := DllCall("GetForegroundWindow")
GetFrameWindowRect(window, frameX, frameY, frameWidth, frameHeight)
WinGetPos, windowX, windowY, windowWidth, windowHeight, A
monitor := DllCall("MonitorFromWindow", "Ptr", window, "UInt", 0)
GetMonitorWorkRect(monitor, workX, workY, workWidth, workHeight)
newX := workX + paneWidth + (windowX - frameX)
newY := workY + windowY - frameY
newWidth := workWidth - paneWidth + (windowWidth - frameWidth)
newHeight := workHeight + (windowHeight - frameHeight)
WinRestore, A
WinMove, A, , newX, newY, newWidth, newHeight
return
#z::
; VarSetCapacity(point, 8)
; NumPut(4000, point, 0, "Int")
; NumPut(100, point, 4, "Int")
; monitor := DllCall("MonitorFromPoint", "Ptr", point, "UInt", 0)
window := DllCall("GetForegroundWindow")
monitor := DllCall("MonitorFromWindow", "Ptr", window, "UInt", 0)
MsgBox % monitor
return
;
; Functions
;
PasteText(text)
{
originalClipboard := ClipBoardAll
ClipBoard := text
SendInput ^v
Sleep 1
ClipBoard := originalClipboard
VarSetCapacity(originalClipboard, 0)
}
GetMonitorWorkRect(monitor, ByRef x, ByRef y, ByRef width, ByRef height)
{
VarSetCapacity(monitorInfo, 40)
NumPut(40, monitorInfo, 0, "UInt")
DllCall("GetMonitorInfo", "Ptr", monitor, "Ptr", &monitorInfo)
left := NumGet(monitorInfo, 20, "Int")
top := NumGet(monitorInfo, 24, "Int")
right := NumGet(monitorInfo, 28, "Int")
bottom := NumGet(monitorInfo, 32, "Int")
x := left
y := top
width := right - left
height := bottom - top
}
GetFrameWindowRect(window, ByRef x, ByRef y, ByRef width, ByRef height)
{
VarSetCapacity(rect, 16)
DllCall("dwmapi\DwmGetWindowAttribute", "Ptr", window, "UInt", 9, "Ptr", &rect, "UInt", 16)
left := NumGet(rect, 0, "Int")
top := NumGet(rect, 4, "Int")
right := NumGet(rect, 8, "Int")
bottom := NumGet(rect, 12, "Int")
x := left
y := top
width := right - left
height := bottom - top
}