-
Notifications
You must be signed in to change notification settings - Fork 7
/
app_handling.ahk
143 lines (104 loc) · 3.45 KB
/
app_handling.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
#Include WinTitles.ahk
#include lib/clipboard.ahk
;-------------------------------------------------
; CapsLock Telegram
;
; it seems that i cannot open telegram window when it is in task bar, so
; i just chose to reopen it every time. telegram is single instance, so all
; looks good so far :^)
;
; SendInput is used so that i select the first chat :^)
;
CapsLock & t::
startAndResizeTelegram()
{
if !WinExist(WinTitles.Telegram) {
Run "D:\all\all\Telegram\Telegram.exe"
Winwait % WinTitles.Telegram
Sleep 499
WinActivate % WinTitles.Telegram
; select the most important chat
Sleep 499
SendInput {PgDn}
Sleep 90
SendInput {PgUp}
Sleep 90
SendInput {PgUp}
Sleep 90
SendInput {PgUp}
Sleep 90
SendInput {Enter}
Sleep 499
; ; move the window to its proper position
; NOTE: THIS DOES NOT WORK. SOMETIMES TELEGRAM JUST WONT FUCKING RESIZE.
; RUUUUUUDE!
getTaskbarDimensions(tw, th)
w := A_ScreenWidth/2.5
h := A_ScreenHeight - th
x := A_ScreenWidth - w
y := 0
WinMove, % WinTitles.Telegram, , x, y, w, h
; another method of moving telegram to its desired position.
; this also bugges sometimes
; save initial mouse pos
; CoordMode Mouse, Screen
; MouseGetPos, initial_x, initial_y
; SetDefaultMouseSpeed 40
; CoordMode Mouse, Window
; ; move mouse to starting position of resize process
; MouseMove, 100, 16
; SendInput {LButton}
; SendInput {LButton}
; Sleep 90
; MouseMove, 100, 16
; ; do a windows right-snap (resize window to half the screen, right side)
; SendInput {LButton down}
; CoordMode Mouse, Screen ;; this coordMode trickery has to be done for each movement.
; MouseMove, A_ScreenWidth, A_ScreenHeight/2
; CoordMode Mouse, Window
; SendInput {LButton up}
; Sleep 90
; ; set the desired window size
; MouseMove, -1, 200
; SendInput {LButton down}
; CoordMode Mouse, Screen
; MouseMove, A_ScreenWidth - A_ScreenWidth/3, 200
; CoordMode Mouse, Window
; SendInput {LButton up}
; ; ; de-snap the window, so that the size is remembered.
; ; ; windows is retarded and does not remember the size/position for snapped windows.
; ; MouseMove, 200, 16
; ; SendInput {LButton down}
; ; MouseMove, -10, 0,,R
; ; SendInput {LButton up}
; ; Sleep 90
; ; SendInput {LButton down}
; ; MouseMove, 10, 0,,R
; ; SendInput {LButton up}
; ; Sleep 90
; ; move the mouse back to the original position
; CoordMode Mouse, Screen
; MouseMove, initial_x, initial_y
}
else {
WinActivate % WinTitles.Telegram
}
}
;-------------------------------------------------
; get taskbar dimensions, assuming bottom position
getTaskbarDimensions(ByRef tw, ByRef th) {
WinGetPos, x, y, tw, th, ahk_class Shell_TrayWnd
}
CapsLock & v::
openInMpv() {
saveClipboard()
Send {Blind}^l
Sleep 100
Send {Blind}^a
Sleep 100
Send {Blind}^c
ClipWait 1
Tippy("Opening mpv with: " Clipboard)
Run % "D:\all\all\mpv.net\mpvnet.exe " Clipboard
restoreClipboard()
}