SOLVED: Splitting a Draft Based On Lines

Hi! I used to use Drafts 4 all the time but am pretty new to Drafts 5. Im super impressed with how this app has evolved and plan to use it as a replacement for virtually everything I use text related.

That said, I don’t know JavaScript! l hope to learn it more soon. But in the mean time, how would you suggest accomplishing this task? It seems like it should be relatively simple but can’t find an example elsewhere.

  1. Split a draft into multiple drafts based on lines
  2. Assign each new draft the same tag.

What I’m trying to do is set up a brainstorming workflow where I essentially type up a draft with a bunch of potential headlines for blog posts on separate lines, then send each headline into my “Blog Post Drafts” workspace with a certain tag.

Thanks I’m advance for your help!

I wasn’t 100% clear one exactly how you wanted to manage the tag situation, so here are a few quick, but similar, actions I’ve put together. hopefully, one will hit the sweet spot

Each action creates a new draft from each line of the current draft with the new draft’s content being set to that line; but empty lines are ignored.

The second action will prompt you to enter a single tag name. This will then be assigned to every new draft created by the split.

The third action uses a predefined tag name set in the Define Template Tag step that you can use (I’ve defaulted it to “post”). That tag is added to each of the new drafts automatically.

The fourth action will ensure that any tags (i.e. not just one) assigned to the current draft are also automatically assigned to every new draft created by the split.

In all cases, the original draft remains untouched, but you could change the action you want to use, setting it to archive or trash the current draft.

Hopefully, one of those is what you were after.

3 Likes

This is awesome! Yes this is exactly what I was looking for. Thanks so much!

1 Like