Hello,
I am wrestling with templater for the last three days, on and off.
I am trying to create a new file, from template:
- Ask for file-name
- create note with said name
- populate it with template content (among which is tf.file.title)
- go to the newly created file
- stay in that file
Steps 1-4 work fine. Prompt opens, templater waits till I submit the prompt, then creates the file with correct name and populates the template successfully.
Step five doesn’t work so well. A second, empty, file called “untitled” is created immediately after, and that file is then opened. I then have to manually delete “untitled” so I don’t amass a million empty untitled’s at the root of my vault.
Optional steps I want to figure out how to do at some point:
- Move file into the folder my current note resides in when I called the templater.
I also cannot test if the tp.file.cursor()
works because the focus is switched to a new file immediately
Source of the template to be filled in:
---
Name:<% tp.file.title %>
Tags:<% await tp.system.prompt("Set Tags, including hashtags and separating spaces") %>
---
[[MOC Player's Handbook|Back to the TOC]]
# <% tp.file.title %>
<% tp.file.cursor() %>
Source of the template i manually invoke by the create-from-template-modal:
<% tp.file.create_new(tp.file.find_tfile(“Template_DND_BookEntry”), await tp.system.prompt(“Set FileName”), true) %>
Any help is greatly appreciated.
Sincerely,
~Gw