使用Autohotkey控制系統音量

鍵盤控制系統音量這個問題,我最開始是使用VolumeEasy這個軟件(大學時軍哥的推薦),

後來我自己也寫過類似的東西,用C#

(因爲那時公司管理較嚴,無法說明跟工作相的關軟件禁止安裝,日企大家懂的)

使用C#控制系統音量

使用C#註冊全局快捷鍵

 

今天,在公司換了臺新電腦,win7_64的,

配置這臺電腦的時候,用Autohotkey重寫了這個功能,

發現還是AHK好。腳本如下

 

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^NumpadSub::
;MsgBox Pressing either Control+Numpad0 or Control+Numpad1 will display this message.
Send {Volume_Down 5}  ; Lower the master volume by 3 intervals.
return

^NumpadAdd::
;MsgBox Pressing either Control+Numpad0 or Control+Numpad1 will display this message.
Send {Volume_Up 5}  ; Raise the master volume by 1 interval (typically 5%).
return

^NumpadMult::
Send {Volume_Mute}  ; Mute/unmute the master volume.
return

 

 

參考鏈接

 

小衆軟件上面有篇介紹MediaKeys(使用AHK寫的)的文章:

MediaKeys – 爲普通鍵盤添加媒體控制鍵

 

我寫腳本時,參考的AHK文檔:

SoundSet

Hotkeys (Mouse, Joystick and Keyboard Shortcuts)

List of Keys, Mouse Buttons, and Joystick Controls

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章