Create multiple menus from an array Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Ecimeric
Posts: 130
Joined: 11 Jan 2017, 02:23

Create multiple menus from an array

09 May 2021, 20:43

Code: Select all

menuitems.txt:
Submenu1;MenuItemName1
Submenu1;MenuItemName2
Submenu2;MenuItemName

Array := []
Loop, Read, menuitems.txt
	Array.Push(StrSplit(A_LoopReadLine, ";"))
for index, element in Array {
	Menu, % element.1, Add, % element.2, Label
}
Menu, MyMenu, Add, % element.1, :% element.1 ; Wrong syntax
Menu, MyMenu, Show

Label(ItemName, ItemPos) {
    global Array
    return
}
How can I create menus from menuitems.txt, which specifies the menu names and items to populate the menus with?
User avatar
mikeyww
Posts: 26847
Joined: 09 Sep 2014, 18:38

Re: Create multiple menus from an array  Topic is solved

09 May 2021, 20:56

Code: Select all

For index, element in Array {
	Menu, % element.1, Add, % element.2, Label
	Menu, MyMenu, Add, % element.1, % ":" element.1 ; Right syntax
}

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998, mamo691, MrDoge and 244 guests