Jump to content
Sign in to follow this  
erebus

Handling tray items

Recommended Posts

erebus

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,

Share this post


Link to post
Share on other sites
PaulIA

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

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
erebus

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.

Share this post


Link to post
Share on other sites
PaulIA

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

Share this post


Link to post
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
Sign in to follow this  

×