Jump to content

Autoit Hide Volume Speakers Systray Icon


osninja
 Share

Recommended Posts

Can someone please help script a way to hide the volume icon in the notification area.

I found the code snipped below which does see all the systray icons correctly but im not knowledgeable enough to adapt it to hide the volume icon.

 

The following example should be "universal"  because it checks ALL existing/valid instances on both hidden and visible icons. So it should be working on all past and future Windows vers unless the class(es) name will change. Note: there are some programs using a no-standard instance, but with my method you can catch those icons as well.
 

expandcollapsepopup
#NoTrayIcon
#include <GuiToolBar.au3>

Local $VisibleIcons
Local $HiddenIcons
Local $Instance

; Find systray handle for "User Promoted Notification Area"
$Instance = 0
While 1
    $Instance = $Instance + 1
    Local $hSysTray_Handle = ControlGetHandle("[Class:Shell_TrayWnd]", "", "[Class:ToolbarWindow32;Instance:" & $Instance & "]")
    If @error Then ExitLoop

    If Not @Compiled Then ConsoleWrite("VISIBLE at Istance #" & $Instance & ":" & @CRLF)

    Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) ; Get vidible systray icon count

    For $iSystray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        $text = _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber)
        If Not @Compiled Then ConsoleWrite($text & @CRLF)
    Next
    If Not @Compiled Then ConsoleWrite(@CRLF)
WEnd

; Find systray handle for "Overflow Notification Area" i.e. hidden icons
$Instance = 0
While 1
    $Instance = $Instance + 1
    Local $hSysTray_Handle_Hidden = ControlGetHandle("[Class:NotifyIconOverflowWindow]", "", "[Class:ToolbarWindow32;Instance:" & $Instance & "]")
    If @error Then ExitLoop

    If Not @Compiled Then ConsoleWrite("HIDDEN at Istance #" & $Instance & ":" & @CRLF)

    $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle_Hidden) ; Get hidden systray icon count

    For $iSystray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        $text = _GUICtrlToolbar_GetButtonText($hSysTray_Handle_Hidden, $iSystray_ButtonNumber)
        If Not @Compiled Then ConsoleWrite($text & @CRLF)
    Next
WEnd

Exit

 

No need to error check or anything just need to hide the volume icon indicator specifically.

Any help is much appreciated thanks.

Link to comment
Share on other sites

I'm trying to understand why you need to hide it. You can control volume with a keystroke so what am I missing here? Are you really trying to prevent someone from changing or muting the volume if the sound playing can be heard by a person?

Edited by Bert
Link to comment
Share on other sites

Link to comment
Share on other sites

its a live pe environment for repair and troubleshooting. Settings are not saved.

So i would like a way to automate the icon state so thats its always hidden when it boots.

Tried a couple registry settings but they dnt appear to affect whether its gets shown or not.

My hope is that maybe using api calls will.

32 bit windows 7 pe 3.0 environment

Link to comment
Share on other sites

looking for a way to use the output from the code snippet above.

 

How do i use the instances it finds and instruct it to hide said instance found

 

for example if i run the script locally to test on my windows 10 machine this is what is shown for my visible volume and wifi icons:

 

VISIBLE at Istance #1:


VISIBLE at Istance #2:

VISIBLE at Istance #3:
Speakers: 74%
8636F4
Internet access

HIDDEN at Istance #1:

Link to comment
Share on other sites

18 minutes ago, osninja said:

its a live pe environment for repair and troubleshooting. Settings are not saved.

Sorry I don't get your requirements.  I have no idea why "repair and troubleshooting" needs volume icon to be hidden.

Good luck on this topic, I won't be able to help you out.

Edited by Nine
Link to comment
Share on other sites

 

Np. Thanks either way.

its simple a matter of preference. I would like the icon to not appear every time i need to boot up the live cd if possible.

Its not stopping anything from working just aesthetically unpleasing to me i guess lol.

 

Link to comment
Share on other sites

There is no audio driver installed. no way to disable the hardware as it never gets detected as an audio device because the pe environment was built without audio support.

It was a pita but i was finally able to accomplish getting rid of the icon by removing stobject.dll from the wim!!!

Thats what controls whether the icon is shown or not regardless of driver hardware or services started.

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...