Action to select multiple drafts and merge by date

Hi,

I’m looking for a workflow to better tidy up my inbox and copy to Roam Research and was hoping it might be possible to create an action that selects all of the drafts for a given day (today for example) merges them and then copies the resulting draft?
I could then paste it into the Daily Notes in Roam.

Thanks

Jim

1 Like

Yes, it is possible, and you can do this with a script step in an action. Here’s how I’d approach it.

If you use the Draft query function, you can produce a sorted array of drafts from the inbox (order by creation, modified or access date). Then iterate through the array of drafts comparing whichever of the draft’s date properties you use to classify as being a draft “for a given day”. Whenever you get a match to the date part of the property being and your desired date (e.g. today), append the content property of the draft to a variable that at the end of the script you copy to the system clipboard, using the app’s setClipboard function.

That should give you the basic framework. You do need to decide on things like which date property to use, and if you would ever want to allow you to select a date other than today (Drafts’ prompts functionality is what you would need for that). After you have done that it’s then a case of putting together the code.

In case it helps, this acton loops through all drafts and checks the length to identify which are “long’”. There’s a chunk of similarity there in terms of querying for and then processing a set of drafts to find a particular type of match against a draft property.

Hope that helps.

1 Like

@jimw would you mind to share your resulting workflow here? I am currently looking for a similar solution to Transfer my drafts from a given day to the daily page in Roam :slight_smile:

@arothe I would love to, but I gave up!!

There are a few concerns with Roam which made me stick with my existing Evernote workflow (lack of API, and questions over the future pricing/sustainability) so I stopped pursuing it.

If you come up with something could you post back here in case I pick it up again please?

Thanks for the reply @jimw . I agree, Roam is still very young with a lot of open questions. But I must say the value proposition of its core features (linking pages, daily notes, „pulling“ of related notes) is just stunning. So I’ll continue to give it a try nonetheless :slight_smile:

Drafts seems to be an ideal companion app for mobile, so I’ll continue to look for a solution here. Will report back if I come up with a workflow that fits.