Things I have tried
What I’m trying to do
Hi everyone,
I just discovered Templater and I try to automate my note taking with a drop down box, and then make decisions based on the selected value.
After searching some templates, I found a few, utilizing the JS script block <%* %>, which I also adopted.
Anyone any idea?
I posted some code below. For testing purpose I always use “Online” in the drop down. Which is why I skipped the code for the other two.
Thanks in advance!
<%*
let FileName = await tp.system.prompt("Meeting name")
titleName = FileName + " " + tp.date.now("YYYY-MM-DD")
await tp.file.rename(titleName)
await tp.file.move("/Meetings/" + titleName);
let myFileType = await tp.system.suggester(["Onsite", "Remote", "Online"], ["Onsite", "Remote", "Online"])
if (myFileType = "Online") {
let Tags="Online";
}
tR += "---"
%>
title: <% FileName %>
date: <% tp.file.creation_date("YYYY-MM-DD HH:mm:ss") %>
tags: Meeting, <% Tags %>
---
# <% qcFileName %>
<% tp.file.cursor() %>
Test output: <% Tags %>
The error message in the console is always “Tags is not defined.”