-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mask.ahk
100 lines (94 loc) · 2.48 KB
/
Mask.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
#NoTrayIcon
#NoEnv
#SingleInstance force
global WIN := GUI_show("wallpaper.jpg")
Return
GUI_show(p, t=10) {
If FileExist(p)
{
Gui Destroy
Gui Margin, 0, 0
Gui +AlwaysOnTop +Owner -Caption +ToolWindow -DPIScale +OwnDialogs +HwndWIN +E0x08000000 +E0x20
Try
{
If FileExist(p)
Gui Add, Picture, W%A_ScreenWidth% H%A_ScreenHeight% Center, % p
Else If RegExMatch(p, "^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$")
Gui Color, % SubStr(p, -5)
Else
Throw
}
Catch
{
TrayTip, , % "Falied creating GUI.", 3000, 3
ExitApp, -1
}
TrayTip, % A_ScriptName, % "Enjoy it!", 3000, 1
Gui Show, W1 H1
WinSet, Transparent, % t, % "ahk_id " WIN
Gui Show, W%A_ScreenWidth% H%A_ScreenHeight% X0 Y0
Return WIN
}
}
Transparency_plus(win, step) {
WinGet, vTransparent, Transparent, % "ahk_id " win
If Not vTransparent
vTransparent := 255
If (vTransparent >= 255 - step)
{
WinSet, Transparent, Off, % "ahk_id " win
Return 255
}
Else
{
vTransparent += step
WinSet, Transparent, % vTransparent, % "ahk_id " win
Return vTransparent
}
}
Transparency_minus(win, step) {
WinGet, vTransparent, Transparent, % "ahk_id " win
If Not vTransparent
vTransparent := 255
If (vTransparent <= step)
{
WinSet, Transparent, % step, % "ahk_id " win
Return step
}
Else
{
vTransparent -= step
WinSet, Transparent, % vTransparent, % "ahk_id " win
Return vTransparent
}
}
WM_LBUTTONDOWN() {
static ____ = OnMessage(0x201, "WM_LBUTTONDOWN")
SendMessage, 0xA1, 2
}
WM_LBUTTONDBLCLK() {
static ____ = OnMessage(0x203, "WM_LBUTTONDBLCLK")
global LB_RESIZE
If LB_RESIZE
Gui -Resize
Else
Gui +Resize
LB_RESIZE := !LB_RESIZE
}
WM_MBUTTONDOWN() {
static ____ = OnMessage(0x207, "WM_MBUTTONDOWN")
TrayTip, , % A_ScriptName . " exit!", 3000, 2
ExitApp, 0
}
WM_MOUSEWHEEL(wParam, lParam) {
static ____ = OnMessage(0x20A, "WM_MOUSEWHEEL")
If (wParam == 0x780000) ; wheelUp
Transparency_plus(WIN, 5)
Else If (wParam == 0xff880000) ; wheelDown
Transparency_minus(WIN, 5)
}
GuiDropFiles(GuiHwnd, FileArray, CtrlHwnd, X, Y) {
for i, file in FileArray
GUI_show(file, A_Args[2])
}
^F11::WinSet, ExStyle, ^0x20, % "ahk_id " WIN