Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
Tinderbox Users >> Agent, Actions, Rules & Automation >> Can action code do...? (list of questions)

Message started by Mark Anderson on Nov 13th, 2015, 5:16am

Title: Can action code do...? (list of questions)
Post by Mark Anderson on Nov 13th, 2015, 5:16am

@BPM asked (here):

but I have some additional questions:

1. Can one programmatically retrieve the type[i] of a variable/attribute (e.g., typeof(x))?
2. Can one programmatically retrieve a list of the attributes for a given note?
3. Can one programmatically add/remove attributes from a given note?
4. Is it possible to programmatically explode a note?
5. Is there a way to interact with the window tabs and switch their view modes programmatically?
6. Is it possible to change the width of the text window from code?
7. Is there a way to retrieve/modify the raw rtfd contents of a note's $Text [i]in situ, i.e., not by parsing the XML file?
8. Can the actual $Text contents (or any other attribute) of a note be retrieved via a tinderbox:// URL?
9. What are the available options for the "pane designators" referred to in the TbRef page covering the TB URL schema?
10. Is there a way to have multiple windows open of a document and the text panes not by sync'd to each other?
11. Is there a way to access information within TB from JavaScript from within the Preview pane?  I know it's potentially feasible since I've built WebView interfaces that provide that capability.
12. Is there a way to create a locked note in map view that will act like a button, triggering functionality when it's clicked?
13. Is there a way to retrieve/modify the class, URL, target, and title contained in a map link from code?
14. Is there a way to right-align columns in outline view?
15. Is there a way to enable columns and/or checkboxes only for a particular group?
16. Is there an sdef file for TB?
17. Is there a way to reorder the list of stamps?

I'd start by way of expectation management with a few general points. Action code is not a formal programming environment so do not simply assume the presence of programming formalities you may otherwise as 'standard'. Action code is an evolved form of Tinderbox's original simple export macros designed for creating static HTML blog pages. Action code has evolved over 14 years reflecting users' erstwhile needs resulting in a perhaps uneven scope of expansion. Tinderbox was never designed with AppleScript support and my understanding (I'm not a programmer!) is this expensive to add back into a mature product; there are some who would use such a feature but likely not enough to offset the dev/maintenance costs (also when Apple's continued growth/support of AppleScript isn't clear). Lastly, I'm a long-term and - I guess - deeper user of Tinderbox but I don't work for Eastgate and I don't have a programmer's perspective. If you have specific needs for code feature, please note this is not formal tech support and it's quicker/better to email info@eastgate.com which you use case and suggestion; that's not to deter discussion but simply point out asking here isn't a de facto feature request. All that said...

1. No. Tinderbox is a personal/desktop app so you're using code you write yourself, so you will know what data type you are using; some choose to reflect the data type when naming user attributes. Your best reference for data types returned by action code is in aTbRef (disclaimer: I'm its author). It sounds like you may have a feature request.

2. No. Tinderbox isn't an RDBMS, rather all notes have all attributes although these simply inherit default values unless/until set locally for a note at which point inheritance is broken. In terms of the XML stored in a TBX, only non-default values are stored for any given note (more info on prototypes & inheritance). aTbRef has more on the TBX format.

