I have a script which setup a new folder with some templates for new projects. I create the top level folder for the project and then execute the script.
The script should then do the following:
To solve the problem with the sub-folders I tried to call a external script as workaround. The script looks like this:
````
dir=$(dirname "$1")
mkdir $dir/meeting\ notes
```
I can't call directly "mkdir" because the scripting API from QOwnNotes doesn't has a method to get my current folder. Instead I can just usenote.fullNoteFilePath` which gives the path including the filename of the note. Therefore it is a bit hacky at the moment but it works.
Not having a method to get the path of a note also makes it hard to use the method jumpToNoteSubFolder() if I can't hard code the sub-folder.
Therefore I think it would be great if the API would provide following additional calls:
a call tho get the notes current path. Ideally two methods, one to get the full path (similar to "fullNoteFilePath" but without the filename) and one to get the relative path which can then be reused in "jumpToNoteSubFolder()"
a call to create a sub-folder in the current place.
Thank you for your suggestion.
- a call tho get the notes current path. Ideally two methods, one to get the full path (similar to "fullNoteFilePath" but without the filename)
Did you try fullNoteFileDirPath
https://docs.qownnotes.org/en/latest/scripting/classes/#note
and one to get the relative path which can then be reused in "jumpToNoteSubFolder()"
there will be a relativeNoteFileDirPath in 20.3.9
relativeNoteFileDirPath for notes in the scripting enginecreateNewNoteSubFolder for mainWindow in theThere now is a new release, could you please test it and report if it works for you?
Sounds great, I will test it as soon as the debian packages are ready :-)
Tested, everything works as expected... Thanks a lot for the quick implementation! :slightly_smiling_face:
Great, thank you for testing!
Most helpful comment
20.3.9
relativeNoteFileDirPathfor notes in the scripting engineNote scripting documentation
createNewNoteSubFolderformainWindowin thescripting engine that creates a new note subfolder in the current subfolder
Mainwindow scripting documentation