Tutorial / New Feature: Text Selection Did Change Trigger

Yes, I currently have a ~50-100ms delay for debugging stuff. I'll remove that for the final builds (//edit: removed in v5.124). The preset also has a 50ms show fade in animation, you can disable that if you want. It's in the "Visibility" section of the text-selection menu.

You mean just appending some text to the current clipboard?
Here is a simple JS that would do this:

async (clipboardContentString) => {
   let selectedText = await get_string_variable("BTTTextSelection");
   // this appends with a new line, if you don't need a new line remove the \n
   return clipboardContentString+"\n"+selectedText;
}

To add this as a ready to use item you can copy & paste this json into your menu:

[
  {
    "BTTActionCategory" : 0,
    "BTTLastUpdatedAt" : 1737929914.46645,
    "BTTTriggerType" : 773,
    "BTTTriggerTypeDescription" : "Standard Item",
    "BTTTriggerParentUUID" : "7B9EC08A-8B74-4613-A52C-2F00A7561951",
    "BTTTriggerClass" : "BTTTriggerTypeFloatingMenu",
    "BTTUUID" : "D0D40936-81AE-45D9-95DA-B59FE141B415",
    "BTTPredefinedActionType" : 366,
    "BTTPredefinedActionName" : "Empty Placeholder",
    "BTTAdditionalConfiguration" : "Menu Item: NSLocalizedString",
    "BTTEnabled" : 1,
    "BTTOrder" : 5,
    "BTTTriggerName" : "Menu Item: Append",
    "BTTMenuItemActions" : [
      {
        "BTTActionCategory" : 0,
        "BTTLastUpdatedAt" : 1737929879.330986,
        "BTTTriggerParentUUID" : "D0D40936-81AE-45D9-95DA-B59FE141B415",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeFloatingMenu",
        "BTTUUID" : "FEC5D16C-2398-4DED-B73C-8CD4141BBA6E",
        "BTTPredefinedActionType" : 448,
        "BTTPredefinedActionName" : "Transform Clipboard Contents with Java Script",
        "BTTAdditionalActionData" : {
          "SelectedTransformerTab" : 1,
          "BTTClipboardTransformerJS" : "async (clipboardContentString) => {\n   let selectedText = await get_string_variable(\"BTTTextSelection\");\n   return clipboardContentString+\"\\n\"+selectedText;\n}"
        },
        "BTTGenericActionConfig" : "AppendSelectedText",
        "BTTEnabled" : 1,
        "BTTOrder" : 52,
        "BTTMenuAvailability" : 0,
        "BTTMenuName" : "FEC5D16C-2398-4DED-B73C-8CD4141BBA6E"
      }
    ],
    "BTTMenuConfig" : {
      "BTTMenuItemBorderColorHoverDark" : "255.000000, 255.000000, 255.000000, 255.000000",
      "BTTMenuItemVisibleWhileActive" : 1,
      "BTTMenuItemIconType" : 2,
      "BTTMenuItemBackgroundTypeDark" : 4,
      "BTTMenuItemSFSymbolName" : "",
      "BTTMenuItemBackgroundColor" : "0.000000, 0.000000, 0.000000, 255.000000",
      "BTTMenuCategoryItemVisibility" : 0,
      "BTTMenuCategoryResizeOnHover" : 0,
      "BTTMenuItemBorderWidth" : 1,
      "BTTMenuCategoryOnlyShowIf" : 0,
      "BTTMenuCategoryModifiers" : 0,
      "BTTMenuItemBackgroundColorDark" : "108.442, 96.000, 190.435, 166.991",
      "BTTMenuScriptAlwaysRunOnFirstLoad" : 1,
      "BTTMenuItemMinHeight" : 30,
      "BTTMenuItemBackgroundColorHoverDark" : "90, 90.000, 180, 166.991",
      "BTTMenuCategoryShadow" : 0,
      "BTTMenuItemBorderColor" : "255.000000, 255.000000, 255.000000, 47.264978",
      "BTTMenuCategoryBackground" : 0,
      "BTTMenuCategoryZIndex" : 0,
      "BTTMenuCategoryItemBehavior" : 0,
      "BTTMenuItemSelectedTab" : 0,
      "BTTMenuHoverEndAnimationDuration" : 0.14999999999999999,
      "BTTMenuItemImageHeight" : 15,
      "BTTMenuCategoryItemSpacing" : 0,
      "BTTMenuItemScriptActive" : 1,
      "BTTMenuItemBlurredBackground" : 1,
      "BTTMenuItemIconPosition" : 0,
      "BTTMenuItemBackgroundType" : 4,
      "BTTMenuItemBorderColorDark" : "255.000000, 255.000000, 255.000000, 255.000000",
      "BTTMenuItemBackgroundColorHover" : "212.086655, 90.000000, 180.000000, 166.990997",
      "BTTMenuCategoryMenuVisibility" : 0,
      "BTTMenuScriptAlwaysRunOnAppear" : 1,
      "BTTMenuItemVisibleWhileInactive" : 1,
      "BTTMenuItemAnimateHover" : 1,
      "BTTMenuCategoryBorder" : 1,
      "BTTMenuItemMaxHeight" : 30,
      "BTTMenuAttributedText" : "{\\rtf1\\ansi\\ansicpg1252\\cocoartf2821\n\\cocoatextscaling0\\cocoaplatform0{\\fonttbl\\f0\\fnil\\fcharset0 HelveticaNeue;}\n{\\colortbl;\\red255\\green255\\blue255;\\red255\\green255\\blue255;}\n{\\*\\expandedcolortbl;;\\cssrgb\\c100000\\c100000\\c100000;}\n\\deftab720\n\\pard\\pardeftab720\\qc\\partightenfactor0\n\n\\f0\\fs44 \\cf2 \\expnd0\\expndtw0\\kerning0\nAppend}",
      "BTTMenuModifierMode" : 3,
      "BTTMenuHoverStartAnimationDuration" : 0.14999999999999999,
      "BTTMenuItemMinWidth" : 30,
      "BTTMenuItemMaxWidth" : 30,
      "BTTMenuTextMinimumScaleFactor" : 0.29999999999999999,
      "BTTMenuCategoryItemSizing" : 0,
      "BTTMenuAppearanceStyle" : 0,
      "BTTMenuItemBorderColorHover" : "255.000000, 255.000000, 255.000000, 170.952116",
      "BTTLastChangeUUID" : "FC0D0B65-D608-43DA-A803-4CBD103CB5D2",
      "BTTMenuCategorySpacing" : 0,
      "BTTMenuElementIdentifier" : "Append",
      "BTTMenuCategoryPosition" : 0,
      "BTTMenuItemIconColor1" : "255.000000, 255.000000, 255.000000, 255.000000",
      "BTTMenuAlwaysUseLightMode" : 1,
      "BTTMenuCategoryItemIcon" : 0,
      "BTTMenuCategorySize" : 0
    },
    "BTTMenuAvailability" : 0,
    "BTTMenuName" : "Append",
    "BTTGestureNotes" : "Standard Item"
  }
]
3 Likes