5
是否有任何方法檢測耳機是否插入或未通過VBScript?通過VBScript檢測耳機是否插入或未插入
此鏈接犯規幫助Switching current active sound device using VBScript?
是否有任何方法檢測耳機是否插入或未通過VBScript?通過VBScript檢測耳機是否插入或未插入
此鏈接犯規幫助Switching current active sound device using VBScript?
您應該能夠使用Win32_SoundDevice
WMI類。下面是這可能是一個很好的起點的示例腳本:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_SoundDevice",,48)
For Each objItem in colItems
Wscript.Echo "Availability: " & objItem.Availability
Wscript.Echo "Caption: " & objItem.Caption
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "Status: " & objItem.Status
Wscript.Echo "StatusInfo: " & objItem.StatusInfo
Next
(source)
我會做一些比較運行前插入耳機後,從那裏走。