Is there a way to create a floating menu that shows the last 5 recent clipboard history Items?

Was wondering if there was a way to create a floating menu that would show the last five recent clipboard items and preview them within the boxes or if there is a completely different solution that would work better.

Thanks in advance

hi @Sam_Younes ,

If you navigate to the "Content Script" setting in the Floating Menu and tick the "Script Enabled" setting, then you could write a script to dynamically populate the items in the Floating Menu. Something like this:

//see https://docs.folivora.ai/docs/1108_simple_format.html
async function retrieveJSON() {

  const result = JSON.parse(await get_items_from_clipboard_manager({
    start: 0, // 0 means start from the most recent item
    numberOfItems: 5, // retrieve the last 5 items
    format: "NSPasteboardTypeString"
  }));

  const items = result.items;
  const contents = items.map((item) => ({title: item.content}));

  return JSON.stringify(contents, null, 2);

}

Here's the configuration that you can copy and paste into BTT:

[
  {
    "BTTLastUpdatedAt" : 1790259085.0090799,
    "BTTTriggerType" : 767,
    "BTTTriggerTypeDescriptionReadOnly" : "Floating Menu",
    "BTTTriggerClass" : "BTTTriggerTypeFloatingMenu",
    "BTTUUID" : "47380327-9C25-4474-A861-86D20401B545",
    "BTTOrder" : 1,
    "BTTTriggerName" : "Floating Menu: no-name-4738032",
    "BTTMenuConfig" : {
      "BTTMenuBackground" : {
        "BTTMenuItemBackgroundColor" : "168.213, 183.731, 225.311, 29.612",
        "BTTMenuItemBackgroundType" : 4,
        "BTTMenuItemBlurredBackground" : 1
      },
      "BTTMenuBorder" : {
        "BTTMenuItemBorderColor" : "0.000, 0.000, 0.000, 0.000",
        "BTTMenuItemBorderColorHover" : "0.000, 0.000, 0.000, 0.000",
        "BTTMenuItemBorderWidth" : 2,
        "BTTMenuItemCornerRadius" : 10
      },
      "BTTMenuElementIdentifier" : "no-name-4738032",
      "BTTMenuGeneric" : {
        "BTTMenuAlwaysUseLightMode" : 1
      },
      "BTTMenuItemPreview" : 1,
      "BTTMenuItemScriptActive" : true,
      "BTTMenuItemSpacing" : {
        "BTTMenuItemPaddingBottom" : 5,
        "BTTMenuItemPaddingLeft" : 10,
        "BTTMenuItemPaddingRight" : 10,
        "BTTMenuItemPaddingTop" : 5
      },
      "BTTMenuItemsUseModifierModes" : false,
      "BTTMenuItemVisibility" : {
        "BTTMenuAvailability" : -1,
        "BTTMenuItemVisibleWhileActive" : 1,
        "BTTMenuItemVisibleWhileInactive" : 1
      },
      "BTTMenuMacroPadShowPageButtons" : 1,
      "BTTMenuMergeGlobalMenuItems" : 1,
      "BTTMenuOpacity" : {
        "BTTMenuOpacityActive" : 1,
        "BTTMenuOpacityInactive" : 1
      },
      "BTTMenuOther" : {
        "BTTMenuWindowLevel" : 3
      },
      "BTTMenuScriptSettings" : {
        "BTTAppleScriptString" : "//see https://docs.folivora.ai/docs/1108_simple_format.html\nasync function retrieveJSON() {\n\n  const result = JSON.parse(await get_items_from_clipboard_manager({\n    start: 0, // 0 means start from the most recent item\n    numberOfItems: 5, // retrieve the last 5 items\n    format: \"NSPasteboardTypeString\"\n  }));\n\n  const items = result.items;\n  const contents = items.map((item) => ({title: item.content}));\n\n  return JSON.stringify(contents, null, 2);\n\n}",
        "BTTAppleScriptUsePath" : false,
        "BTTJavaScriptUseIsolatedContext" : false,
        "BTTScriptFunctionToCall" : "retrieveJSON",
        "BTTScriptLocation" : 0,
        "BTTScriptType" : 3
      },
      "BTTMenuScriptUpdateInterval" : 1,
      "BTTMenuSelectedTab" : 0,
      "BTTMenuShadow" : {
        "BTTMenuItemShadowEnabled" : 0
      },
      "BTTMenuShowIfWindowLevelEqualsEnabled" : 0,
      "BTTMenuSizing" : {
        "BTTMenuFrameHeight" : 300,
        "BTTMenuFrameWidth" : 220,
        "BTTMenuWindowResizable" : 1
      },
      "BTTMenuSpacing" : {
        "BTTMenuHorizontalSpacing" : 5,
        "BTTMenuVerticalSpacing" : 5
      },
      "BTTMenuText" : {
        "BTTMenuTextMinimumScaleFactor" : 0.3
      },
      "BTTMenuUseStyleForSubmenu" : 1,
      "BTTMenuVisibilitySettings" : {
        "BTTMenuCloseAfterAction" : 0
      }
    },
    "BTTMenuAvailability" : 0,
    "BTTMenuName" : "no-name-4738032"
  }
]

Firstly thanks for the help. Second where does the second code go? the bttlastupdateat

You can copy the second code and then navigate to the Floating Menu section in the BTT app and then paste – that will automatically add the Floating Menu I described into BTT.

As a note, the second "code" isn't actually code, it's JSON (JavaScript Object Notation), which is a lightweight, text-based file format used to store and exchange data. In this case, it's storing the aforementioned BTT Floating Menu configuration.