I am trying to get notes in a document to behave, by default, in a particular way (have a particular set of Attribute Values).
- One simple way would be to have a prototype that is the default proto for new notes.
- Is there a way to specify this? I know that for a container’s immediate children, one can do this via $OnAdd, but is there a document-wide default?
- I also know that one may extend beyond the immediate children by bequething those children the same OnAdd action: if the prototype itself specified an OnAdd action, the children will have it, and thus one could propagate this to all descendants. I want to avoid that since it won’t work for top-level notes and also the OnAdd gets “used up” and if there is additional OnAdd work needed for some notes, I will have to be careful about continuing the inheritance of the default proto there; this is a solution that is fickle and finicky.
- Furthermore, I want this to be the default proto, and if I drag a note into some container, I want to keep the proto of that note if it already has one; $OnAdd will overwrite it without extra logic.
The coding philosophy I am trying to follow in my document is to have something that is not easy to accidentally break. Manual Inheritance setup can go awry in so many ways, and I am looking for a clean way.
- Alternately, is there a way to set attribute default value document-wide? This will address what I am trying to do with some properties set for all notes. I believe this can be done, but I am unsure if this is accessible via AppleScript. Applescript seems to allow me to set the attribute for the document, but not the default attribute value. Could this somehow be exposed?
What I am trying to do
Some words are in order to explain the many queries and requests I have been making on this forum. The way I see it, I am trying to “tame Tinderbox”. TB is a complex beast with many bells-and-whistles. I am trying to create a hygienic TB doc that makes it easy to add some idiosyncratic features using external tools, such as specifying prototype-specific (and thus context-dependent) action suggestions using Alfred, which a user may pick and choose from.
Another feature is to enable programmatic control to adding or updating various kinds of content; one practical use case for this is to keep the prototypes in many files in sync, by showing the user what prototypes can be imported and, if chosen, importing/overwriting these.
I hope to describe (and share) my work later this month.