Here I've added adding more buttons from F1 menu :
Code:
local defstr = table.concat(col_main, " ")..","..table.concat(col_hover, " ")..","..table.concat(col_bg, " ")..",".."0"..",".."a or m"
-- added 4th and 5th options for adding menus (number of menus and menu type)
local retval, retstr = reaper.GetUserInputs("Settings", 5, "Main RGBA (0 255):,Hover RGBA:,BG RGBA (requires a restart):,Add Menus,Menu Type,extrawidth=24", defstr)
if retval then
local col_arr = {string.match(retstr, "([^,]+),([^,]+),([^,]+),([^,]+),([^,]+)")}
col_main = {string.match(col_arr[1], "(%d+)%s+(%d+)%s+(%d+)%s+(%d+)")}
col_hover = {string.match(col_arr[2], "(%d+)%s+(%d+)%s+(%d+)%s+(%d+)")}
col_bg = {string.match(col_arr[3], "(%d+)%s+(%d+)%s+(%d+)%s+(%d+)")}
--- if number of menu is added (differrent than 0)
if string.match(col_arr[4], "(%d+)") ~= "0" then
-- save all entrys ( current open menu , number or menus to add, menu type (action or submen)
new_buttons = {cur_depth, string.match(col_arr[4], "(%d+)"), string.match(col_arr[5],"(%a+)")}
-- to how many buttons were entered
for i = 1 , new_buttons[2] do
-- if new menu is action
if new_buttons[3] == "a" then
-- set action to nil and label is set to "action" + last menu + 1
newA = { act = "" , lbl = "Action "..(#mnu_arr[new_buttons[1]]+ 1) }
-- add new button to existing table
mnu_arr[new_buttons[1]][#mnu_arr[new_buttons[1]]+1] = newA
-- if new menu is menu/submenu
elseif new_buttons[3] == "m" then
-- allow creating submenus only in main menu
if cur_depth == 0 then
-- new menu/submenu
newM = { act = "menu "..(#mnu_arr[new_buttons[1]]+2), lbl = "Menu "..(#mnu_arr[new_buttons[1]]+2) }
-- new action
newA = { act = "" , lbl = "Menu "..(#mnu_arr[new_buttons[1]]+2) }
-- add new menu entry at current menu
mnu_arr[new_buttons[1]][#mnu_arr[new_buttons[1]]+1] = newM
-- add one new action in that menu (so it is not empty)
mnu_arr[#mnu_arr+1] = { [0] = newA }
end
end
end
end
end
It can add actions or menus (menu type "a" for action "m" for menu), menus can be only created if we are in main menu, if in sub menu only actions can be created (it will discare if you enter menu type "m" nothing will happen)