I'm currently working on an option that will allow a menu to retrieve its items dynamically via Apple Script / Shortcut / Java Script. This will make it much easier, but I'm still designing it.
Currently it would already be possible by calling update_trigger scripting function on the menu itself. For example this java script (run via the "Run Real Java Script" action) would set a menu's items (in this example the menu uuid is CF1116FE-F67D-4ADE-B2CB-508404F2155B )
Note: This will just replace any items for a given menu. If you want to add items, you will need to first retrieve them via get_trigger
async function someJavaScriptFunction() {
let newItemDefinition = {"BTTMenuItems" : [
{
"BTTActionCategory" : 0,
"BTTLastUpdatedAt" : 1725529413.994216,
"BTTTriggerType" : 773,
"BTTTriggerTypeDescription" : "Standard Item",
"BTTTriggerClass" : "BTTTriggerTypeFloatingMenu",
"BTTEnabled" : 1,
"BTTOrder" : 0,
"BTTTriggerName" : "Menu Item: no-name-5B39A34",
"BTTMenuConfig" : {
"BTTMenuItemMaxHeight" : 50,
"BTTMenuItemMinWidth" : 100,
"BTTMenuAlwaysUseLightMode" : 1,
"BTTMenuItemBackgroundColorDark" : "108.442, 96.000, 190.435, 166.991",
"BTTMenuElementIdentifier" : "no-name-5B39A34",
"BTTMenuItemBorderColorHover" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuItemVisibleWhileInactive" : 1,
"BTTMenuCategoryBackground" : 1,
"BTTMenuItemBackgroundTypeDark" : 4,
"BTTMenuItemBackgroundType" : 4,
"BTTMenuItemBackgroundColorHoverDark" : "90, 90.000, 180, 166.991",
"BTTMenuItemBorderColorHoverDark" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuCategoryItemSizing" : 1,
"BTTMenuItemBackgroundColor" : "108.442, 96.000, 190.435, 166.991",
"BTTMenuItemBackgroundColorHover" : "90, 90.000, 180, 166.991",
"BTTMenuItemMinHeight" : 50,
"BTTMenuItemBorderColorDark" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuHoverEndAnimationDuration" : 0.14999999999999999,
"BTTMenuItemBorderColor" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuAttributedText" : "<html><body style=\"text-align:center;\"><span style=\"font-size:22px; text-align:center !important; color:white; font-family: -apple-system, BlinkMacSystemFont, sans-serif;\">New Item 1<\/span><\/body><\/html>",
"BTTMenuHoverStartAnimationDuration" : 0.14999999999999999,
"BTTMenuItemMaxWidth" : 200,
"BTTMenuItemVisibleWhileActive" : 1,
"BTTMenuItemIconColor1" : "255.000000, 255.000000, 255.000000, 255.000000"
},
"BTTMenuAvailability" : 0,
"BTTMenuName" : "no-name-5B39A34",
"BTTGestureNotes" : "Standard Item"
}, {
"BTTActionCategory" : 0,
"BTTLastUpdatedAt" : 1725529413.994216,
"BTTTriggerType" : 773,
"BTTTriggerTypeDescription" : "Standard Item",
"BTTTriggerClass" : "BTTTriggerTypeFloatingMenu",
"BTTEnabled" : 1,
"BTTOrder" : 0,
"BTTTriggerName" : "Menu Item: no-name-5B39A34",
"BTTMenuConfig" : {
"BTTMenuItemMaxHeight" : 50,
"BTTMenuItemMinWidth" : 100,
"BTTMenuAlwaysUseLightMode" : 1,
"BTTMenuItemBackgroundColorDark" : "108.442, 96.000, 190.435, 166.991",
"BTTMenuElementIdentifier" : "no-name-5B39A34",
"BTTMenuItemBorderColorHover" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuItemVisibleWhileInactive" : 1,
"BTTMenuCategoryBackground" : 1,
"BTTMenuItemBackgroundTypeDark" : 4,
"BTTMenuItemBackgroundType" : 4,
"BTTMenuItemBackgroundColorHoverDark" : "90, 90.000, 180, 166.991",
"BTTMenuItemBorderColorHoverDark" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuCategoryItemSizing" : 1,
"BTTMenuItemBackgroundColor" : "108.442, 96.000, 190.435, 166.991",
"BTTMenuItemBackgroundColorHover" : "90, 90.000, 180, 166.991",
"BTTMenuItemMinHeight" : 50,
"BTTMenuItemBorderColorDark" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuHoverEndAnimationDuration" : 0.14999999999999999,
"BTTMenuItemBorderColor" : "255.000000, 255.000000, 255.000000, 255.000000",
"BTTMenuAttributedText" : "<html><body style=\"text-align:center;\"><span style=\"font-size:22px; text-align:center !important; color:white; font-family: -apple-system, BlinkMacSystemFont, sans-serif;\">New Item 2<\/span><\/body><\/html>",
"BTTMenuHoverStartAnimationDuration" : 0.14999999999999999,
"BTTMenuItemMaxWidth" : 200,
"BTTMenuItemVisibleWhileActive" : 1,
"BTTMenuItemIconColor1" : "255.000000, 255.000000, 255.000000, 255.000000"
},
"BTTMenuAvailability" : 0,
"BTTMenuName" : "no-name-5B39A34",
"BTTGestureNotes" : "Standard Item"
}
]};
await update_trigger({"uuid": "CF1116FE-F67D-4ADE-B2CB-508404F2155B", "json": JSON.stringify(newItemDefinition)})
return "done";
}