Airdrop Shortcut

I was trying to do this using trigger context menu, but it is not working, it opens share option, but doesn't click on AirDrop

Did it fix the issue?

Here's an alternative implementation. You could create an item in a "Custom Finder Context Menu" that runs a shell command that references the currently selected Finder item. Link to the docs:

Specifically, the shell command would be /opt/homebrew/bin/airdrop "{BTTFinderContextMenuSelectedItemPaths}". Here's the full configuration that you can copy and paste into BTT:

[
  {
    "BTTLastUpdatedAt" : 1757545281.20538,
    "BTTTriggerType" : 791,
    "BTTTriggerTypeDescriptionReadOnly" : "Custom Finder Context Menu Items",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTUUID" : "14F8E1EA-2DF4-4DAD-88A1-48C923554256",
    "BTTFinderExtensionData" : "W3siQlRUTGFzdFVwZGF0ZWRBdCI6MTc1NzU5NDE3Mi41NjA5MTQsIkJUVFRyaWdnZXJUeXBlIjo3MTYsIkJUVFRyaWdnZXJUeXBlRGVzY3JpcHRpb24iOiJBaXJEcm9wIiwiQlRUVHJpZ2dlclBhcmVudFVVSUQiOiIzRENGRDYyQy03NjhFLTQ3MjgtQjhCQi02NTE0RjRCREI3RDAiLCJCVFRUcmlnZ2VyQ2xhc3MiOiJCVFRUcmlnZ2VyVHlwZUN1c3RvbUFjdGlvbkNvbmZpZyIsIkJUVFVVSUQiOiI4MUYxNDAwRC05NTY4LTRFQkItQTlGRC03MUI3RDlBQUE4N0QiLCJCVFRPcmRlciI6MiwiQlRUQWN0aW9uc1RvRXhlY3V0ZSI6W3siQlRUTGFzdFVwZGF0ZWRBdCI6MTc1NzU5NDAzNy45NzM5MDUxLCJCVFRUcmlnZ2VyUGFyZW50VVVJRCI6IjgxRjE0MDBELTk1NjgtNEVCQi1BOUZELTcxQjdEOUFBQTg3RCIsIkJUVElzUHVyZUFjdGlvbiI6dHJ1ZSwiQlRUVHJpZ2dlckNsYXNzIjoiQlRUVHJpZ2dlclR5cGVDdXN0b21BY3Rpb25Db25maWciLCJCVFRVVUlEIjoiMjBBQUM3NEEtRjgzOC00RDlCLTk5OUUtNEYxNjIzNDM5OEQ2IiwiQlRUUHJlZGVmaW5lZEFjdGlvblR5cGUiOjIwNiwiQlRUUHJlZGVmaW5lZEFjdGlvbk5hbWUiOiJFeGVjdXRlIFNoZWxsIFNjcmlwdCAgb3IgIFRhc2siLCJCVFRTaGVsbFRhc2tBY3Rpb25TY3JpcHQiOiJcL29wdFwvaG9tZWJyZXdcL2JpblwvYWlyZHJvcCBcIntCVFRGaW5kZXJDb250ZXh0TWVudVNlbGVjdGVkSXRlbVBhdGhzfVwiIiwiQlRUU2hlbGxUYXNrSWRlbnRpZmllciI6InJ1bl9haXJkcm9wIiwiQlRUU2hlbGxUYXNrQWN0aW9uQ29uZmlnIjoiXC9iaW5cL2Jhc2g6OjotYzo6Oi06OjoiLCJCVFRPcmRlciI6Mn1dLCJCVFRDdXN0b21Db250ZXh0TWVudUl0ZW1Db25maWciOnsiQlRUQ3VzdG9tQ29udGV4dE1lbnVJY29uSGVpZ2h0IjoyNSwiQlRUQ3VzdG9tQ29udGV4dE1lbnVJY29uV2lkdGgiOjI1LCJCVFRDdXN0b21Db250ZXh0TWVudUl0ZW1OYW1lIjoiQWlyRHJvcCJ9LCJCVFRBZGRpdGlvbmFsRGF0YSI6ImV5SkNWRlJEZFhOMGIyMURiMjUwWlhoMFRXVnVkVWxqYjI1SVpXbG5hSFFpT2pJMUxDSkNWRlJEZFhOMGIyMURiMjUwWlhoMFRXVnVkVWxqYjI1WGFXUjBhQ0k2TWpVc0lrSlVWRU4xYzNSdmJVTnZiblJsZUhSTlpXNTFTWFJsYlU1aGJXVWlPaUpCYVhKRWNtOXdJbjA9In1d",
    "BTTOrder" : 6,
    "BTTAdditionalActions" : [
      {
        "BTTLastUpdatedAt" : 1757594627.051553,
        "BTTTriggerParentUUID" : "14F8E1EA-2DF4-4DAD-88A1-48C923554256",
        "BTTIsPureAction" : true,
        "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
        "BTTUUID" : "3DCFD62C-768E-4728-B8BB-6514F4BDB7D0",
        "BTTPredefinedActionType" : 327,
        "BTTPredefinedActionName" : "Show Custom Context Menu (NEW)",
        "BTTOrder" : 530,
        "BTTActionsToExecute" : [
          {
            "BTTLastUpdatedAt" : 1757594172.560914,
            "BTTTriggerType" : 716,
            "BTTTriggerTypeDescription" : "AirDrop",
            "BTTTriggerParentUUID" : "3DCFD62C-768E-4728-B8BB-6514F4BDB7D0",
            "BTTTriggerClass" : "BTTTriggerTypeCustomActionConfig",
            "BTTUUID" : "81F1400D-9568-4EBB-A9FD-71B7D9AAA87D",
            "BTTOrder" : 2,
            "BTTActionsToExecute" : [
              {
                "BTTLastUpdatedAt" : 1757594037.9739051,
                "BTTTriggerParentUUID" : "81F1400D-9568-4EBB-A9FD-71B7D9AAA87D",
                "BTTIsPureAction" : true,
                "BTTTriggerClass" : "BTTTriggerTypeCustomActionConfig",
                "BTTUUID" : "20AAC74A-F838-4D9B-999E-4F16234398D6",
                "BTTPredefinedActionType" : 206,
                "BTTPredefinedActionName" : "Execute Shell Script  or  Task",
                "BTTShellTaskActionScript" : "\/opt\/homebrew\/bin\/airdrop \"{BTTFinderContextMenuSelectedItemPaths}\"",
                "BTTShellTaskIdentifier" : "run_airdrop",
                "BTTShellTaskActionConfig" : "\/bin\/bash:::-c:::-:::",
                "BTTOrder" : 2
              }
            ],
            "BTTCustomContextMenuItemConfig" : {
              "BTTCustomContextMenuIconHeight" : 25,
              "BTTCustomContextMenuIconWidth" : 25,
              "BTTCustomContextMenuItemName" : "AirDrop"
            },
            "BTTAdditionalData" : "eyJCVFRDdXN0b21Db250ZXh0TWVudUljb25IZWlnaHQiOjI1LCJCVFRDdXN0b21Db250ZXh0TWVudUljb25XaWR0aCI6MjUsIkJUVEN1c3RvbUNvbnRleHRNZW51SXRlbU5hbWUiOiJBaXJEcm9wIn0="
          }
        ]
      }
    ]
  }
]

