-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAudioShortcuts.ahk
More file actions
57 lines (46 loc) · 1.84 KB
/
AudioShortcuts.ahk
File metadata and controls
57 lines (46 loc) · 1.84 KB
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
#include VA.ahk ;VA.ahk has to be in the same folder as this script
#Persistent ;this keeps the script running if no hotkeys are set (though one is)
;Set the Toggle to the correct value the first time the script starts
;This can be put before Toggle is toggled, if you change the device yourself regularly
curDeviceName := VA_GetDeviceName(VA_GetDevice("playback"))
Toggle := curDeviceName != "Speakers (Realtek High Definition Audio)"
;SETS THE TRAY ICON, ADDS AN OPTION TO RUN THE SCRIPT FROM THE TRAY
Menu, Tray, Icon, speak.ico,,1 ;default is speaker icon
Menu, Tray, NoStandard ;?
Menu, Tray, Add, &Switch Playback Device, ^!F11 ;add tray option
Menu, Tray, Add, &Volume Up (Ctrl+Alt+Page Up), ^!PgUp ;add tray option
Menu, Tray, Add, &Volume Down (Ctrl+Alt+Page Down), ^!PgDn ;add tray option
Menu, Tray, Add, ;add blank line
Menu, Tray, Standard ;?
Menu, Tray, Default, &Switch Playback Device ;default option is new option
Return
;TOGGLE HEADPHONES AND SPEAKERS
;see http://www.autohotkey.net/~Lexikos/docs/VA.html#VA_GetDevice for playback names
;see sound menu -> playback tab for names
;or use VA_SetDefaultEndpoint("playback:" (Toggle ? 4 : 2), 0) (number 4 and 2 are speakers and headset on my pc)
;or give devices a pretty name
^!F11:: ;Ctrl+Alt+F11 toggles headphones / speakers
Toggle := !Toggle
if (Toggle) {
VA_SetDefaultEndpoint("Realtek HD Audio 2nd output", 0)
Menu, Tray, Icon, head.ico,,1
}
else {
VA_SetDefaultEndpoint("Speakers (Realtek High Definition Audio)", 0)
Menu, Tray, Icon, speak.ico,,1
}
return
;change the volume
^!PgUp::Send {Volume_Up 3}
^!PgDn::Send {Volume_Down 3}
;Add media keys
;next song
!Right::Send {Media_Next}
;previous song
!Left::Send {Media_Prev}
;play/pause
!Down::Send {Media_Play_Pause}
;volumne down
!NumpadSub::Send {Volume_Down}
;volumne up
!NumpadAdd::Send {Volume_Up}