# "Appending copy" command appends to clipboard (with separator) instead of replacing it

**URL:** <https://community.folivora.ai/t/appending-copy-command-appends-to-clipboard-with-separator-instead-of-replacing-it/36191>\
**Category:** Feature Requests\
**Tags:** clipboard\
**Created:** [March 13, 2024, 2:21am UTC](https://community.folivora.ai/t/appending-copy-command-appends-to-clipboard-with-separator-instead-of-replacing-it/36191 "2024-03-13T02:21:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin](https://community.folivora.ai/letter_avatar_proxy/v4/letter/c/e19b73/32.png) [@Colin](https://community.folivora.ai/u/Colin)\
**Post date:** [March 13, 2024, 2:21am UTC](https://community.folivora.ai/t/appending-copy-command-appends-to-clipboard-with-separator-instead-of-replacing-it/36191/1 "2024-03-13T02:21:01Z")

</div>

I find I need to copy multiple blocks of text and want them to be all one "paste" when I'm done so I don't have to keep switching between two documents. I'm imagining this command would allow an optional separator to be added to the task.

e.g., Let's say "Appending Copy" has its separator set to: `", "`

I select "foo" and hit regular {copy} then  
select "bar" and invoke {appending\_copy}, and finally  
select "baz" and {appending\_copy}.

The result in the clipboard would be:  
`foo", "bar", "baz`

I can now go to my 2nd document and type  
`"{paste}"`  
to have a finished list  
`"foo", "bar", "baz"`

(suitable for use as, say, elements in a javascript array).

---

<div class="post-metadata">

**Author:** ![sBofAreA](https://community.folivora.ai/letter_avatar_proxy/v4/letter/s/a4c791/32.png) [@sBofAreA](https://community.folivora.ai/u/sBofAreA)\
**Post date:** [December 28, 2024, 7:04am UTC](https://community.folivora.ai/t/appending-copy-command-appends-to-clipboard-with-separator-instead-of-replacing-it/36191/2 "2024-12-28T07:04:48Z")

</div>

The app LaunchBar has this as a built in feature and it is awesome. When you hold Command and double-tap the C button, you hear the sound of a stapler and whatever text is currently highlighted is appended to the clipboard. I've been trying to recreate this in BTT and/ or Keyboard Maestro, but haven't had any luck yet.

---

<div class="post-metadata">

**Author:** ![Frank1](https://community.folivora.ai/letter_avatar_proxy/v4/letter/f/a87d85/32.png) [@Frank1](https://community.folivora.ai/u/Frank1)\
**Post date:** [December 28, 2024, 7:24am UTC](https://community.folivora.ai/t/appending-copy-command-appends-to-clipboard-with-separator-instead-of-replacing-it/36191/3 "2024-12-28T07:24:01Z")

</div>

Not exactly the same, but perhaps still useful.

> [@Copy and Paste Sequentially](https://community.folivora.ai/t/copy-and-paste-sequentially/31699):
>
> I have found two Apple Scrips from "guxianbang" (thank you very much!) that do the following when run from BTT. Explain it to me as if I were 6 years old (I, at least, understood immediately) wink (1) Press Ctrl+C after selecting the first text, press “Ctrl+C after selecting the second text, press Ctrl+C after selecting the third text… (2) After the copy step is completed, pressing Ctrl+V will automatically paste the first text, pressing Ctrl+V again will automatically paste the second text…

---

<div class="post-metadata">

**Author:** ![Andreas\_Hegenberg](https://community.folivora.ai/user_avatar/community.folivora.ai/andreas_hegenberg/32/39221_2.png) [@Andreas\_Hegenberg](https://community.folivora.ai/u/Andreas_Hegenberg)\
**Post date:** [December 28, 2024, 7:35am UTC](https://community.folivora.ai/t/appending-copy-command-appends-to-clipboard-with-separator-instead-of-replacing-it/36191/4 "2024-12-28T07:35:08Z")

</div>

here is a simple script that will append selected text to the current clipboard

```JS
async function appendToClipboard() {
		
    let currentClipboardContent = await get_clipboard_content({});
    let selectedText = await get_string_variable({variable_name:'selected_text'})
    let newClipboardContent = currentClipboardContent + selectedText;
    let result = await set_clipboard_content({content:newClipboardContent, format: 'NSPasteboardTypeString'})

}

```

You can run it via the "Run Real Java Script" action:

 ![image](https://community.folivora.ai/uploads/default/original/3X/0/1/010f7456bdd1aa2668749562b23a8610efa6c838.jpeg)

[append\_to\_clipboard.bttpreset](https://community.folivora.ai/uploads/short-url/gDYSJMgbm4Ry1qp5Ei27o7MHShl.bttpreset) (2.4 KB)

If you want to add e.g. new lines adapt this line:

```auto
    let newClipboardContent = currentClipboardContent + selectedText;

```

```auto
    // with new lines inbetween
    let newClipboardContent = currentClipboardContent + '\n' + selectedText;

    // with three minuses inbetween
    let newClipboardContent = currentClipboardContent + '---' + selectedText;

```
