I gave Templater a shot and did cobble something together. This is a first, unpolished stab, but it seems to work.
I installed the Templater plugin and added a file in its directory with the following contents.
The date picker is from I created the date picker with the Templater plugin - #5 by JRyven.
<%*
const template = tp.file.find_tfile("Meeting");
const folder = app.vault.getAbstractFileByPath("Work/Meetings");
const suggestions = new Map()
suggestions.set(
"Today, "+moment().format('ddd MMM, D'),
moment()
)
suggestions.set(
"Tomorrow, "+moment().add(1,'days').format('ddd MMM, D'),
moment().add(1,'days')
)
suggestions.set(
moment().add(2,'days').format('ddd MMM, D'),
moment().add(2,'days')
)
suggestions.set(
moment().add(3,'days').format('ddd MMM, D'),
moment().add(3,'days')
)
suggestions.set(
moment().add(4,'days').format('ddd MMM, D'),
moment().add(4,'days')
)
suggestions.set(
moment().add(5,'days').format('ddd MMM, D'),
moment().add(5,'days')
)
suggestions.set(
"Manual",
null
)
const selection = await tp.system.suggester(
[...suggestions].map(([k, v]) => k !== "Manual" ? k + " (" + v.format("YYYY-MM-DD") + ")" : k),
Array.from(suggestions.values())
)
let fileDate = null
if (!selection) {
inputDate = await tp.system.prompt("Type a date (DD MM? YY?):")
fileDate = moment(inputDate, "DD MM YY")
if (!fileDate.isValid()) {
fileDate = moment()
}
} else {
fileDate = selection
}
const formattedFileDate = fileDate.format("YYYY-MM-DD");
const throwOnCancel = true;
const meetingName = await tp.system.prompt("Meeting name?", "", throwOnCancel);
const filename = `${formattedFileDate} ${meetingName}`;
const openOnCreate = true;
await tp.file.create_new(template, filename, openOnCreate, folder);
%>
Now, I can trigger this template via Templater (I will look for a way to get it as a top-level entry in the cmd+p command picker), it prompts for the date, then prompts for the name, then creates and opens the file.
Among other things I’d like to improve/investigate, I feel uncomfortable with
const template = tp.file.find_tfile("Meeting");
finding my “Meeting” template from my templates (not Templater) folder by just its name.
I want to repeat this is a first, super-unpolished stab.