What I’m trying to do
I would like a template that creates a dropdown box via tp.system.suggester, and the selected result becomes basis for defining new variables.
For example, in the code I tried, the dropdown box has two options for constant “notetype”. If user picks option “experimental”, this should trigger defining another constant, called “title”.
I can then use that new constant to set title and folder.
Things I have tried
<%*
const notetype = await tp.system.suggester([“experimental”, “article”], [“experimental”, “article”]);if (notetype === “experimental”) {
let title = “expfolder”
}
await tp.file.rename(${titlefront + titleback}
)
%>
This doesn’t work. I get the dropdown box, but then “templater parsing error”.
I have a script that does this in a step-wise way: dropdown box first for file name, then for folder name, then for specific tag. All three are depending on the type of note, so if I could set that type once, and then via script define everything else, it would save couple seconds each time I create a new note.
In the spirit of outsmarting myself, I spent a whole afternoon trying to figure out a script that would save me couple seconds every day.