Templater: Rename note to clipboard text

What I’m trying to do

I use folder based templates and i want to rename a newly created note to the text contained in the clipboard.

Things I have tried

After reading the documentation and searching the forum i tried the following line as the first line in the template:

<% tp.file.rename(tp.system.clipboard()) %>

When i create a new note i get the error message “Template parsing error, aborting. Check console for more information.”. I can’t see any messages in the console at all.

Do i miss something here?
Any help is apreciated a lot!

<% tp.file.rename(await tp.system.clipboard()) -%>

The - before %> is optional.

BTW, the code will use the first content in your clipboard to rename the file, therefore the first content in your clipboard can not contain * < >, etc.


Perfect, thank you!
I’m still not quite sure when await needs to be used and when not, but I don’t seem to be alone in this.

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