-
Notifications
You must be signed in to change notification settings - Fork 0
/
media.ahk
74 lines (60 loc) · 2.18 KB
/
media.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
#Requires AutoHotkey v2.0
<!Esc::Volume_Mute ; Left Alt + Esc
<!F1::Volume_Down ; Left Alt + F1
<!F2::Volume_Up ; Left Alt + F2
<!F3::MaxVolume() ; Left Alt + F3
<!F4::ToggleFxSound() ;Left Alt + F4
<#Esc::Media_Play_Pause ;Left Win + Esc
<#F1::Media_Prev ;Left Win + F1
<#F2::Media_Next ;Left Win + F2
Capslock & 1::SwitchWifi("RT-GPON-77D8")
Capslock & 2::SwitchWifi("RT-5GPON-77D8")
MaxVolume() {
Send("{Volume_Up}") ; Sends the key to show the volume panel
SoundSetVolume(100) ; Sets the volume to 100%
}
;launching FxSound to boost sound
LaunchFxSound(){
FxSoundPath := "C:\Program Files\FxSound LLC\FxSound\FxSound.exe"
if FileExist(FxSoundPath) {
Run(FxSoundPath)
} else {
MsgBox "FxSound.exe not found at: " FxSoundPath
}
SoundSetVolume(100) ; Sets the volume to 100%
}
;killing FxSound and switching to default speakers
ExitFxSound(){
defaultSpeakersName := "Динамики"
RunWait('taskkill /F /IM FxSound.exe', '', 'Hide')
Sleep(1000)
Run("Lib\nircmd\nircmd.exe setdefaultsounddevice " defaultSpeakersName)
}
ToggleFxSound(){
RunWait(Format('cmd.exe /c tasklist /FI "IMAGENAME eq FxSound.exe" > "{}"', A_Temp "\output.txt"), "", "Hide")
; Read the file's contents
output := FileRead(A_Temp "\output.txt")
; Check if FxSound.exe is running
if InStr(output, "FxSound.exe") {
ExitFxSound()
} else {
LaunchFxSound()
}
; Clean up by deleting the temporary file
FileDelete(A_Temp "\output.txt")
}
SwitchWifi(wifi) {
; Run the command to get current Wi-Fi interface details and save output to a temporary file
RunWait(Format('cmd /c netsh wlan show interfaces > "{}"', A_Temp "\output.txt"), "", "Hide")
; Read the content of the output file
output := FileRead(A_Temp "\output.txt")
; Check if already connected to the desired Wi-Fi network
if !InStr(output, wifi) {
; If not connected, attempt to connect to the specified network
RunWait(Format('cmd /c netsh wlan connect name="{}"', wifi), "", "Hide")
} else {
MsgBox("Already connected to " wifi ".")
}
; Clean up: Delete temporary file
FileDelete(A_Temp "\output.txt")
}