I found out that you can control app volume by accessing Volume Mixer. Does anyone have any idea how to code/cmd/powershell to set an app volume by the user choice every time i log in/restart??
e.g. every time I restart my laptop, the volume of the WeChat app is maximised but I wish it to be only 2/100.
Any help will be appreciated!
CodePudding user response:
To set your master Sound volume try
@echo off
Title Volume=2
(echo CreateObject("WScript.Shell"^).SendKeys "{" ^& chr(174^) ^&" 50}")>"%Temp%\%~n0.vbs"
(echo CreateObject("WScript.Shell"^).SendKeys "{" ^& chr(175^) ^&" 1}")>>"%Temp%\%~n0.vbs"
cscript //NoLogo "%Temp%\%~n0.vbs"
You could add that to your start-up sequence but that's another question that I will let you research. https://support.microsoft.com/en-us/windows/add-an-app-to-run-automatically-at-startup-in-windows-10-150da165-dcd9-7230-517b-cf3c295d89dd
Each volume unit is 2% so we go down 50 (max vol=100%) to zero then up one unit to 2%
Note by careful edit you could combine all those lines into one single "shortcut" in your startup, but again I will let you experiment.
For an audio feedback try this
@echo off
Title Volume=2
(echo CreateObject("WScript.Shell"^).SendKeys "{" ^& chr(175^) ^&" 50}")>"%Temp%\%~n0.vbs"
(echo CreateObject("WScript.Shell"^).SendKeys "{" ^& chr(174^) ^&" 30}")>>"%Temp%\%~n0.vbs"
(echo CreateObject("SAPI.SpVoice"^).Speak ("Lowering volume to 2%%"^))>>"%Temp%\%~n0.vbs"
(echo CreateObject("WScript.Shell"^).SendKeys "{" ^& chr(174^) ^&" 20}")>>"%Temp%\%~n0.vbs"
(echo CreateObject("WScript.Shell"^).SendKeys "{" ^& chr(175^) ^&" 1}")>>"%Temp%\%~n0.vbs"
cscript //NoLogo "%Temp%\%~n0.vbs"