I don't know. I haven't been able to replicate the box.

Thanks

Yes...it did

wow, we can edit context menu like that?

so cool...

I modified you script a bit

async function someJavaScriptFunction() {
  // First try to get selected items from Finder
  let cfg_finder = {
    script: `osascript -e 'tell application "Finder" to set selectedItems to selection as alias list
    if selectedItems is {} then
      return "NO_SELECTION"
    else
      set output to ""
      repeat with i in selectedItems
        set output to output & (POSIX path of i) & "\n"
      end repeat
      return output
    end if'`,
    launchPath: "/bin/bash",
    parameters: "-c",
  };
  
  let finder_result = await runShellScript(cfg_finder);
  
  // If Finder has a selection, use it
  if (finder_result && finder_result.trim() !== "NO_SELECTION") {
    let selected_paths = finder_result.trim().split("\n").filter(path => path);
    
    // Use the first selected item or all if needed
    let path_to_use = selected_paths[0]; // Or join multiple paths if your airdrop script can handle it
    
    let cfg = {
      script: `/opt/homebrew/bin/airdrop "${path_to_use}"`,
      launchPath: "/bin/bash",
      parameters: "-c",
    };
    let result = await runShellScript(cfg);
    return result;
  } 
  // Otherwise use clipboard content
  else {
    let path_or_url = await get_clipboard_content("public.file-url", false);
    
    let cfg = {
      script: `/opt/homebrew/bin/airdrop ${path_or_url}`,
      launchPath: "/bin/bash",
      parameters: "-c",
    };
    let result = await runShellScript(cfg);
    
    return result;
  }
}

I tried to send to a certain device without my prompt, but couldn't do it.
Have you tried to airdrop a file to someone specific without having to click your device in the airdrop window?

I just have one device, where I airdrop.

Currently the airdrop CLI doesn't support pre-specifying the recipient. So I suggest using BTT's "Find/Search Text" or "Find/Search Image" Actions: