Entering a name for a note after being created using button

What I’m trying to do

I’ve made a button that creates a new note with a specific template after clicking it and it works great! The only thing is, I would like to be able to enter a name for the note after clicking it (example at 1:41 here and 1:11 here).

Things I have tried

I tried following along with this tutorial : Obsidian - Buttons with Templater - YouTube
During the template creation stage, he shows this code on this screen (he goes over it at 8:22):
const hasTitle = !tp.file.startsWith(“test1”);
let title;
if (!hasTitle) {
title = await tp.system.prompt(“Title”);
await tp.file.rename(title);
} else {
title = tp.file.title;

This code does not seem to work for me. I get an error that “tp.file.startsWith is not a function” in the console. I looked through the documentation for Templater and didn’t see this in there. Is he possibly using some sort of custom script? Is there any other way I can do this?

Thank you so much for your help!

Shouldn’t that be tp.file.title.startsWith()?

And usually unknown file names in Obsidian starts with “Untitled” unless you’ve set the file name to something like “test1” beforehand.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.