3. No. which makes sense as this isn't a programming environment and most users aren't coders. Letting action code generate new attributes offers scope for much unwanted 'fun' (but feel free to suggest a feature here). That said, action code can set/alter attribute values and re-set attribute inheritance. This is explained at length in aTbRef (Actions & Rules and Object & concepts section are the best places to start - it's extensively hyperlinked to aliow exploration).

4. No. Though this is a recurring feature request.  You might want to email in and add to those voices. However, as you get to use TB a bit more you'll see it's a deliberate act done once per imported source. If you're having to do this a lot then the workflow/use case might be worth discussing (in a separate thread!).

5. No. I'm unclear why, from reading here. Again, if you've a srong use case I'd email support.

6. Yes (and no). Yes, as the pane splitter bar position can be stored (I believe!) per note. However, I think this design is bedding down as the v6 UI is new (only 1 year to the app's 14+ years). there is also an issue whether changing stored the splitter position immediately updates the current UI. Probably not and I can say there's no action code to "update UI". Again a clarifying use case would help tease this out.

7. No. As you note, you'd parse the XML. Past discussion suggested those needing to do this would know how to do the latter so the engineering cost of making a UI for this would be effort wasted given all the other things users want.

post limit - continued below

Title: Re: Can action code do...? (list of questions)
Post by Mark Anderson on Nov 13th, 2015, 5:48am

7. (cont) Action code works on $Text which is the plain te
version of what you see in a note's text pain. The RTF(d) text supports those who want to just use Tinderbox as a writing space and whom (generally!) push less heavily on the scripting side of the app - which may explain the apparent disconnect from the rich text view.

8. Possibly. This feature is still in flux. I've no firm documentation to lean on here. I believe, the 'tbx' pseudo-protocol will open a Tinderbox window [sic] at note scope, whose text pane will contain the $Text of that note. As the note will be selected, the current $Text will be the text you're after.

9. Don't know. Currently undocumented. In aTbRef I've synthesised what's in the Backstage release notes TBX and my (limited) experiments. It's a bit chick and egg; it's hard to test while we don't know exactly what we can test. (To be clear, I'm explicitly not making a dig at Eastgate; there's a lot of evolving stuff here and a rush to prematurely formalise doesn't necessarily help as oppose to hinder).

10. Unsure. I think that's the plan but I'm unsighted as to the exact design intent. I think this is an aspect of the new v6 UI that's still bedding down. Different sub-groups of users are pulling different ways. Current Apple framework design assumptions and those push from those wanting some sort of IOS viewer pushed Tb from multi window to one window UI. However, much non-trivial use of Tinderbox requires the ability to set more than one note/text at the same time. TB offers multiple windows and you ca open notes as 'tear off' windows. the latter update but don't persist session to session. Whether windows - and indeed tabs - track focus is a tad confused at present. In part I think different users' usage is pulling the app in conflicting directions (pity the poor dev at the centre).

11. I doubt it. That really wasn't the purpose of the Preview pane, i.e. as an internal browser. The preview is there so you can see if the (static) HTML you are exporting looks as expected in terms of the exported mark-up. If you've already exported CSS style info in linked notes (or link to existing CSS files) the preview will be further styled. I presume the Preview pane is using webkit in some form. But I don't believe it was intended as a general web browser built into Tinderbox.

12. No. Recall, this isn't a programming environment. I'm not saying it shouldn't, but it's not something one should expect (as at today).

13. No. The ability to do this has been requested in the past (by me if not others!).

14. No. Would that be an outline. What is the use case?

15. No. Ignore (or collapse) lines you don't need.

16. No. As stated a outset, Tinderbox was never designed to be AppleScript-able and it is apparently something expensive to add after the fact, especially if only a few people will use it. (I'd use it if it were there, but aren't pushing for it). I think the 'tbx' pseudo-protocol is designed to resolve a few inter-app connection issue that people would otherwise resolve via Applescript. Again, you might want to expose your use case - with Tinderbox there's often more than one route to a solution albeit not via the path envisaged. Long use has made me less fixated on choice of process <g>.

17. Not currently. This is definitely on the current requested feature list. I'd be surprised if the answer isn't 'yes' ere long.

I'm surprised at the number of 'no' answers here until I look at the perspective they show is of trying to use Tinderbox as a data store for other apps/APIs rather that working inside the app itself. I'll close as I opened by noting that Tinderbox is not a relational database or a formal programming environment. It's better thought of as a unique and powerful tool for writing hypertext (in the generic non-Web sense) and exploring emergent properties in (plain) text. That said, people constantly find new and diverse ways to use Tinderbox.

Phew... that was a long post. Hope it's of use!

Title: Re: Can action code do...? (list of questions)
Post by Mark Anderson on Nov 13th, 2015, 10:49am

Mark Bernstein, has also answered these questions with more authorial provenance in the original thread, here.

(I think I mostly got the answers right  ;D )

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.