I wonder if some Templater experts wouldn’t mind casting an eye at this:
I am trying to create some buttons as default at the top of my documents. Simply they would move the current file to a certain existing folder. I am very new at this so using some chat GPT for help. It looks correct, looking at the docs for Templater. Perhaps the issue is the buttons don’t allow execution of the code ?
Any pointers appreciated.
Thanks
A
<%*
function moveFile(folder) {
let currentFilePath = tp.file.path;
let newFilePath = tp.file.folder + "/" + folder + "/" + tp.file.name;
tp.file.move(newFilePath); // Moves the file to the new folder
}
%>
<button onclick="moveFile('Work')">Alan</button>
<button onclick="moveFile('Fun')">Eddie</button>
<button onclick="moveFile('Projects')">Tom</button>
Thank you Paul,
I watched you excellent vid on Meta-Bind and have made buttons across the top of my default document, that essentially folderize the current note.
The buttons add say #workflow and then the Auto Notes mover plugin picks up on that and folderizes the note in the correct place. Personally, it’s exactly what I want.
Thanks again.
ps. that could be a use case for the JS option in Meta-Bind buttons but I don’t really need it with the other plugin doing its job.