-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransparent.ahk
164 lines (154 loc) · 2.75 KB
/
transparent.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
#SingleInstance Force
#MaxThreadsPerHotkey 10
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
SetBatchLines, -1
AutoTrim, Off
AlphaIncrement = 2
Ctrl & MButton::
GetKeyState, ShiftState, Shift
If ShiftState = U
{
Return
}
Gosub, WinGetTransparency
Gosub, WinSetTransparency
Gosub, ShowTransparencyToolTip
Return
Ctrl & _::
GetKeyState, ShiftState, Shift
If ShiftState = U
{
Return
}
Gosub, WinGetTransparency
Trans0 -= AlphaIncrement
Gosub, WinSetTransparency
Gosub, ShowTransparencyToolTip
Return
Ctrl & +::
GetKeyState, ShiftState, Shift
If ShiftState = U
{
Return
}
Gosub, WinGetTransparency
Trans0 += AlphaIncrement
Gosub, WinSetTransparency
Gosub, ShowTransparencyToolTip
Return
WinGetTransparency:
MouseGetPos, , , WindowID
If Trans_%WindowID% =
{
Trans_%WindowID% = 100
}
StringTrimRight, Trans, Trans_%WindowID%, 0
Trans0 = %Trans%
Return
WinSetTransparency:
WinGetClass, WindowClass, ahk_id %WindowID%
If WindowClass = Progman
{
Trans0 = 100
}
Else If Trans0 < 10
{
Trans0 = 10
}
Else If Trans0 > 100
{
Trans0 = 100
}
a = %Trans%
b = %Trans0%
Trans = %Trans0%
Trans_%WindowID% = %Trans%
If WindowClass = Progman
{
Return
}
a *= 2.55
Alpha0 = %a% ; Starting Alpha
b *= 2.55
Alpha = %b%
Transform, Alpha, Round, %Alpha% ; Ending Alpha
c = %Alpha0% ; Init iteration var.
d = %Alpha%
d -= %Alpha0% ; Range to iterate
Transform, e, Abs, %d%
If e > 0
{
f = %d%
f /= %e% ; Unity increment (+/- 1)
}
Else
{
f = 0
}
g = %f%
g *= %AlphaIncrement% ; Increment
Loop
{
Transform, c, Round, %c%
WinSet, Trans, %c%, ahk_id %WindowID%
If c = %Alpha%
{
Break
}
Else If e >= %AlphaIncrement%
{
c += %g%
e -= %AlphaIncrement%
}
Else
{
c = %Alpha%
}
}
Return
ShowTransparencyToolTip:
h = %Trans%
h /= 4
i = 25
i -= %h%
ToolTipText = Opacity :%A_Space%
Loop, %h%
{
ToolTipText = %ToolTipText%|
}
If h > 0
{
ToolTipText = %ToolTipText%%A_Space%
}
ToolTipText = %ToolTipText%%Trans%`%
If i > 0
{
ToolTipText = %ToolTipText%%A_Space%
}
Loop, %i%
{
ToolTipText = %ToolTipText%|
}
ToolTip, %TooltipText%
MouseGetPos, MouseX0, MouseY0
SetTimer, RemoveToolTip
Return
RemoveToolTip:
If A_TimeIdle < 1000
{
MouseGetPos, MouseX, MouseY
If MouseX = %MouseX0%
{
If MouseY = %MouseY0%
{
Return
}
}
}
SetTimer, RemoveToolTip, Off
ToolTip
Return