OK, I think I have a way to do your think. Try this: Timeline-builder.tbx (108.1 KB)
Add new notes into āEvent-stubā. An OnAdd sets the Event prototype (you can amend that to a prototype of your choice). The Timeline is an agent, query: $Prototype=="Event"
So adding a new note to the āEvent-stubā means it is aliased into the timeline. The Agent also has an action (linebreaks/spaces added for clarity here):
if(!$Placed & $StorySection){
$Container(original) = "/Story/" + $StorySection;
$Placed=true;
}
Iāve 2 user attributes: a String -type StorySection
, and a Boolean Placed
. The point of the latter is to make sure the agent action doesnāt keep re-moving the original to where it already is. But, what if I set StorySection incorrectly, or I wanted to move a note in the story? Correct the noteās $StorySection and un-tick $Placed. The agent action will now fire and move the original from where it was in the story/manuscript to new correct right place. IOW the Boolean acts as both a check for unnecessary code execution and as a reset mechanism.
In the query we test $Placed first as we are only interested in notes that have a place in the story but the original hasnāt yet been moved. Why? Consider the doc when weāve 50 notes with a $StorySection value but 3 notes with that and where $Placed is false. If we test $StorySection first, we match 50, then 3 of 50. But if we reverse the order, we match 3 and then 3 again (53 tests vs 6 tests). In a small doc it matters little. But, youāre writing a story: there will be many events.
If you rename container āStoryā also edit the same in the agent action: see code shown above, as that name is hard-coded (you could parameterise)
I did try and use action code to use the children of \Story
to set the suggested values of StorySection
but no joy. Note: Iāve reported (via email) a bug with the operator (i.e. it reads but wonāt write key values). Meh, that bit was only an āextra creditā polish anyway.
To me, the upside here is the real āoriginalā notes live in the Story (i.e. narrative) part of the doc and we use aliases to move them around. This is the same as your idea but with originals and aliases transposed. Why/ when it comes to export, as Iām sure is a later stage to come, it is easier to work with the originals rather than the aliases (why? ⦠because, experience!)
Anyway, give it a try. note that new events are in the left column when seen in the timeline view (try the other ta in the doc). You donāt need to set a date to move the note into the story. In the Timeline view try selecting āsome eventā in the left sidebar and setting a $StorySection value of āChapter 3ā. Seeāin outline viewāthe original move from āEvent-stubā to āChapter 3ā.
Next select āanother eventā in the Timeline sidebar and give it a start date. See the alias move out of the sidebar into the timeline. (Re-)select the note and set $StorySection to āChapter 4ā. Again, see that the original is moved. Notice how the action adds a now child container āChapter 4ā to /Story
. A nice neat affordance of setting the $Container path to a location not currently existing - the missing parts of the path are created for you.