I want to create through action code a note that is the sibling (i.e. on the same level) as the note from which the action code runs. But I am a bit at a loss how to do it.
Say I have a note that is at /Root/container1/container2/note_in_question.
I know that the intrinsic variable $Path holds the path of the note including its name. So my idea is that all I need is the path without the note’s name (let’s call that $RestPath), for then I can create the new note as $RestPath + $NewNoteName.
But how do I get $RestPath? One way I tried is to split $Path:
$MyString=$Path.split("/");
This gives me the elements of the path in $MyString, separated by semicolons.
Then I could assemble the new path through
$MyPath="/" + $MyString.first + "/Draft";
But this obviously works only one level “down” - if the note is further down, I don’t know how to do it. And that’s why I would be grateful for any input and ideas!
Many thanks - this sounds like a very good way to try.
Thanks for lending me a hand in the code jungle that much of this still is for me. While I can understand most of what others write with the help of things like aTBRef, it is much more difficult to come up with solutions myself, I realise.