Sign in to follow this  
Followers 0

Moving the tray menu

3 posts in this topic


A while back I was searching for a way to use a hotkey to bring the tray menu up and move the mouse or focus to it. I was able (with help) to figure that out. I was starting the program via the startup folder. When I used the hotkey, the mouse moved to the tray and I could either use the arrow keys or the mouse to choose which option.

I was playing with some msstyles to change the color scheme etc of my xp rig. I downloaded something call uxtheme multipatcher to be able to edit my own themes. For some reason now when I use my hotkey, it actually moves the tray menu to my mouse cursor, exactly like a context menu would. I love this. If I mess with the original script and run it from scite, or I shut down my program and then run a traymenu script of similar style from scite, it no longer does this. A reboot however seems to cure the problem and it is back to making the tray menu act like a context menu.

This is extremely handy to have working. I have created dynamic tray items based off an .ini file, and unlike a context menu, I can do many autoit functions right from the script.

I will post an example of basically what I am doing, albeit less the .ini and dynamic item creation. Other than that, it is very similar to what I might be doing in my program.

Can anyone explain why this is happening, and possibly how I would go about re-creating this again. I would hate to reformat (which I like to do often) and never see this again.

Thank you.


#Include <GuiToolBar.au3>
Opt("GUIOnEventMode", 1)

$settingsitem = TrayCreateMenu("Settings")
$displayitem = TrayCreateItem("Display", $settingsitem)
$printeritem = TrayCreateItem("Printer", $settingsitem)
$aboutitem = TrayCreateItem("About")
$exititem = TrayCreateItem("Exit")

$end = 1
While $end = 1

Func _trayUP()
    Activate('Autoit - tray_test.au3'); non-compiled
;~  Activate('tray_test.exe'); compiled

Func Activate($taskName)
    AutoItSetOption("WinSearchChildren", 1)
    AutoItSetOption("WinTitleMatchMode", 4)
    $hWnd = WinGetHandle("[TITLE:Notification Area]")
    For $i = 0 To _GUICtrlToolbar_ButtonCount($hWnd) - 1
        If _GUICtrlToolbar_GetButtonText($hWnd,$i) = $taskName Then   
            WinActivate("[TITLE:Notification Area]")
            _GUICtrlToolbar_SetHotItem($hWnd, _GUICtrlToolbar_CommandToIndex($hWnd, $i))

Func _exit()
    $end = 0

Share this post

Link to post
Share on other sites

Thanks Zedna. That was exactly what I was looking for.


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