Jump to content

Start in Tray programs


Recommended Posts

There are some programs that start-up in the Windows System Tray (AKA Windows Notification Area) (or has the option to do so). I could not find any way to simulate double-click on the tray icon to perform the default action; or right-click on the tray icon to bring up its menu. Does anyone know how to do this?

I have tried:

1) Getting to it from Task Manager: You can see the program running as active "Process" in the Task Manager, but not as "Application", so there is no way to switch to it from there.

2) Using AutoIt Window Info program to capture information of the tray area. I was able to target the tray area, getting this information, but what can I do with it?

>>>> Window <<<<

Title:

Class: Shell_TrayWnd

Position: 0, 960

Size: 1280, 64

Style: 0x96000000

ExStyle: 0x00000088

Handle: 0x00010070

Thanks in advance for your help.

Link to comment
Share on other sites

Hi Bert,

Maybe the window is hidden? Try see if you can set the state of the window to being shown. :)

Thanks for your reply. However it does not seem that the window is hidden. Actually it does not even exists. I checked this with WinGetState and WinExists functions.

I also tried opening using "Run" with maximize option, but still no avail.

Link to comment
Share on other sites

Wow, I actually found an partial solution at: http://www.autoitscript.com/forum/index.php?showtopic=74129

... I don't know why I couldn't find it earlier. Anyway, the full solution to this is now:

#Include <GuiToolBar.au3>


_ClickTrayButton("name of the button here")

Func _ClickTrayButton($insButtonName)
    Local $iMode = Opt("WinTitleMatchMode", 4)
    Local $hControl = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "[CLASSNN:ToolbarWindow321]")

    Local $iButtons = _GUICtrlToolbar_ButtonCount($hControl)
    
    For $i = 0 To $iButtons
        Local $iCmd = _GUICtrlToolbar_IndexToCommand($hControl, $i)
        
        Local $sButtonName = _GUICtrlToolbar_GetButtonText($hControl, $iCmd)
    ; msgbox(0, "button", $sButtonName)
        If (StringRegExp($sButtonName, $insButtonName, 0)) Then
        ;msgbox(0, "button", "Found " & $insButtonName & " at " & $iCmd & ". Now click")
            _GUICtrlToolbar_ClickButton($hControl, $iCmd, "left", False, 2, 0)  
            ExitLoop
        EndIf
    Next
    Opt("WinTitleMatchMode", $iMode)
EndFunc
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...