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:
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!