Copy text to clipboard as note is created

I do all my site visit scheduling work in Obsidian, but I’m trying to streamline things as I copy/paste information from Obsidian to a calendar app.

Currently, I create a work order using Templater and DataviewJS to sort and display text for copying over to the calendar app, but I’d like to have it sequentially copy things to my clipboard, so I can use my clipboard manager to quickly paste multiple things into a new calendar invite (name of event, invitees, address, notes).

For instance.

Is there a plugin or function of Templater (or even a function of Javascript?) that would let me feed in multiple chunks of text to automatically copy to my clipboard sequentially? And then secondarily, a good way to trigger that via Buttons or something after the note has already been created?

I can probably figure out the coding myself, but I’m not sure which plugin is the best to use for this sort of thing.

According to the StackOverflow answer below you could use await navigator.clipboard.writeText(text) to achieve your goal. It’s a lengthy answer, but I tested it and it does work within Obsidian. Not sure how it’ll react to multiple chunks, though…

If combined with buttons you should be able to produce multiple button where each button copies a given section of your text.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.