First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.
What I’m trying to do
- prompt to input a name of the note
- create a folder using the input text
- prompts to choose from lists and use them as meta
- combine a name for another file under the created folder
- create another file using the combined name under the created folder
- move this note to the created folder (with MAKE.md this note under the same name folder will be rendered as the folder note instead of a plain note)
Things I have tried
<%*
let PJname = tp.file.title;
if (PJname.startsWith(“Untitled”)) {
PJname = await tp.system.prompt(“Title of the Note:”, throw_on_cancel = true);
await tp.file.rename(PJname);
}
let PJFolderName = “01 Projects/” + PJname;
await this.app.vault.createFolder(PJFolderName);
let PJFolder = app.vault.getAbstractFileByPath(PJFolderName);
let PJstatus = await tp.system.suggester(item => item,[“ not started”, “
in progress”, “
done”], [“
not started”, “
in progress”, “
done”], "Status: ");
let PJtype = await tp.system.suggester(item => item,[“personal”, “work”], [“personal”, “work”], "Type: ");
let PJpriority = await tp.system.suggester(item => item,[“ high”, “
mid”, “
low”, “
Urgent”], [“
high”, “
mid”, “
low”, “
urgent”], "Priority: ");
let kanbanFileName = PJname + “_Kanban”;
await tp.file.create_new(tp.file.find_tfile(“03 Resources/Project Kanban”), kanbanFileName, false, PJFolder);
await tp.file.move(PJFolder, tp.file.title);
-%>
Result: The “path” argument must be of type string. Received undefined
Why the PJFolder can be used to create another file but can not be used as the path to move the file to?