LarsJ Posted October 2, 2014 Share Posted October 2, 2014 Danyfirex, very nice. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Carlo84 Posted January 11, 2015 Share Posted January 11, 2015 (edited) How does it decide which mic to mute? cause it mutes my 4th mic instead of the default mic [Edit] actually it mutes every mic except for the default mic. 3 out of 4 microphones muted, the unmuted one being the default. [Edit2] doesn't matter which is the default, it just doesn't work with that particular mic. Edited January 11, 2015 by Carlo84 _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
Danyfirex Posted January 11, 2015 Share Posted January 11, 2015 How does it decide which mic to mute? cause it mutes my 4th mic instead of the default mic [Edit] actually it mutes every mic except for the default mic. 3 out of 4 microphones muted, the unmuted one being the default. [Edit2] doesn't matter which is the default, it just doesn't work with that particular mic. I will look later how to. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Carlo84 Posted January 12, 2015 Share Posted January 12, 2015 (edited) 2 devices that don't work are the Logitech G930 headset and the Logitech C920 webcam with build in mic. Both are USB devices perhaps that is the reason they do not work. $iDeviceCount does recognizes them but the actions after that do not apply Edited January 12, 2015 by Carlo84 _SplashProgressImage | _Regionselector | _IsPressed360 | _UserAccountContol_SetLevel | _ListSubFolders Link to comment Share on other sites More sharing options...
Danyfirex Posted January 12, 2015 Share Posted January 12, 2015 right now I don't have time to program but you can see here. maybe that helps you. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Seminko Posted July 21, 2018 Author Share Posted July 21, 2018 (edited) Hi Mr @Danyfirex ! It's been a long time, almost four years, wow. Anyways, I now switched to W10 and your awesome script stopped working for me. It now says 'Not incoming Parts in Part'. The only thing that made sense to me is change this line: If StringInStr($sPartName, "mic") Then to this, since the name changed from Microphone to Rear Pink In: If StringInStr($sPartName, "Pink") Then Here's the console log: expandcollapse popup>>>>>>>>>>>>>>>>>BEGIN<<<<<<<<<<<<<<<<<<<< +Part >Realtek HD Audio output ID: 65537 +Part >Celkové ztlumení ID: 131073 +Part >Reproduktory ID: 131072 +Part >Sum ID: 131074 +Part > ID: 65536 Not incoming Parts in Part +Part >Ztlumit ID: 131075 +Part >Rear Black In ID: 131076 +Part >Rear Black In ID: 65538 Not incoming Parts in Part +Part >Ztlumit ID: 131077 +Part >Rear Orange In ID: 131078 +Part >Rear Orange In ID: 65539 Not incoming Parts in Part +Part >Ztlumit ID: 131079 +Part >Rear Pink In ID: 131080 +Part >Rear Pink In ID: 65540 Not incoming Parts in Part +Part >Ztlumit ID: 131081 +Part >Front Pink In ID: 131082 +Part >Front Pink In ID: 65541 Not incoming Parts in Part +Part >Ztlumit ID: 131083 +Part >Rear Blue In ID: 131084 +Part >Rear Blue In ID: 65542 Not incoming Parts in Part +Part >Ztlumit ID: 131085 +Part >Front Green In ID: 131086 +Part >Front Green In ID: 65543 Not incoming Parts in Part +Part >Side ID: 131087 +Part >Side ID: 65544 Not incoming Parts in Part +Part >Center ID: 131088 +Part >Center ID: 65545 Not incoming Parts in Part +Part >Subwoofer ID: 131089 +Part >Subwoofer ID: 65546 Not incoming Parts in Part +Part >Rear ID: 131090 +Part >Rear ID: 65547 Not incoming Parts in Part +Part >Front ID: 131091 +Part >Front ID: 65548 Not incoming Parts in Part Any help is appreciated. Thx Edited July 21, 2018 by Seminko Link to comment Share on other sites More sharing options...
Danyfirex Posted July 21, 2018 Share Posted July 21, 2018 I'm by Phone right now. I'll check later Regards Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Danyfirex Posted July 22, 2018 Share Posted July 22, 2018 I think the issue is that It's not creating the IAudioMute Interface. Probably is not supported at least using that way. try this code and show the SciTE console output. expandcollapse popupOpt("MustDeclareVars", 1) Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count Global Enum $eConsole, $eMultimedia, $eCommunications, $ERole_enum_count Global Const $CLSCTX_INPROC_SERVER = 1 Global Const $E_NOTFOUND = 0x80070490 Global Const $S_OK = 0 Global Const $CLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $IID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $tagIMMDeviceEnumerator = _ "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _ "GetDevice hresult(wstr;ptr*);" & _ "RegisterEndpointNotificationCallback hresult(ptr);" & _ "UnregisterEndpointNotificationCallback hresult(ptr)" Global Const $IID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $tagIMMDevice = _ "Activate hresult(struct*;dword;ptr;ptr*);" & _ "OpenPropertyStore hresult(dword;ptr*);" & _ "GetId hresult(wstr*);" & _ "GetState hresult(dword*)" Global Const $IID_IDeviceTopology = "{2A07407E-6497-4A18-9787-32F79BD0D98F}" Global Const $tagIDeviceTopology = "GetConnectorCount hresult(int*);GetConnector hresult(int;ptr*);" & _ "GetSubunitCount hresult(int*);GetSubunit hresult(int;ptr*);GetPartById hresult(int,ptr*);GetDeviceId hresult(ptr*);GetSignalPath hresult(ptr;ptr;bool;ptr*)" Global Const $IID_IConnector = "{9c2c4058-23f5-41de-877a-df3af236a09e}" Global Const $tagIConnector = "GetType hresult(ptr*);GetDataFlow hresult(ptr*);ConnectTo hresult(ptr);Disconnect hresult(none);IsConnected hresult(int*);" & _ "GetConnectedTo hresult(ptr*);GetConnectorIdConnectedTo hresult(wstr*);GetDeviceIdConnectedTo hresult(wstr*)" Global Const $IID_IPart = "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}" Global Const $tagIPart = "GetName hresult(wstr*);GetLocalId hresult(uint*);GetGlobalId hresult(wstr*);GetPartType hresult(ptr);GetSubType hresult(ptr);" & _ "GetControlInterfaceCount hresult(uint*);GetControlInterface hresult(int;ptr*);EnumPartsIncoming hresult(ptr*);EnumPartsOutgoing hresult(ptr*);" & _ "GetTopologyObject hresult(ptr*);Activate hresult(dword;struct*;ptr*);RegisterControlChangeCallback hresult(ptr);UnregisterControlChangeCallback hresult(ptr)" Global Const $IID_IPartsList = "{6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}" Global Const $tagIPartsList = "GetCount hresult(uint*);GetPart hreuslt(uint;ptr*)" Global Const $IID_IAudioMute = "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}" Global Const $tagIAudioMute = "SetMute hresult(bool;ptr);GetMute hresult(int*)" MUTE() Func MUTE() Local $hr = -1 Local $oMMDeviceEnumerator = ObjCreateInterface($CLSID_MMDeviceEnumerator, $IID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator) If @error Then ConsoleWrite("!Error Creating IMMDeviceEnumerator Interface" & @CRLF) Exit EndIf Local $pDevice = 0 $hr = $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eConsole, $pDevice) If FAILED($hr) Then ConsoleWrite("!Error Getting Default Render Endpoint Device" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $oMMDevice = ObjCreateInterface($pDevice, $IID_IMMDevice, $tagIMMDevice) If @error Then ConsoleWrite("!Error Creating IMMDevice Interface" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $pDeviceTopology = 0 $hr = $oMMDevice.Activate(__uuidof($IID_IDeviceTopology), $CLSCTX_INPROC_SERVER, 0, $pDeviceTopology) If FAILED($hr) Then ConsoleWrite("!Error Getting Device Topology" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $oDeviceTopology = ObjCreateInterface($pDeviceTopology, $IID_IDeviceTopology, $tagIDeviceTopology) If @error Then ConsoleWrite("!Error Creating IDeviceTopology Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $pConnEndpoint = 0 $hr = $oDeviceTopology.GetConnector(0, $pConnEndpoint) If FAILED($hr) Then ConsoleWrite("!Error Getting endpoint Connector" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oIConnector = ObjCreateInterface($pConnEndpoint, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creating IConnector Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pConnDevice = 0 $hr = $oIConnector.GetConnectedTo($pConnDevice) If FAILED($hr) Then ConsoleWrite("!Error GetConnectedTo Device" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oConnDevice = ObjCreateInterface($pConnDevice, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creation oConnDevice(IConnector) Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pPart = 0 $hr = $oConnDevice.QueryInterface($IID_IPart, $pPart) If FAILED($hr) Then ConsoleWrite("!Error Getting Part" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 $oConnDevice = 0 Exit EndIf Local $oIPart = ObjCreateInterface($pPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPart Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf ConsoleWrite(">>>>>>>>>>>>>>>>>BEGIN<<<<<<<<<<<<<<<<<<<<" & @CRLF) GetPart($oIPart) $oIPart = 0 EndFunc Func GetPart(ByRef $oIPart) Local $sPartName = "" Local $PartLocalId = "" Local $hr = -1 ConsoleWrite("+Part" & @CRLF) $hr = $oIPart.GetName($sPartName) If FAILED($hr) Then ConsoleWrite("Not Part Name" & @CRLF) Return $hr EndIf $oIPart.GetLocalId($PartLocalId) If FAILED($hr) Then ConsoleWrite("Not Part ID" & @CRLF) Return $hr EndIf ConsoleWrite("-" & $sPartName & @CRLF) ConsoleWrite("-ID: " & $PartLocalId & @CRLF) If StringInStr($sPartName, "Pink") or StringInStr($sPartName, "mic") Then Local $pIAudioMute = 0 Local $bMute = 0 Local $oIAudioMute = 0 $hr = $oIPart.Activate($CLSCTX_INPROC_SERVER, __uuidof($IID_IAudioMute), $pIAudioMute) ConsoleWrite( (SUCCEEDED($hr) ? "+SUCCESS: " : "!FAIL: ") & "IAudioMute" & @CRLF) If SUCCEEDED($hr) Then $oIAudioMute = ObjCreateInterface($pIAudioMute, $IID_IAudioMute, $tagIAudioMute) If @error Then ConsoleWrite("!Error Creating IAudioMute Interface") EndIf $hr = $oIAudioMute.GetMute($bMute) If FAILED($hr) Then ConsoleWrite("!Error Getting Mute State" & @CRLF) EndIf $hr = $oIAudioMute.SetMute(Not ($bMute), Null) If SUCCEEDED($hr) Then ConsoleWrite("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!") & @CRLF) TrayTip("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!"), "Danyfirex", 2, 1) Sleep(2000) EndIf EndIf EndIf Local $pIncomingParts = 0 $hr = $oIPart.EnumPartsIncoming($pIncomingParts) If ($hr = $E_NOTFOUND) Then ConsoleWrite("Not incoming Parts in Part" & @CRLF) Return $S_OK EndIf If FAILED($hr) Then ConsoleWrite("!ERROR Enumerating incoming Parts" & @CRLF) Return $hr EndIf Local $oIPartsList = ObjCreateInterface($pIncomingParts, $IID_IPartsList, $tagIPartsList) If @error Then ConsoleWrite("!Error Creating IPartsList Interface") EndIf Local $iNParts = 0 $oIPartsList.GetCount($iNParts) If FAILED($hr) Then ConsoleWrite("Couldn't get count of incoming parts") Return $hr EndIf Local $pIncomingPart = 0 Local $oIPart2 = 0 For $i = 0 To $iNParts - 1 $hr = $oIPartsList.GetPart($i, $pIncomingPart) If (FAILED($hr)) Then ConsoleWrite("Not Got Part" & @CRLF) $oIPartsList = 0 Return $hr EndIf Local $oIPart2 = ObjCreateInterface($pIncomingPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPartsList(2) Interface") $oIPartsList = 0 Return $hr EndIf $hr = GetPart($oIPart2) If FAILED($hr) Then $oIPartsList = 0 $oIPart2 = 0 Return $hr EndIf Next $oIPart2=0 Return $S_OK EndFunc ;==>GetPart Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED Func FAILED($hr) Return ($hr < 0) EndFunc ;==>FAILED Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Seminko Posted July 22, 2018 Author Share Posted July 22, 2018 Here's the output: Spoiler expandcollapse popup>>>>>>>>>>>>>>>>>BEGIN<<<<<<<<<<<<<<<<<<<< +Part -Realtek HD Audio output -ID: 65537 +Part -Celkové ztlumení -ID: 131073 +Part -Reproduktory -ID: 131072 +Part -Sum -ID: 131074 +Part - -ID: 65536 Not incoming Parts in Part +Part -Ztlumit -ID: 131075 +Part -Rear Black In -ID: 131076 +Part -Rear Black In -ID: 65538 Not incoming Parts in Part +Part -Ztlumit -ID: 131077 +Part -Rear Orange In -ID: 131078 +Part -Rear Orange In -ID: 65539 Not incoming Parts in Part +Part -Ztlumit -ID: 131079 +Part -Rear Pink In -ID: 131080 !FAIL: IAudioMute +Part -Rear Pink In -ID: 65540 !FAIL: IAudioMute Not incoming Parts in Part +Part -Ztlumit -ID: 131081 +Part -Front Pink In -ID: 131082 !FAIL: IAudioMute +Part -Front Pink In -ID: 65541 !FAIL: IAudioMute Not incoming Parts in Part +Part -Ztlumit -ID: 131083 +Part -Rear Blue In -ID: 131084 +Part -Rear Blue In -ID: 65542 Not incoming Parts in Part +Part -Ztlumit -ID: 131085 +Part -Front Green In -ID: 131086 +Part -Front Green In -ID: 65543 Not incoming Parts in Part +Part -Side -ID: 131087 +Part -Side -ID: 65544 Not incoming Parts in Part +Part -Center -ID: 131088 +Part -Center -ID: 65545 Not incoming Parts in Part +Part -Subwoofer -ID: 131089 +Part -Subwoofer -ID: 65546 Not incoming Parts in Part +Part -Rear -ID: 131090 +Part -Rear -ID: 65547 Not incoming Parts in Part +Part -Front -ID: 131091 +Part -Front -ID: 65548 Not incoming Parts in Part Link to comment Share on other sites More sharing options...
Danyfirex Posted July 22, 2018 Share Posted July 22, 2018 As I was thinking the issue is that the IAudioMute interface can't be created. I'll look deep on this later. Saludos Seminko 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Danyfirex Posted July 22, 2018 Share Posted July 22, 2018 Seems to be Windows 10 enumerates in a diferent way... I think this should work: expandcollapse popupOpt("MustDeclareVars", 1) Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count Global Enum $eConsole, $eMultimedia, $eCommunications, $ERole_enum_count Global Const $CLSCTX_INPROC_SERVER = 1 Global Const $E_NOTFOUND = 0x80070490 Global Const $S_OK = 0 Global Const $CLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $IID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $tagIMMDeviceEnumerator = _ "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _ "GetDevice hresult(wstr;ptr*);" & _ "RegisterEndpointNotificationCallback hresult(ptr);" & _ "UnregisterEndpointNotificationCallback hresult(ptr)" Global Const $IID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $tagIMMDevice = _ "Activate hresult(struct*;dword;ptr;ptr*);" & _ "OpenPropertyStore hresult(dword;ptr*);" & _ "GetId hresult(wstr*);" & _ "GetState hresult(dword*)" Global Const $IID_IDeviceTopology = "{2A07407E-6497-4A18-9787-32F79BD0D98F}" Global Const $tagIDeviceTopology = "GetConnectorCount hresult(int*);GetConnector hresult(int;ptr*);" & _ "GetSubunitCount hresult(int*);GetSubunit hresult(int;ptr*);GetPartById hresult(int,ptr*);GetDeviceId hresult(ptr*);GetSignalPath hresult(ptr;ptr;bool;ptr*)" Global Const $IID_IConnector = "{9c2c4058-23f5-41de-877a-df3af236a09e}" Global Const $tagIConnector = "GetType hresult(ptr*);GetDataFlow hresult(ptr*);ConnectTo hresult(ptr);Disconnect hresult(none);IsConnected hresult(int*);" & _ "GetConnectedTo hresult(ptr*);GetConnectorIdConnectedTo hresult(wstr*);GetDeviceIdConnectedTo hresult(wstr*)" Global Const $IID_IPart = "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}" Global Const $tagIPart = "GetName hresult(wstr*);GetLocalId hresult(uint*);GetGlobalId hresult(wstr*);GetPartType hresult(ptr);GetSubType hresult(ptr);" & _ "GetControlInterfaceCount hresult(uint*);GetControlInterface hresult(int;ptr*);EnumPartsIncoming hresult(ptr*);EnumPartsOutgoing hresult(ptr*);" & _ "GetTopologyObject hresult(ptr*);Activate hresult(dword;struct*;ptr*);RegisterControlChangeCallback hresult(ptr);UnregisterControlChangeCallback hresult(ptr)" Global Const $IID_IPartsList = "{6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}" Global Const $tagIPartsList = "GetCount hresult(uint*);GetPart hreuslt(uint;ptr*)" Global Const $IID_IAudioMute = "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}" Global Const $tagIAudioMute = "SetMute hresult(bool;ptr);GetMute hresult(int*)" MUTE() Func MUTE() Local $hr = -1 Local $oMMDeviceEnumerator = ObjCreateInterface($CLSID_MMDeviceEnumerator, $IID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator) If @error Then ConsoleWrite("!Error Creating IMMDeviceEnumerator Interface" & @CRLF) Exit EndIf Local $pDevice = 0 $hr = $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eConsole, $pDevice) If FAILED($hr) Then ConsoleWrite("!Error Getting Default Render Endpoint Device" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $oMMDevice = ObjCreateInterface($pDevice, $IID_IMMDevice, $tagIMMDevice) If @error Then ConsoleWrite("!Error Creating IMMDevice Interface" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $pDeviceTopology = 0 $hr = $oMMDevice.Activate(__uuidof($IID_IDeviceTopology), $CLSCTX_INPROC_SERVER, 0, $pDeviceTopology) If FAILED($hr) Then ConsoleWrite("!Error Getting Device Topology" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $oDeviceTopology = ObjCreateInterface($pDeviceTopology, $IID_IDeviceTopology, $tagIDeviceTopology) If @error Then ConsoleWrite("!Error Creating IDeviceTopology Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $pConnEndpoint = 0 $hr = $oDeviceTopology.GetConnector(0, $pConnEndpoint) If FAILED($hr) Then ConsoleWrite("!Error Getting endpoint Connector" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oIConnector = ObjCreateInterface($pConnEndpoint, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creating IConnector Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pConnDevice = 0 $hr = $oIConnector.GetConnectedTo($pConnDevice) If FAILED($hr) Then ConsoleWrite("!Error GetConnectedTo Device" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oConnDevice = ObjCreateInterface($pConnDevice, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creation oConnDevice(IConnector) Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pPart = 0 $hr = $oConnDevice.QueryInterface($IID_IPart, $pPart) If FAILED($hr) Then ConsoleWrite("!Error Getting Part" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 $oConnDevice = 0 Exit EndIf Local $oIPart = ObjCreateInterface($pPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPart Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf ConsoleWrite(">>>>>>>>>>>>>>>>>BEGIN<<<<<<<<<<<<<<<<<<<<" & @CRLF) GetPart($oIPart) $oIPart = 0 EndFunc Func GetPart(ByRef $oIPart) Local Static $iIndex=0 Local $sPartName = "" Local $PartLocalId = "" Local $hr = -1 ConsoleWrite("+Part" & @CRLF) $hr = $oIPart.GetName($sPartName) If FAILED($hr) Then ConsoleWrite("Not Part Name" & @CRLF) Return $hr EndIf $oIPart.GetLocalId($PartLocalId) If FAILED($hr) Then ConsoleWrite("Not Part ID" & @CRLF) Return $hr EndIf ConsoleWrite(">" & $sPartName) ConsoleWrite(" ID: " & $PartLocalId & @CRLF) If True Then Local $pIAudioMute = 0 Local $bMute = 0 Local $oIAudioMute = 0 $hr = $oIPart.Activate($CLSCTX_INPROC_SERVER, __uuidof($IID_IAudioMute), $pIAudioMute) If SUCCEEDED($hr) Then $iIndex+=1 If SUCCEEDED($hr) And $iIndex=4 Then $iIndex=0 $oIAudioMute = ObjCreateInterface($pIAudioMute, $IID_IAudioMute, $tagIAudioMute) If @error Then ConsoleWrite("!Error Creating IAudioMute Interface") EndIf $hr = $oIAudioMute.GetMute($bMute) If FAILED($hr) Then ConsoleWrite("!Error Getting Mute State" & @CRLF) EndIf $hr = $oIAudioMute.SetMute(Not ($bMute), Null) If SUCCEEDED($hr) Then ConsoleWrite("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!") & @CRLF) TrayTip("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!"), "Danyfirex", 2, 1) Sleep(2000) EndIf EndIf EndIf Local $pIncomingParts = 0 $hr = $oIPart.EnumPartsIncoming($pIncomingParts) If ($hr = $E_NOTFOUND) Then ConsoleWrite("Not incoming Parts in Part" & @CRLF) Return $S_OK EndIf If FAILED($hr) Then ConsoleWrite("!ERROR Enumerating incoming Parts" & @CRLF) Return $hr EndIf Local $oIPartsList = ObjCreateInterface($pIncomingParts, $IID_IPartsList, $tagIPartsList) If @error Then ConsoleWrite("!Error Creating IPartsList Interface") EndIf Local $iNParts = 0 $oIPartsList.GetCount($iNParts) If FAILED($hr) Then ConsoleWrite("Couldn't get count of incoming parts") Return $hr EndIf Local $pIncomingPart = 0 Local $oIPart2 = 0 For $i = 0 To $iNParts - 1 $hr = $oIPartsList.GetPart($i, $pIncomingPart) If (FAILED($hr)) Then ConsoleWrite("Not Got Part" & @CRLF) $oIPartsList = 0 Return $hr EndIf Local $oIPart2 = ObjCreateInterface($pIncomingPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPartsList(2) Interface") $oIPartsList = 0 Return $hr EndIf $hr = GetPart($oIPart2) If FAILED($hr) Then $oIPartsList = 0 $oIPart2 = 0 Return $hr EndIf Next $oIPart2=0 Return $S_OK EndFunc ;==>GetPart Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED Func FAILED($hr) Return ($hr < 0) EndFunc ;==>FAILED Saludos Seminko 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Seminko Posted July 22, 2018 Author Share Posted July 22, 2018 13 minutes ago, Danyfirex said: Seems to be Windows 10 enumerates in a diferent way... I think this should work: Saludos You sir, are a legend! Thank you, again. Link to comment Share on other sites More sharing options...
Seminko Posted July 22, 2018 Author Share Posted July 22, 2018 (edited) Aaaand I spoke a bit too soon When I call the function muliple times it doesn't affect the mic only but rather all the "inputs", and it does that in this order: So the first run, it correctly mutes Rear Pink In, which is where my mic is. Then the Front Pink in, black and finally orange which do nothing. After which is unmutes the Rear Pink In (mic) but only the icon changes (the mic is not muted in reality), however without running it again, it unmutes Front Pink in as well which then in reality unmutes the mic Edited July 22, 2018 by Seminko grammar Link to comment Share on other sites More sharing options...
Danyfirex Posted July 22, 2018 Share Posted July 22, 2018 Ok. I'll check later... Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
careca Posted July 23, 2018 Share Posted July 23, 2018 After i read all the posts, i thought the op was talking about the feature "listen to this device" as seen on this screenshot. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Seminko Posted July 23, 2018 Author Share Posted July 23, 2018 12 hours ago, careca said: After i read all the posts, i thought the op was talking about the feature "listen to this device" as seen on this screenshot. Nope, that's a different thing. Similar, yes, but not the same. Link to comment Share on other sites More sharing options...
Seminko Posted July 23, 2018 Author Share Posted July 23, 2018 (edited) The strange thing is that when I close the script after each mute, it works correctly. But when I have a while loop going with sleep, calling the Mute function by a hotkey, the above mentioned behavior appears... Something with the variables maybe? I guess, if there was a way to reset them after each call, that would solve the problem? If that is a solution we want, that is... Edited July 23, 2018 by Seminko Link to comment Share on other sites More sharing options...
Danyfirex Posted July 24, 2018 Share Posted July 24, 2018 Seminko please post the way you use the script. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Seminko Posted July 24, 2018 Author Share Posted July 24, 2018 (edited) 14 hours ago, Danyfirex said: Seminko please post the way you use the script. Saludos Here it is: expandcollapse popupOpt("MustDeclareVars", 1) ; *** SEMINKO ADDED THIS ****** HotKeySet("{F9}", "Mute") ; ***************************** Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count Global Enum $eConsole, $eMultimedia, $eCommunications, $ERole_enum_count Global Const $CLSCTX_INPROC_SERVER = 1 Global Const $E_NOTFOUND = 0x80070490 Global Const $S_OK = 0 Global Const $CLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $IID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $tagIMMDeviceEnumerator = _ "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _ "GetDevice hresult(wstr;ptr*);" & _ "RegisterEndpointNotificationCallback hresult(ptr);" & _ "UnregisterEndpointNotificationCallback hresult(ptr)" Global Const $IID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $tagIMMDevice = _ "Activate hresult(struct*;dword;ptr;ptr*);" & _ "OpenPropertyStore hresult(dword;ptr*);" & _ "GetId hresult(wstr*);" & _ "GetState hresult(dword*)" Global Const $IID_IDeviceTopology = "{2A07407E-6497-4A18-9787-32F79BD0D98F}" Global Const $tagIDeviceTopology = "GetConnectorCount hresult(int*);GetConnector hresult(int;ptr*);" & _ "GetSubunitCount hresult(int*);GetSubunit hresult(int;ptr*);GetPartById hresult(int,ptr*);GetDeviceId hresult(ptr*);GetSignalPath hresult(ptr;ptr;bool;ptr*)" Global Const $IID_IConnector = "{9c2c4058-23f5-41de-877a-df3af236a09e}" Global Const $tagIConnector = "GetType hresult(ptr*);GetDataFlow hresult(ptr*);ConnectTo hresult(ptr);Disconnect hresult(none);IsConnected hresult(int*);" & _ "GetConnectedTo hresult(ptr*);GetConnectorIdConnectedTo hresult(wstr*);GetDeviceIdConnectedTo hresult(wstr*)" Global Const $IID_IPart = "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}" Global Const $tagIPart = "GetName hresult(wstr*);GetLocalId hresult(uint*);GetGlobalId hresult(wstr*);GetPartType hresult(ptr);GetSubType hresult(ptr);" & _ "GetControlInterfaceCount hresult(uint*);GetControlInterface hresult(int;ptr*);EnumPartsIncoming hresult(ptr*);EnumPartsOutgoing hresult(ptr*);" & _ "GetTopologyObject hresult(ptr*);Activate hresult(dword;struct*;ptr*);RegisterControlChangeCallback hresult(ptr);UnregisterControlChangeCallback hresult(ptr)" Global Const $IID_IPartsList = "{6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}" Global Const $tagIPartsList = "GetCount hresult(uint*);GetPart hreuslt(uint;ptr*)" Global Const $IID_IAudioMute = "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}" Global Const $tagIAudioMute = "SetMute hresult(bool;ptr);GetMute hresult(int*)" ; *** SEMINKO ADDED THIS ****** While 1 Sleep(250) WEnd ; ***************************** Func MUTE() Local $hr = -1 Local $oMMDeviceEnumerator = ObjCreateInterface($CLSID_MMDeviceEnumerator, $IID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator) If @error Then ConsoleWrite("!Error Creating IMMDeviceEnumerator Interface" & @CRLF) Exit EndIf Local $pDevice = 0 $hr = $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eConsole, $pDevice) If FAILED($hr) Then ConsoleWrite("!Error Getting Default Render Endpoint Device" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $oMMDevice = ObjCreateInterface($pDevice, $IID_IMMDevice, $tagIMMDevice) If @error Then ConsoleWrite("!Error Creating IMMDevice Interface" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $pDeviceTopology = 0 $hr = $oMMDevice.Activate(__uuidof($IID_IDeviceTopology), $CLSCTX_INPROC_SERVER, 0, $pDeviceTopology) If FAILED($hr) Then ConsoleWrite("!Error Getting Device Topology" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $oDeviceTopology = ObjCreateInterface($pDeviceTopology, $IID_IDeviceTopology, $tagIDeviceTopology) If @error Then ConsoleWrite("!Error Creating IDeviceTopology Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $pConnEndpoint = 0 $hr = $oDeviceTopology.GetConnector(0, $pConnEndpoint) If FAILED($hr) Then ConsoleWrite("!Error Getting endpoint Connector" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oIConnector = ObjCreateInterface($pConnEndpoint, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creating IConnector Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pConnDevice = 0 $hr = $oIConnector.GetConnectedTo($pConnDevice) If FAILED($hr) Then ConsoleWrite("!Error GetConnectedTo Device" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oConnDevice = ObjCreateInterface($pConnDevice, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creation oConnDevice(IConnector) Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pPart = 0 $hr = $oConnDevice.QueryInterface($IID_IPart, $pPart) If FAILED($hr) Then ConsoleWrite("!Error Getting Part" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 $oConnDevice = 0 Exit EndIf Local $oIPart = ObjCreateInterface($pPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPart Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf ConsoleWrite(">>>>>>>>>>>>>>>>>BEGIN<<<<<<<<<<<<<<<<<<<<" & @CRLF) GetPart($oIPart) $oIPart = 0 EndFunc Func GetPart(ByRef $oIPart) Local Static $iIndex=0 Local $sPartName = "" Local $PartLocalId = "" Local $hr = -1 ConsoleWrite("+Part" & @CRLF) $hr = $oIPart.GetName($sPartName) If FAILED($hr) Then ConsoleWrite("Not Part Name" & @CRLF) Return $hr EndIf $oIPart.GetLocalId($PartLocalId) If FAILED($hr) Then ConsoleWrite("Not Part ID" & @CRLF) Return $hr EndIf ConsoleWrite(">" & $sPartName) ConsoleWrite(" ID: " & $PartLocalId & @CRLF) If True Then Local $pIAudioMute = 0 Local $bMute = 0 Local $oIAudioMute = 0 $hr = $oIPart.Activate($CLSCTX_INPROC_SERVER, __uuidof($IID_IAudioMute), $pIAudioMute) If SUCCEEDED($hr) Then $iIndex+=1 If SUCCEEDED($hr) And $iIndex=4 Then $iIndex=0 $oIAudioMute = ObjCreateInterface($pIAudioMute, $IID_IAudioMute, $tagIAudioMute) If @error Then ConsoleWrite("!Error Creating IAudioMute Interface") EndIf $hr = $oIAudioMute.GetMute($bMute) If FAILED($hr) Then ConsoleWrite("!Error Getting Mute State" & @CRLF) EndIf $hr = $oIAudioMute.SetMute(Not ($bMute), Null) If SUCCEEDED($hr) Then ConsoleWrite("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!") & @CRLF) TrayTip("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!"), "Danyfirex", 2, 1) Sleep(2000) EndIf EndIf EndIf Local $pIncomingParts = 0 $hr = $oIPart.EnumPartsIncoming($pIncomingParts) If ($hr = $E_NOTFOUND) Then ConsoleWrite("Not incoming Parts in Part" & @CRLF) Return $S_OK EndIf If FAILED($hr) Then ConsoleWrite("!ERROR Enumerating incoming Parts" & @CRLF) Return $hr EndIf Local $oIPartsList = ObjCreateInterface($pIncomingParts, $IID_IPartsList, $tagIPartsList) If @error Then ConsoleWrite("!Error Creating IPartsList Interface") EndIf Local $iNParts = 0 $oIPartsList.GetCount($iNParts) If FAILED($hr) Then ConsoleWrite("Couldn't get count of incoming parts") Return $hr EndIf Local $pIncomingPart = 0 Local $oIPart2 = 0 For $i = 0 To $iNParts - 1 $hr = $oIPartsList.GetPart($i, $pIncomingPart) If (FAILED($hr)) Then ConsoleWrite("Not Got Part" & @CRLF) $oIPartsList = 0 Return $hr EndIf Local $oIPart2 = ObjCreateInterface($pIncomingPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPartsList(2) Interface") $oIPartsList = 0 Return $hr EndIf $hr = GetPart($oIPart2) If FAILED($hr) Then $oIPartsList = 0 $oIPart2 = 0 Return $hr EndIf Next $oIPart2=0 Return $S_OK EndFunc ;==>GetPart Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED Func FAILED($hr) Return ($hr < 0) EndFunc ;==>FAILED EDIT: btw, I was using a hotkey like this in the previous version of the code from four years ago. It worked probably because the mic was being checked by name? In this new script it looks, at least to me, that we check if the name and ID was found, regardless of what those are. Edited July 24, 2018 by Seminko Link to comment Share on other sites More sharing options...
Danyfirex Posted July 25, 2018 Share Posted July 25, 2018 Hello. It's Code work correcly for me. anyway here is a mod. let me know if it works for you. expandcollapse popupOpt("MustDeclareVars", 1) ; *** SEMINKO ADDED THIS ****** HotKeySet("{F9}", "Mute") ; ***************************** Global Enum $eRender, $eCapture, $eAll, $EDataFlow_enum_count Global Enum $eConsole, $eMultimedia, $eCommunications, $ERole_enum_count Global Const $CLSCTX_INPROC_SERVER = 1 Global Const $E_NOTFOUND = 0x80070490 Global Const $S_OK = 0 Global Const $CLSID_MMDeviceEnumerator = "{BCDE0395-E52F-467C-8E3D-C4579291692E}" Global Const $IID_IMMDeviceEnumerator = "{A95664D2-9614-4F35-A746-DE8DB63617E6}" Global Const $tagIMMDeviceEnumerator = _ "EnumAudioEndpoints hresult(int;dword;ptr*);" & _ "GetDefaultAudioEndpoint hresult(int;int;ptr*);" & _ "GetDevice hresult(wstr;ptr*);" & _ "RegisterEndpointNotificationCallback hresult(ptr);" & _ "UnregisterEndpointNotificationCallback hresult(ptr)" Global Const $IID_IMMDevice = "{D666063F-1587-4E43-81F1-B948E807363F}" Global Const $tagIMMDevice = _ "Activate hresult(struct*;dword;ptr;ptr*);" & _ "OpenPropertyStore hresult(dword;ptr*);" & _ "GetId hresult(wstr*);" & _ "GetState hresult(dword*)" Global Const $IID_IDeviceTopology = "{2A07407E-6497-4A18-9787-32F79BD0D98F}" Global Const $tagIDeviceTopology = "GetConnectorCount hresult(int*);GetConnector hresult(int;ptr*);" & _ "GetSubunitCount hresult(int*);GetSubunit hresult(int;ptr*);GetPartById hresult(int,ptr*);GetDeviceId hresult(ptr*);GetSignalPath hresult(ptr;ptr;bool;ptr*)" Global Const $IID_IConnector = "{9c2c4058-23f5-41de-877a-df3af236a09e}" Global Const $tagIConnector = "GetType hresult(ptr*);GetDataFlow hresult(ptr*);ConnectTo hresult(ptr);Disconnect hresult(none);IsConnected hresult(int*);" & _ "GetConnectedTo hresult(ptr*);GetConnectorIdConnectedTo hresult(wstr*);GetDeviceIdConnectedTo hresult(wstr*)" Global Const $IID_IPart = "{AE2DE0E4-5BCA-4F2D-AA46-5D13F8FDB3A9}" Global Const $tagIPart = "GetName hresult(wstr*);GetLocalId hresult(uint*);GetGlobalId hresult(wstr*);GetPartType hresult(ptr);GetSubType hresult(ptr);" & _ "GetControlInterfaceCount hresult(uint*);GetControlInterface hresult(int;ptr*);EnumPartsIncoming hresult(ptr*);EnumPartsOutgoing hresult(ptr*);" & _ "GetTopologyObject hresult(ptr*);Activate hresult(dword;struct*;ptr*);RegisterControlChangeCallback hresult(ptr);UnregisterControlChangeCallback hresult(ptr)" Global Const $IID_IPartsList = "{6DAA848C-5EB0-45CC-AEA5-998A2CDA1FFB}" Global Const $tagIPartsList = "GetCount hresult(uint*);GetPart hreuslt(uint;ptr*)" Global Const $IID_IAudioMute = "{DF45AEEA-B74A-4B6B-AFAD-2366B6AA012E}" Global Const $tagIAudioMute = "SetMute hresult(bool;ptr);GetMute hresult(int*)" ; *** SEMINKO ADDED THIS ****** While 1 Sleep(250) WEnd ; ***************************** Func MUTE() Local $hr = -1 Local $oMMDeviceEnumerator = ObjCreateInterface($CLSID_MMDeviceEnumerator, $IID_IMMDeviceEnumerator, $tagIMMDeviceEnumerator) If @error Then ConsoleWrite("!Error Creating IMMDeviceEnumerator Interface" & @CRLF) Exit EndIf Local $pDevice = 0 $hr = $oMMDeviceEnumerator.GetDefaultAudioEndpoint($eRender, $eConsole, $pDevice) If FAILED($hr) Then ConsoleWrite("!Error Getting Default Render Endpoint Device" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $oMMDevice = ObjCreateInterface($pDevice, $IID_IMMDevice, $tagIMMDevice) If @error Then ConsoleWrite("!Error Creating IMMDevice Interface" & @CRLF) $oMMDeviceEnumerator = 0 Exit EndIf Local $pDeviceTopology = 0 $hr = $oMMDevice.Activate(__uuidof($IID_IDeviceTopology), $CLSCTX_INPROC_SERVER, 0, $pDeviceTopology) If FAILED($hr) Then ConsoleWrite("!Error Getting Device Topology" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $oDeviceTopology = ObjCreateInterface($pDeviceTopology, $IID_IDeviceTopology, $tagIDeviceTopology) If @error Then ConsoleWrite("!Error Creating IDeviceTopology Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 Exit EndIf Local $pConnEndpoint = 0 $hr = $oDeviceTopology.GetConnector(0, $pConnEndpoint) If FAILED($hr) Then ConsoleWrite("!Error Getting endpoint Connector" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oIConnector = ObjCreateInterface($pConnEndpoint, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creating IConnector Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pConnDevice = 0 $hr = $oIConnector.GetConnectedTo($pConnDevice) If FAILED($hr) Then ConsoleWrite("!Error GetConnectedTo Device" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $oConnDevice = ObjCreateInterface($pConnDevice, $IID_IConnector, $tagIConnector) If @error Then ConsoleWrite("!Error Creation oConnDevice(IConnector) Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf Local $pPart = 0 $hr = $oConnDevice.QueryInterface($IID_IPart, $pPart) If FAILED($hr) Then ConsoleWrite("!Error Getting Part" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 $oConnDevice = 0 Exit EndIf Local $oIPart = ObjCreateInterface($pPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPart Interface" & @CRLF) $oMMDeviceEnumerator = 0 $oMMDevice = 0 $oDeviceTopology = 0 Exit EndIf ConsoleWrite(">>>>>>>>>>>>>>>>>BEGIN<<<<<<<<<<<<<<<<<<<<" & @CRLF) GetPart($oIPart) $oIPart = 0 EndFunc ;==>MUTE Func GetPart(ByRef $oIPart) Local Static $bNextIsMute = False Local $sPartName = "" Local $PartLocalId = "" Local $hr = -1 ConsoleWrite("+Part" & @CRLF) $hr = $oIPart.GetName($sPartName) If FAILED($hr) Then ConsoleWrite("Not Part Name" & @CRLF) Return $hr EndIf $oIPart.GetLocalId($PartLocalId) If FAILED($hr) Then ConsoleWrite("Not Part ID" & @CRLF) Return $hr EndIf ConsoleWrite(">" & $sPartName) ConsoleWrite(" ID: " & $PartLocalId & @CRLF) If $bNextIsMute=False Then $bNextIsMute = StringInStr($sPartName, 'Front Pink In') ? True : False EndIf If $bNextIsMute Then Local $pIAudioMute = 0 Local $bMute = 0 Local $oIAudioMute = 0 $hr = $oIPart.Activate($CLSCTX_INPROC_SERVER, __uuidof($IID_IAudioMute), $pIAudioMute) If SUCCEEDED($hr) Then $bNextIsMute = False $oIAudioMute = ObjCreateInterface($pIAudioMute, $IID_IAudioMute, $tagIAudioMute) If @error Then ConsoleWrite("!Error Creating IAudioMute Interface") EndIf $hr = $oIAudioMute.GetMute($bMute) If FAILED($hr) Then ConsoleWrite("!Error Getting Mute State" & @CRLF) EndIf $hr = $oIAudioMute.SetMute(Not ($bMute), Null) If SUCCEEDED($hr) Then ConsoleWrite("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!") & @CRLF) TrayTip("!MUTE: " & (($bMute = False) ? "ON!" : "OFF!"), "Danyfirex", 2, 1) Sleep(2000) EndIf EndIf EndIf Local $pIncomingParts = 0 $hr = $oIPart.EnumPartsIncoming($pIncomingParts) If ($hr = $E_NOTFOUND) Then ConsoleWrite("Not incoming Parts in Part" & @CRLF) Return $S_OK EndIf If FAILED($hr) Then ConsoleWrite("!ERROR Enumerating incoming Parts" & @CRLF) Return $hr EndIf Local $oIPartsList = ObjCreateInterface($pIncomingParts, $IID_IPartsList, $tagIPartsList) If @error Then ConsoleWrite("!Error Creating IPartsList Interface") EndIf Local $iNParts = 0 $oIPartsList.GetCount($iNParts) If FAILED($hr) Then ConsoleWrite("Couldn't get count of incoming parts") Return $hr EndIf Local $pIncomingPart = 0 Local $oIPart2 = 0 For $i = $iNParts - 1 To 0 Step -1 $hr = $oIPartsList.GetPart($i, $pIncomingPart) If (FAILED($hr)) Then ConsoleWrite("Not Got Part" & @CRLF) $oIPartsList = 0 Return $hr EndIf Local $oIPart2 = ObjCreateInterface($pIncomingPart, $IID_IPart, $tagIPart) If @error Then ConsoleWrite("!Error Creating IPartsList(2) Interface") $oIPartsList = 0 Return $hr EndIf $hr = GetPart($oIPart2) If FAILED($hr) Then $oIPartsList = 0 $oIPart2 = 0 Return $hr EndIf Next $oIPart2 = 0 Return $S_OK EndFunc ;==>GetPart Func __uuidof($sGUID) Local $tGUID = DllStructCreate("ulong Data1;ushort Data2;ushort Data3;byte Data4[8]") DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sGUID, "struct*", $tGUID) If @error Then Return SetError(@error, @extended, 0) Return $tGUID EndFunc ;==>__uuidof Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED Func FAILED($hr) Return ($hr < 0) EndFunc ;==>FAILED Saludos Seminko 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now