Tray submenu , need some help

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
armin889
Posts: 96
Joined: 02 Nov 2021, 15:11

Tray submenu , need some help

Post by armin889 » 05 Dec 2022, 01:07

Hi autohotkey-community
I want to make a Tray menu with submenu

in the code, this part is not working

Code: Select all

FoodOfferedSubmenuID:
MsgBox, Food
return
Anyone knows how to make it work?

Code: Select all

#Persistent

Menu, FoodOfferedSubmenuID, add, Text which says Pizza, PizzaSubroutine
Menu, FoodOfferedSubmenuID, add, Text which says Spaghetti, SpaghettiSubroutine
Menu, Tray, add, Text which says Food offered, :FoodOfferedSubmenuID

return

PizzaSubroutine:
MsgBox, pizza
return

SpaghettiSubroutine:
MsgBox, spaghetti
return

FoodOfferedSubmenuID:
MsgBox, Food
return

User avatar
mikeyww
Posts: 27115
Joined: 09 Sep 2014, 18:38

Re: Tray submenu , need some help

Post by mikeyww » 05 Dec 2022, 07:04

Code: Select all

#Persistent

; Submenu
Menu, FoodOfferedSubmenuID, Add, Text which says Pizza    , PizzaSubroutine
Menu, FoodOfferedSubmenuID, Add, Text which says Spaghetti, SpaghettiSubroutine
Menu, FoodOfferedSubmenuID, Add, Text which says Food     , FoodOfferedSubmenuID

; Main menu
Menu, Tray, Add, Text which says Food offered             , :FoodOfferedSubmenuID

Return

PizzaSubroutine:
MsgBox, pizza
Return

SpaghettiSubroutine:
MsgBox, spaghetti
Return

FoodOfferedSubmenuID:
MsgBox, Food
Return

armin889
Posts: 96
Joined: 02 Nov 2021, 15:11

Re: Tray submenu , need some help

Post by armin889 » 05 Dec 2022, 08:06

Thanks, but I want Food not in submenu I want click on the mainmenu Food, and it should open Msgbox Food

User avatar
mikeyww
Posts: 27115
Joined: 09 Sep 2014, 18:38

Re: Tray submenu , need some help

Post by mikeyww » 05 Dec 2022, 08:30

As you can see, you have a choice of whether your items appear in the main menu or a submenu. You can put your items where you like.

Code: Select all

#Persistent

; Submenu
Menu, sub, Add, Pizza
Menu, sub, Add, Spaghetti

; Main menu
Menu, Tray, Add, Food
Menu, Tray, Add, Specific foods, :sub

Return

Pizza:
MsgBox, Pizza
Return

Spaghetti:
MsgBox, Spaghetti
Return

Food:
MsgBox, Food
Return

armin889
Posts: 96
Joined: 02 Nov 2021, 15:11

Re: Tray submenu , need some help

Post by armin889 » 05 Dec 2022, 09:26

Yes i have understood this, but it's not what I need

I want that this line
Menu, Tray, Add, Specific foods, :sub
open submenu by mouseover and doing "food:" on clicking on it

if I click now on it, nothing happen
SciTE_T53Jqsbdpe.jpg
SciTE_T53Jqsbdpe.jpg (29.93 KiB) Viewed 380 times

User avatar
mikeyww
Posts: 27115
Joined: 09 Sep 2014, 18:38

Re: Tray submenu , need some help

Post by mikeyww » 05 Dec 2022, 09:52

There is no magic here. You are able to move the menus to where you would like them to be.

Code: Select all

#Persistent

; Submenu
Menu, sub, Add, Pizza
Menu, sub, Add, Spaghetti
Menu, sub, Add, Food

; Main menu
Menu, Tray, Add, Specific foods, :sub

Return

Pizza:
MsgBox, Pizza
Return

Spaghetti:
MsgBox, Spaghetti
Return

Food:
MsgBox, Food
Return

armin889
Posts: 96
Joined: 02 Nov 2021, 15:11

Re: Tray submenu , need some help

Post by armin889 » 05 Dec 2022, 10:11

Well I guess I am bad in explaining, so I try it with picture
mspaint_pPBYsKFa6r.jpg
mspaint_pPBYsKFa6r.jpg (24.91 KiB) Viewed 361 times
I want to click on "Specific foods" and it should do something

in your script, click on "Specific foods" does nothing

User avatar
mikeyww
Posts: 27115
Joined: 09 Sep 2014, 18:38

Re: Tray submenu , need some help

Post by mikeyww » 05 Dec 2022, 10:13

The AutoHotkey menu does not work in that way, as far as I know-- you pick whether you want to execute a subroutine or open a submenu-- but you could create a GUI that does what you have described. The forum might also have some "extended menu" scripts, perhaps worth a search. There are some other posts with "menu tricks", so they might be informative. Ideas: viewtopic.php?t=102466.

armin889
Posts: 96
Joined: 02 Nov 2021, 15:11

Re: Tray submenu , need some help

Post by armin889 » 05 Dec 2022, 10:35

I have already searched in google and here in board but not found a solution that worked

User avatar
mikeyww
Posts: 27115
Joined: 09 Sep 2014, 18:38

Re: Tray submenu , need some help

Post by mikeyww » 05 Dec 2022, 10:44

You can grow your own! GUI is versatile.

Post Reply

Return to “Ask for Help (v1)”