I managed to do what I wanted, by having 2 scripts :
- 1st : declaring the templates
- 2nd : do all the date math and setting the values for the tags used in the templates
And it seems to work perfectly.
Now here are the details of what I’m trying to build :
I’m a bullet journal fan, so I’m trying to build a personal workflow in Drafts. I’m hoping that it will help others too, so of course I’ll be sharing it in the end.
In my workflow I’m using the daily log, the weekly log and the monthly log.
I’m currently using this action (made by you) to create a new Daily Log or a new Weekly Log based on a template Draft I’m having. But this limits me to only build a Draft for today/tomorrow and this week / next week (I have only these 4 templates).
So, to have something more generic that works in my case, I am currently building an action that can generate a Daily / Weekly / Monthly log based on a date you’re choosing.
Here’s the 'interface":
So, now, based on the date and the button pressed, it will generate a new Draft either for the selected date (a Daily), either for the week containing the selected date (a Weekly) or for the month containing the date (a Monthly).
And, because of this, I have to do some scripting, because using the [[date]]
cannot respond at all my use-cases (or at least that’s what I think).
Here’s an example of my current Daily Log Template :
let templateNewDay = `# [[dateToday]]
→ 🗓 [[dateTodayName]]
→ Weekly Note : [[S[[dateWeekNumber]]]]
→ Future Log : [[FutureLog]]
<< [[[[dateYesterday]]]] | [[[[dateTomorrow]]]] >>
## Today's Tasks
- RAS
## Today's Events
@ RAS
## Tracking
- RAS
## Journal
- RAS`;
So, each type of log is, of course, different. As I’m hoping this will also be useful to other people in the future, I want to allow anyone to simply update these Log Templates and make them in their own way by adding what they’ll need by using the tags that will be available.
It’s still a WIP, but for now these are the tags it will support in the templates :
// Daily
- dateToday
- dateTodayName => customisable by the user
- dateWeekNumber
- dateYesterday
- dateTomorrow
// Weekly
- dateWeekNumber
- dateMonday
- dateSunday
- dateLastWeek
- dateNextWeek
- dateYear
// Monthly
- dateMonth
- dateMonthName => customisable by the user
- dateYear
For now it will only work for Mon-Sun weeks, but it can be easily adapted, in a second time, to also work with Sun-Sat weeks…
I don’t know if I explained well enough, but I know for sure that this will simplify my workflow and, besides, it allows me to code a little bit
Thank you a lot for your message, and I’ll surely be back with other (maybe sometimes stupid) questions.
Oh, and thank you for building Drafts… (-‿-)