legend Posted December 7, 2017 Share Posted December 7, 2017 (edited) im looking for a way to set a hotkey to a traymenu, the hotkey will open the traymenu. Does anyone know how that can be done? Edited December 7, 2017 by legend Link to comment Share on other sites More sharing options...
SlackerAl Posted December 7, 2017 Share Posted December 7, 2017 Unbelievably ugly, I really hope someone has a nicer method.... Opt("WinSearchChildren", 1) Opt("WinTitleMatchMode", 4) HotKeySet("{F10}", "TrayIconClick") While 1 sleep (100) WEnd Func TrayIconClick() WinActivate("[CLASS:TrayNotifyWnd]") Send("{ENTER}") EndFunc Problem solving step 1: Write a simple, self-contained, running, replicator of your problem. Link to comment Share on other sites More sharing options...
Danp2 Posted December 7, 2017 Share Posted December 7, 2017 Have you reviewed this thread? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
legend Posted December 8, 2017 Author Share Posted December 8, 2017 (edited) 18 hours ago, Danp2 said: Have you reviewed this thread? This one works pretty good, it does what i want, the problem is i'm using a tray menu udf, witch will not work with the following code: #include <Constants.au3> Opt("TrayMenuMode", 1) Opt("WinTitleMatchMode", 4) Global Const $WM_USER = 0x0400 Global Const $MY_WM_NOTIFYICON = $WM_USER + 1 Global Const $WM_LBUTTONDOWN = 0x0201 $aboutItem = TrayCreateItem("About") TrayCreateItem("") $exitItem = TrayCreateItem("Exit") HotKeySet("^!t", "ShowTrayMenu") ; Ctrl + Alt + t While 1 $Msg = TrayGetMsg() Switch $Msg Case $exitItem ExitLoop Case $aboutItem Msgbox(0, "Info", "Just for fun...") EndSwitch WEnd Exit Func ShowTrayMenu() DllCall("user32.dll", "int", "SendMessage", _ "hwnd", WinGetHandle("classname=AutoIt v3"), _ "int", $MY_WM_NOTIFYICON, _ "int", 0, _ "int", $WM_LBUTTONDOWN) EndFunc UDF: I'm having a simple tray menu with icons: #include "ModernMenuRaw.au3" #NoTrayIcon Opt("GUIOnEventMode", 1) Opt("TrayMenuMode", 7) _SetFlashTimeOut(250) $nTrayIcon = _TrayIconCreate("My program", "shell32.dll", -209) _TrayCreateContextMenu() $bUseAdvTrayMenu = False $nExit = _TrayCreateItem('Exit') GUICtrlSetOnEvent(-1, "_Quit") _TrayItemSetIcon(-1, "shell32.dll", -216) _TrayIconSetState() While 1 Sleep(10000) WEnd Func _Quit() _TrayIconDelete($nTrayIcon) Exit EndFunc Edited December 8, 2017 by legend Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now