shawnmstout Posted July 24, 2009 Posted July 24, 2009 i know to create a tray icon menu item its TrayCreateItem("Tools") but how can i make submenu items inside of tools?
BuckMaster Posted July 24, 2009 Posted July 24, 2009 Right out of the help file: #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $settingsitem = TrayCreateMenu("Settings") $displayitem = TrayCreateItem("Display", $settingsitem) $printeritem = TrayCreateItem("Printer", $settingsitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem Msgbox(64,"about:","AutoIt3-Tray-sample") Case $msg = $exititem ExitLoop EndSelect WEnd Exit
shawnmstout Posted July 24, 2009 Author Posted July 24, 2009 (edited) BuckMaster, sorry for wasting your time, i looked after i asked and figured it out, thanks for responding, could you answer me 1 other question i cant seem to find, how can i run a au3 file on a menu click? as you can see im quite new with this, just started programming with it today here is an example of what i was trying to do $diagnostics = TrayCreateMenu("Diagnostics") $memoryStats = TrayCreateItem("Memory Status", $diagnostics) TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $memoryStats run("memorystats.au3") <----this is what im trying to run EndSelect WEnd Exit Edited July 24, 2009 by shawnmstout
sshrum Posted July 25, 2009 Posted July 25, 2009 (edited) use shellexecute (here's a snippet from my code) ShellExecute($sFilename, "", @ScriptDir, "run") Note the "run" action...this is what uses the shell to run (versus edit) the au3. If your PC is already setup to run au3 files when they are 'dbl-clicked' in explorer, the "run" action is not needed...it just forces the issue. Edited July 25, 2009 by sshrum Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot'
shawnmstout Posted July 25, 2009 Author Posted July 25, 2009 wow this is great, now i got all kind of technician tools that automatically download and run, thanks alot
KamilZajaczkowski Posted December 17, 2012 Posted December 17, 2012 (edited) Can we go one level deeper? Menu 1 - Sub menu 1 1 - Sub sub menu 1 1 1 - Sub menu 1 2 Menu 2 - Sub menu 2 1 Is this can be achieved somehow please? Edited December 17, 2012 by KamilZajaczkowski
Moderators Melba23 Posted December 17, 2012 Moderators Posted December 17, 2012 KamilZajaczkowski, You do it like this: Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $mMenu_1 = TrayCreateMenu("Menu 1") $mMenu_1_1 = TrayCreateMenu("Menu 1 1", $mMenu_1) $mMenu_1_1_1 = TrayCreateItem("Menu 1 1 1", $mMenu_1_1) $mMenu_1_2 = TrayCreateItem("Menu 1 2", $mMenu_1) $mMenu_2 = TrayCreateMenu("Menu 2") $mMenu_2_1 = TrayCreateItem("Menu 2 1", $mMenu_2) While 1 Switch TrayGetMsg() Case $mMenu_1_1_1 Msgbox(0, "Menu", "1 1 1") Case $mMenu_1_2 Msgbox(0, "Menu", "1 2") Case $mMenu_2_1 Msgbox(0, "Menu", "2 1") EndSwitch WEnd All clear? M23 Palestinian 1 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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