little script for speaker voice on office laptop

本文介绍了一个VBS脚本,用于解决电脑耳机插孔损坏导致扬声器无法发声的问题。通过运行此脚本可以调整耳机音量设置,从而使扬声器恢复声音输出。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

My computer's headphone connector is broken.
When play music the speaker has no sound, even no headphone is inserted, and speaker is the default playback device.

So, write this VBS script to make focus and change volume of headphone, then speaker could make sounds...

My computer's headphone connector is broken.
When play music the speaker has no sound, even no headphone is inserted, and speaker is the default playback device.
So, write this VBS script to make focus and change volume of headphone, then speaker could make sounds...
set oShell = CreateObject("WScript.Shell") 
oShell.run "%SystemRoot%\System32\SndVol.exe" 
WScript.Sleep 100 
oShell.SendKeys"+{TAB}" ' Tab to the mute and press space
WScript.Sleep 100 
oShell.SendKeys"+{TAB}" ' Tab to the mute and press space
WScript.Sleep 100 
oShell.SendKeys"{DOWN}" ' Tab to the mute and press space
WScript.Sleep 100 
oShell.SendKeys"{DOWN}" ' Tab to the mute and press space
WScript.Sleep 100 	
oShell.SendKeys"{ENTER}" ' Tab to the mute and press space
WScript.Sleep 100 
oShell.SendKeys"{TAB}" ' Tab to the mute and press space			
WScript.Sleep 100 
oShell.SendKeys"{TAB}" ' Tab to the mute and press space
Dim counter					
counter = 20
While counter > 0
    oShell.AppActivate "Volume Mixer"
	oShell.SendKeys"{TAB}" ' Tab to the mute and press space
    WScript.Sleep 200 
    oShell.SendKeys"{TAB}" ' Tab to the mute and press space
    oShell.SendKeys"{DOWN}" ' Tab to the mute and press space
    WScript.Sleep 500
	oShell.SendKeys"{UP}" ' Tab to the mute and press space
	WScript.Sleep 500
    counter = counter - 1
Wend

oShell.AppActivate "Volume Mixer"
oShell.SendKeys"%{F4}"  ' ALT F4 to exit the app.
set oShell = nothing

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值