This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMouseSoundChanger.ahk
130 lines (107 loc) · 2.41 KB
/
MouseSoundChanger.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
#SingleInstance Force
#NoEnv
title := "MouseSoundChanger by itstd"
configPath = %A_AppData%\MouseSoundChangerConfig.ini
linkPath = %A_Startup%\MouseSoundChanger.lnk
isInStartup := 0
tipOnStart := 0
runAsAdmin := 0
Menu, Tray, NoStandard
IfExist, %linkPath%
{
isInStartup := 1
}
IniRead, tipOnStart, % configPath, set, tipOnStart, 1
IniRead, runAsAdmin, % configPath, set, runAsAdmin, 0
Menu, Settings, Add, Add to startup, addToStartup
Menu, Settings, Add, Show tip on startup, showTipOnStartup
Menu, Settings, Add, Run as administrator, runAsAdmin
Menu, Settings, Add,
Menu, Settings, Add, Reset settings, reset
if (tipOnStart)
Menu, Settings, Check, Show tip on startup
if (runAsAdmin)
Menu, Settings, Check, Run as administrator
if (runAsAdmin && !A_IsAdmin) {
Run, *RunAs "%A_ScriptFullPath%",, UseErrorLevel
exitapp
return
}
if (isInStartup)
Menu, Settings, Check, Add to startup
if (tipOnStart)
TrayTip, % title, Working, 3
Menu, Tray, Add, Developer's GitHub, dev
Menu, Tray, Add,
Menu, Tray, Add, Settings, :Settings
Menu, Tray, Add,
Menu, Tray, Add, Close, exitapp
Menu, Tray, Default, Settings
return
addToStartup:
if (isInStartup) {
FileDelete, % linkPath
Menu, Settings, Uncheck, Add to startup
isInStartup := 0
} else {
FileCreateShortcut, % A_ScriptFullPath, % linkPath
Menu, Settings, Check, Add to startup
isInStartup := 1
}
return
showTipOnStartup:
if (tipOnStart) {
IniWrite, 0, % configPath, set, tipOnStart
Menu, Settings, Uncheck, Show tip on startup
tipOnStart := 0
} else {
IniWrite, 1, % configPath, set, tipOnStart
Menu, Settings, Check, Show tip on startup
tipOnStart := 1
}
return
runAsAdmin:
if (runAsAdmin) {
IniWrite, 0, % configPath, set, runAsAdmin
Menu, Settings, Uncheck, Run as administrator
runAsAdmin := 0
} else {
IniWrite, 1, % configPath, set, runAsAdmin
Menu, Settings, Check, Run as administrator
runAsAdmin := 1
}
return
reset:
FileDelete, % configPath
FileDelete, % linkPath
reload
useTooltip = 0
isInStartup = 0
runAsAdmin = 0
return
dev:
Run, http://github.com/streleckiy
return
exitapp:
exitapp
return
XButton1::
settimer, prevTooltip, 1
Send, {Media_Prev}
return
XButton2::
settimer, nextTooltip, 1
Send, {Media_Next}
return
nextTooltip:
settimer, nextTooltip, off
Tooltip, Next >>
sleep 1000
Tooltip
return
prevTooltip:
settimer, prevTooltip, off
Tooltip, << Prev
sleep 1000
Tooltip
return