Sign in to follow this  
Followers 0
kcvinu

How to click the menu item in tray icon

4 posts in this topic

Hi all,

I have searched this forum and found a function named "Get_Systray_Index()" written by Melba23. It is working very good. It can right click on my particular tray icon. But how can select a particular menu item from it. See the attached image. I have tried Send("K") and Send("k") and Send("{DOWN}{ENTER}"). But none of them is working. I don't want to use a mouseclick function. Because i need to use the same script in my laptop too. So please help. Thanks in advance.

post-89644-0-57064700-1425039300_thumb.j


My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Share this post


Link to post
Share on other sites



The highlightet letters there are kinda senseless since the menu gets closed as soon as I hit the ALT modifier.

Have you tried sending the letter the menu item starts with? That would be M, R, A or E in this case.

1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi 

Radiance, Thank you for the reply. But it is not working. And it's working when i press manualy "K" in my keyboard.

Edited by kcvinu

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

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  
Followers 0

  • Similar Content

    • MattHiggs
      By MattHiggs
      Like stated above, I have never really attempted to create tray icon menus simply due to the fact I find them annoying (if I want to minimize a program, I will click "minimize", but if I want to close it, I don't want it to minimize to task bar and require me to close it there), but thought I should try incorporating them into latest script to at least say that I can use them.  However, I am running into a couple of snags/facts I would like to verify.  1) Since tray icons come with their own "GetMsg" function, I just want to verify that, while the continual paging of the tray menu item would still occur within some kind of loop, can the tray menu item events be declared outside and separate from the GUI events?  eg.
      While 1 $tmsg = TrayGetMsg () $nMsg = GUIGetMsg(1) Switch $tmsg Case $TrayMenu Case $settings1 If TrayItemGetState ( $settings1 ) = 65 Then IniWrite ( $path & "\infostore.ini", "Tray Settings", "No Notifications", "$TRAY_CHECKED" ) ElseIf TrayItemGetState ( $settings1 ) = 68 Then IniWrite ( $path & "\infostore.ini", "Tray Settings", "No Notifications", "$TRAY_UNCHECKED" ) Else EndIf Case $settings2 If TrayItemGetState ( $settings2 ) = 65 Then IniWrite ( $path & "\infostore.ini", "Tray Settings", "On top", "$TRAY_CHECKED" ) GUISetStyle ( BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP), $WS_EX_TOPMOST, $Form1_1 ) GUISetStyle ( BitOR($GUI_SS_DEFAULT_GUI, $DS_SETFOREGROUND), $WS_EX_TOPMOST, $Form2 ) GUISetStyle ( -1, $WS_EX_TOPMOST, $Form3 ) GUISetStyle ( BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP), BitOR($WS_EX_OVERLAPPEDWINDOW, $WS_EX_WINDOWEDGE, $WS_EX_TOPMOST), $Form3_1 ) GUISetStyle ( -1, $WS_EX_TOPMOST, $Form4 ) GUISetStyle ( -1, $WS_EX_TOPMOST, $Form5 ) ElseIf TrayItemGetState ( $settings2 ) = 68 Then IniWrite ( $path & "\infostore.ini", "Tray Settings", "On top", "$TRAY_UNCHECKED" ) GUISetStyle ( BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP), 0, $Form1_1 ) GUISetStyle ( $GUI_SS_DEFAULT_GUI, 0, $Form2 ) GUISetStyle ( $GUI_SS_DEFAULT_GUI, 0, $Form3 ) GUISetStyle ( BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP), BitOR($WS_EX_OVERLAPPEDWINDOW, $WS_EX_WINDOWEDGE), $Form3_1 ) GUISetStyle ( $GUI_SS_DEFAULT_GUI, 0, $Form4 ) GUISetStyle ( $GUI_SS_DEFAULT_GUI, 0, $Form5 ) Else EndIf EndSwitch Switch $nMsg[1] Case $Form1_1 Switch $nMsg[0] Case $GUI_EVENT_CLOSE ;ProcessClose ( "pastebutt.exe" ) ;ProcessClose ( "PasteButtonhk.exe" ) Exit EndSwitch EndSwitch Wend My second question also involves the above code, but specifically the "Ini" functions which attempt to read a "tray" state flag from an Ini file.  The following is code located at very beginning of script:
      Const $path = @AppDataDir & "\filler" Opt ( "TrayMenuMode", 1 ) OnAutoItExitRegister ( "refresh" ) $nonote = False $TrayMenu = TrayCreateMenu ( "Settings" ) $settings1 = TrayCreateItem ( "Turn off notifications", $TrayMenu ) TrayItemSetState ( -1, IniRead ( $path & "\infostore.ini", "Tray Settings", "No Notifications", "$TRAY_UNCHECKED" ) ) $settings2 = TrayCreateItem ( "Keep Window on top", $TrayMenu ) TrayItemSetState ( -1, IniRead ( $path & "\infostore.ini", "Tray Settings", "On top", "$TRAY_UNCHECKED" ) ) So the idea is that whenever the user "checks" one of the tray icon menu options, its current "state" will be input into the "ini" file, so that the state of the particular tray menu item will be in the same state as the user left it when the script is launched next.  However, this is not occurring: the ini file contains the "state" flag like it should, but the tray menu item remains unchecked at startup.  Furthermore, the checking or unchecking of "setting1" is not being recognized, as the windows' extended styles do not obtain the "Topmost" flag like they should had it worked.  I get the feeling I'm not getting the "states" of the tray menu items correct.  Any advice?

    • jvds
      By jvds
      is it possible to create a 16x16 gui and use it instead of the tray icon?
      I have seen http://www.desksoft.com/BWMeter.htm does this, it aloes you you place one of the bandwidth graphics in the tray menu instead of its own icon, I don't know if they have a little gui or use a fancy way to draw an icon in real time but it would be nice to have an interactive icon, or a mini gui like icon you can to things with
      any idea how it is done?
       
       
    • PoojaKrishna
      By PoojaKrishna
      Hi friends,
       
      Is there any way to get the text of hidden items in a system tray and to click on the hidden icon?
       
      The following code gets text of all visible items but I want to get the text of the hidden icons too.
       
      Please help. 
       
      Pooja.

      #include <GuiToolBar.au3>   $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then Msgbox(0, "Error", "Couldn't get the Tray handle") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) ;get button count If $iSystray_ButCount = 0 Then Msgbox(0, "Error", "No tray icons") Exit EndIf    ; Look for wanted tooltip $sTrayicons = $iSystray_ButCount & " Tray Icons are: " & @CRLF For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1  $sTrayicons = $sTrayicons & _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber) & @CRLF Next   Msgbox(0, "Tray icons", $sTrayicons)