Obsidian button plugin open note and move to specific folder

Things I have tried

Using various templater tags but I cannot seem to make it work. I’m new to obsidian and limited code knowledge. I searched the forum but didn’t find anything.

What I’m trying to do

I am using the obsidian button plugin and I have a button that makes a new note and appends the date/time (since I use them for fleeting notes, I needed something to make the button continuously make notes - this was achieved by add seconds to title. If there is a better way, please let me know!

Here is my button code:


```button
name Fleeting Note
type note(Fleeting Note - <%tp.date.now("dddd Do MMMM YYYY-HH.mm.ss") %>) template
action test
templater true

What I’d like to also do is once I click on the button, it creates a new note in a specific folder (say fleeting notes folder). I just cannot figure it out!

Any tips?

I figured it out for now to the best of my limited noob abilities.

I left the button as is, but in the template that it calls, I added the following:

<% tp.file.move("Fleeting Notes/" + tp.file.creation_date("dddd Do MMMM YYYY-HH.mm.ss")) %>

This creates a file with the date time and seconds and moves it to my fleeting notes folder.

Hopefully this helps someone!

That sounds like good solution, especially if you add await in front of the move command.

Regarding why you need to do this in the template as opposed to directly in the button code, I think I read somewhere that there are some issues doing templater stuff within the button code, so it’s much better to do it like this in the actual template.