Jump to content
Sign in to follow this  

Tray menu activation

Recommended Posts


Good evening (or at least it is here!),

I would be grateful for some help regarding a problem I am having with the tray menu. As a relative newcomer to AutoIt, I have recently been writing a script to act as a wrapper for Random Mp3 Player, a simple mp3 player which does not display the ID3 info from the file being played. Thanks to the excellent help file and this BB I have managed to solve the various problems I have so far encountered (some the most complicated were; getting the ID3 tag data, having different icons on the taskbar depending on the state of the script, hiding the RandomPlayer icon on the taskbar). I have now created a satisfactory script to display the ID3 info, and even managed to duplicate most of the functions of the original application, but one thing is causing me a real headache.

RandomPlayer lets you adjust the volume in 2 ways: by pressing the right/left mouse button on its tray icon with shift selected, and by using "Vol Up/Down" submenu entries on its traymenu. I have duplicated the tray icon click by finding the RandomPlayer icon (via ControlGetHandle, _GUICtrlToolbar_ButtonCount and _GUICtrlToolbar_GetButtonText) and using _GUICtrlToolbar_ClickButton. However, when I tried to put volume up/down items on the traymenu in the AutoIt script, I ran into a problem I have been unable to solve.

When selecting these entries on the original RandPlayer traymenu, the volume is adjusted as long as the left button is pressed on the entry, which remains visible as long as the button is pressed. I cannot find anything in Help or on this BB which lets me do the same with the AutoIt generated traymenu. This only appears to action events once the mouse button is released, at which point the traymenu disappears! The best I have managed is to do so far is to generate a single click on the RandomPlayer icon with each menu selection, which means that it requires multiple "right-click on the icon to get the traymenu and then click on the menu item" actions to adjust the volume. Not exactly the smooth continuous action I am looking for!

Is there any way to duplicate the action of the RandomPlayer application in AutoIt? That is to have a traymenu item which acts for as long as it is selected? I have played about with _IsPressed, but of course the mouse button is already released to activate the menu item. I tried changing from Tray OnEvent to TrayGetMessage, but I still came across the problem of having to release the mouse to activate the menu item.

So, any offers?


P.S. I know that I can get another player which would display the ID3 data for me, I am just using this project to explore the possibilites of AutoIt - which are very impressive!

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


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