Prepend Drafts entry to a Drafts entry with timestamp

Ironically, I’m asking this as the DayOne episode just came out.

I’m thinking of starting a very simple journal. I was thinking of using Drafts 5 to do this. What I would like to do is create a first (main) draft item. Then, at the end of each day, I write a new draft of what I wanted to document and then hit the action button which will give me an option to prepend that draft to my main draft item (the first one I created). With the prepend, I also want it to have a date stamp on it. Ideally, once I hit the action, it does it all and I have no need to click on anything else.

Is this possible? As simple as some actions are, I can’t seem to wrap my head around this scenario.

Thanks,

Paul

Paging the one and only @nahumck

1 Like

As @ismh sent out the Drafts signal, I’ve answered the call.

I get mostly what you’re trying to do, but I wanted to get some clarification first: why use a single draft and then create a new one with the journal entry at the end of the day? I have a lot more to say on the topic, but if you create a journal entry at the start of the day in the format you want, you can always add to that entry throughout the day. Might make it easier. Let me know if that works better for you.

I’m going to write it up now (will take me a little time, but likely this weekend), but I also had a Journal module which I outlined in the Drafts 5 Review on MacStories. You might find something useful there to get you started.

2 Likes

I need something ridiculously easy to do or I won’t do it. It doesn’t get any easier than opening a new draft and just start typing. This is where DayOne fell apart for me. Too many clicks.

I also am happy to just capture at the end of the day instead of throughout the day. If I get to the point where I want to capture throughout the day, then I can always adjust but again, I need something that is super easy to do or I will fail.

I’m happy to learn a better way though. I will check out your journal module shortly.

Thanks,

Paul

The short answer is yes, you can do this, and the bonus good news is that it’s relatively simple.

In short you should:

  • create the original draft (the first entry)
  • create a new action that prepends to that first entry (you’ll want the UUID of that draft)
  • have the content that the action adds be something like [[date]][[draft]]

This is a great first action for you to create if you’re just getting started. If you run into hiccups, we’re all happy to help you sort them out.

1 Like

Thanks so much for this. I will definitely try this out.

@nahumck - Please don’t do anything else on this. I’m going to try this and see how it works for me. If I want more, I may just follow your Journal module writeup.

1 Like

I’m happy to do nothing! :smirk::laughing::rofl:

1 Like

Don’t kid yourself. I just freed you up to work on the next problem I’m sure to have!

1 Like

Ok, I’ve been researching and I’m really baffled. Tried to find an existing action that does something like this but no luck.

I’m having an issue creating the new action. Specifically, I’m not sure what Step Type I use for this.

Can someone shed some light for me? I am all for learning but I’m just not grasping something basic, I think.

did you try to look at this add to list plus action?
If I understood what you’re trying to do it might help, and it explains how to prepend instead of appending.
hope this helps :smile:

1 Like

Certainly.

I think you have two options to explore.

First, you can definitely do this with scripting. (And your script doesn’t need to be anywhere near as complex as the sample action above.)

Second, I haven’t tested it, but you might also be able to do this with a URL step by calling Drafts’ own URL scheme.

I may be able to provide more guidance at some point this weekend.

1 Like

Here’s a basic script that you could customize:

// prepend current draft to existing draft with date info


let d = Draft.find(''); // put the UUID of your draft inside the quotes 

let today = new Date();

d.content = today.toString() + '\n' + draft.content + '\n\n' + d.content;

d.update();
1 Like

And here’s how you’d do that with the URL scheme:

drafts5:///prepend?uuid=[REPLACE BRACKETED TEXT WITH UUID]&text=[[date]]%0A[[draft]]%0A%0A

The %0As are just new line characters. You can omit/adjust/add as you see fit. And you can format the date however you like using either the URL method or the scripting method.

1 Like

Thanks so much for your time and effort. I actually got a trial of ScreenscastsOnline yesterday and was going through their tutorials on Drafts. Between your replies and that, I may have a better clue and a solution!