I’m creating a tinderbox file for keeping track of todos. I’m quite new to Tinderbox. I have created an agent that has an OnAdd action which sets the prototype and the due date to next friday (just to have something to start from). Then I have adornments that show today’s tasks, this week tasks, and next week’s tasks. However, I’m mostly in Outline view and I wonder how I can create a note as run through the agent action in this view. If that is possible, then I don’t have to go to Map view, root level, create the note and then move it to correct place in Outline view.
It is not entirely clear how you want this to work, and a step-by-step outline of the process would be helpful.
The create()
action is likely going to help your process, along with createAttribute()
.
It is easy to create a new note in Outline view by just pressing enter, but how can the newly created note have the action code of an agent executed from Outline view. I know it can be stamped. Is that the easiest way? Or is it possible to do a key combination when creating the note to have it created in user defined way? Like Shift+Enter or something similar.
Do you have a test file without personal info you could post? The workings of your file are not clear. I assume you are wondering if you can:
- create a note in container
- the container has an OnAdd action that assigns an “event” prototype
- the prototype contains attributes such as due date, etc.
- you manually assign due date etc.
- your agent then moves the note to the relevant adornment
Seeing the file (stripped of personal data) helps with specific advice.
Based on this statement I’m getting the sense that you may be cross-wiring a few concerts, e.g., action code and agents. You do not need agents to run action code. You can trigger an action code from any note’s $OnAdd, $Rule, $Edict, $OnVist, $OnRemove, etc. attributes.
The big question is, what do you want the action to do? For instance,
- assign a prototype
- assign a project or client
- assign an owner
As @PaulWalters suggests, it would be helpful to see your ideal output, and then we can help you define your optimization with action code. This is an excellent topic for a meetup; maybe you could join us this Sunday.
Once you’ve created you tasks, you can use agents to find them, e.g, due today, next week, overdue, etc. (the query code for this is a future topic to address).
Here is an example:
TaskExample.tbx (136.6 KB)
The challenge for us trying to help is you are explaining the end state, not what has to happen.
Most likely it can’t as agent don’t create notes. Rather, they create an alias for every existing note that matches the agent query.
Instead of describing shortcuts and such what outcome are you expecting based on what information/inputs? The question isn’t asked in a rude fashion. We know you want to do something, but it’s not yet clear—in terms we understand from a Tinderbox perspective—what that outcome is.
I think I have mixed the notions which adds to the confusion. I have an adornment, not agent as I wrongly stated, with OnAdd code so if double clicking it a new note with Prototype and DueDate already set will be created. I’m wondering, how creating a new note in Outline view can have the same, or duplicated, OnAdd code run as if it was created by double clicking the adornment. Again, sorry for the confusion. The Today, This week, and Next week filtering is done via agents and the filters work.
You, see the sample file I provided above. I added the $OnAdd in the ToDo Folder to show you how to trigger on $OnAdd from a note, not just an adornment. Ths $OnAdd will trigger anywhere—e.g., map view, outline view—when you add notes to this container. Hopefully, this will help.
Right. Got it. I added a new function to the functions note and call it from the prototype’s OnAdd, which means that when creating a new note, regardless from which view, as long as the current note is of that prototype, the code will be executed and set the values I want. Thanks!
I think you’re getting what you want, but there is a lot of terminology to refine here:
In this context, I think you’re referring to action code, not a function. Function: refers to a specific method for launching action code.
You are calling it from the note’s $OnAdd, not necessarily the prototype. However, more often than not, the note’s $OnAdd is being inherited from the prototype.
Then, to your point, regardless of the view, the note’s $OnAdd will trigger when you add a child note to it.
I’ve found and getting the terminology “right” will have a positive downstream affect as you get deeper into Tinderbox and related apps.
FWIW, I think “function” is a pretty generic programming term. Aren’t functions a feature of action code? “Launching action code” seems like a good description of what causes action code to get executed (e.g., $OnAdd, $OnVisit, etc.)
I agree that it is a generic term. Still, it has a specific execution context in TBX. I choose to consider the capability distinct as action code can be launched/executive without a function.
I agree that it is good to learn terminology in order to express, e.g., questions so that others can understand the context and problem. I’m new to Tinderbox, but work as a developer/programmer. So I have to learn a translation table to how I would have called things to how they are expressed in Tinderbox. Action code I would denote event handler or callback. And an event handler or callback is realized by a sequence of statements which can be grouped as a function. A function can be reused and called from many different places.
Seeing as mis-assumptions about how things work and confusion over terminology here are a few links to documentation that might help:
- Attribute names. Here in the forum and in some general documentation a $-prefix to a names has two purposes:
- In (action) code $Color means “the value of attribute ‘Color’”.
- In general text a $-prefix used either for the above (e.g. in code examples) or to indicate the text refers to an attribute of that name. Thus describing ‘$Color’ in general text likely refers to the system attribute Color that holds a note’s colour value used when drawing that note in the view pane.
- The OnAdd action. Depending on whether an object is a note or an adornment dictates where On Add code is stored:
- the OnAdd system attribute.
- the AgentAction system attribute—the agent’s equivalent of an OnAdd.
- an adornment can have a query, i.e. like an agent does, making it a smart adornment. I the latter case the adornment’s $OnAdd code is used on notes gathered by the smart adornment’s query.
- Tinderbox Action code. Those with formal programming training or used to coding [some] coding language get confused as they assume action code is a full computer language. No! Despite its many capabilities, action code represents 24 years of incremental growth from a method to use Tinderbox export code internally in the app. Action code has since grown and eclipsed much of what export code did. The incremental growth of action code, adding features in response to Tinderbox’s users’ requests, means it may lack features a programmer might expect in a formal coding language. So don’t assume!
- Action code supports user-written functions but be aware these are fairly new (c.2021). So older examples/discussions may not use functions where they otherwise (now) might seem an obvious use.
- Tinderbox is at heart a hypertext tool. A hypertext as simplest is a non-linear collection of (usually textual) notes connected by links. In Tinderbox links have direction (i.e. are one-way) but can be traversed/queried in either direction. Thus:
- Tinderbox Links are not first-class objects. Expecting/wanting them to be so based on experience in other tools/languages is self-defeating as the latter would require some fundamental app architecture change and then just to do a task that might better be done in a app/language actually designed for a task.
- From the latter point, consider doing in Tinderbox what can be done well in Tinderbox. The app has strong import/export capability though this configured by the user precisely because needs vary. No sooner does someone define a template process for using format X than another user chimes in that it doesn’t fit their use of X.
- The Tinderbox community (as found in this forum, and) has been supporting fellow users actively since the app’s inception and has decades of collective experience—all freely available for the price of a polite question. To unlock that expertise, it helps to describe tasks/problems from within a Tinderbox context. What other apps do likely isn’t know to fellow users so gives little helpful context, even if familiar to the person asking for help. Starting by a complaint that Tinderbox isn’t like [some app] may be true but isn’t helpful in trying to resolve a challenge.
- Tinderbox maps may superficially look like a lot of things (mind maps, process flow diagrams, concept logic maps, etc.) but are not those. They are simply a map of the contents of a single container within the document and show (hypertext) links between those items. Though there is no requirement to use the outline (as seen in Outline view) a TBX document’s contents is stored in the form of an outline—even if no nesting of content is used.
- The document’s outline is something of which to be aware if using export, e.g. generating reports.
- As a Map view shows one container’s content, no amount of wishing will allow collapsing all maps in one view as that would require a new type of view! Various users have their own techniques to work around this scenario, but new users should not allow themselves to be confused by experienced users’ references to ‘flattened maps’ as such a feature does not exist.
- If wanting to leverage links more, it is highly recommended to explore Hyperbolic view rather than (or alongside) Map view. Notte that as Hyperbolic view is drawn only from the network of links in the document, you do need links present to use the view! Be aware the document outline’s hierarchy is not implemented as links, i.e. a parent/child relationship is not an automatic/assumed link, but would need to be added by the user. Action code includes linking/unlinking operators so not everything need be done by hand.
- Tinderbox is unusual in having many different views of its content. Most apps have one. At time of writing, Tinderbox has 10 different view types. Any tab can use any view type in its view pane. Not every user needs every view, but it seems many only ever use the two views presented in a default new TBX document (Map and Outline). Use of Posters in Map view offer even more display choice.
HTH
Disclaimer, given all the aTbRef links above: I am aTbRef’s author, since 2004.