Jump to content

Handling tray items


Recommended Posts

Hello all,

I wonder if someone has posted an example of how to handle tray items of external programs.

What I need is to find if a particular tray icon exists, right click it, find a menu option and if enabled to click so as to disable it.

Any guidance if more than accepted.

Thank you,

Link to comment
Share on other sites

Hello all,

I wonder if someone has posted an example of how to handle tray items of external programs.

What I need is to find if a particular tray icon exists, right click it, find a menu option and if enabled to click so as to disable it.

Any guidance if more than accepted.

Thank you,

Here's a quick script that opens up the Volume control:

#include <A3LMenu.au3>
#include <A3LToolbar.au3>

Opt("WinTitleMatchMode", 4)

$hWnd   = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area")
$iCount = _Toolbar_ButtonCount($hwnd)

for $iI = 1 to $iCount
  $iCommand = _Toolbar_IndexToCommand($hWnd, $iI)
  $sText    = _Toolbar_GetButtonText ($hWnd, $iCommand)
  if $sText = "Volume" then
    if ControlGetHandle("classname=Shell_TrayWnd", "", "Button2") <> 0 then
      ControlClick("classname=Shell_TrayWnd", "", "Button2")
    endif
    _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1, True)
    _Menu_ClickPopupAccel("O")
    ExitLoop
  endif
next
Edited by PaulIA
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Hello all,

I wonder if someone has posted an example of how to handle tray items of external programs.

What I need is to find if a particular tray icon exists, right click it, find a menu option and if enabled to click so as to disable it.

Any guidance if more than accepted.

Thank you,

There is a UDF called SysTray_UDF.au3.

I have heard others say that these are now included in AutoIt, but I don't think that's true. There are Tray* functions now, but I don't see the equivelent of _SysTrayIconTitles(), _SysTrayIconProcesses(), and _SysTrayIconPids(), which will list all the tray icons on your system.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Here's a quick script that opens up the Volume control:

#include <A3LMenu.au3>
#include <A3LToolbar.au3>

Opt("WinTitleMatchMode", 4)

$hWnd   = ControlGetHandle("classname=Shell_TrayWnd", "", "Notification Area")
$iCount = _Toolbar_ButtonCount($hwnd)

for $iI = 1 to $iCount
  $iCommand = _Toolbar_IndexToCommand($hWnd, $iI)
  $sText    = _Toolbar_GetButtonText ($hWnd, $iCommand)
  if $sText = "Volume" then
    if ControlGetHandle("classname=Shell_TrayWnd", "", "Button2") <> 0 then
      ControlClick("classname=Shell_TrayWnd", "", "Button2")
    endif
    _Toolbar_ClickButton($hWnd, $iCommand, "right", False, 1, 1, True)
    _Menu_ClickPopupAccel("O")
    ExitLoop
  endif
next
Thanks. Although it didn't work for me (I suspect because I have GR Windows) I will give it a try.
Link to comment
Share on other sites

Thanks. Although it didn't work for me (I suspect because I have GR Windows) I will give it a try.

I imagine that "Volume" may be spelled different. :) Other than that, the API should be universal.
Auto3Lib: A library of over 1200 functions for AutoIt
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...