Tinderbox Forum

Quickly add attribute value (such as page number)

When taking notes on a text, I like to add the page number for the source of a given note. Currently, I enter this number into a key attribute field I have added: “Pages”.

I would like to optimise this workflow, adding the page numbers more effortlessly, given that I do this dozens of times a day. I often work on a smaller screen, so I generally use the Map View in View Only mode. To add a page number, I either have to open text view or open the quick stamp window.

I was wondering if anyone here had an idea on how to make this workflow more frictionless. Ideally, I would like to be able to trigger a popup window with a keyboard shortcut that asks me to enter a page number. I don’t think this is possible with Tinderbox.

Not directly in app as it doesn’t have a programmable input dialog within action code. But, Tinderbox supports AppleScript which does allow input boxes and which can ‘talk’ to Tinderbox. So, you could make an AppleScript (not really my expertise so no code here) to which you give an OS shortcut. Call the script which gives you an input dialog (Assumption alert! the currently selected note in Tinderbox is the one you want to annotate). You input the page number (or page range) and click a button. The script adds that as a new value to $Pages (which I assume is a Set-type, so dupe values are deleted—or List-type if you want sub-page-scope referencing).

1 Like

Should have checked. There is is built-in $Pages system attribute (References group) which is String-type. So your script will likely want to use a ", " concatenate if $Pages already has a value. Were is me, I’d probably make a List or Set type user attribute $RefPages so that the discrete page references are more addressable, e.g. if I wanted to explode them to discrete notes for deeper annotation.

Hi,

I do this all the time (although I’d missed the $Pages attribute–thanks Mark!).

The approach is to use in the note name a bit of markup that gets processed by an agent, autofilling the pagenumber attribute.

In more detail:

Notes on specific pages start with a capital N and then the page number. e.g.:
“N96 This is now the main name of the note.”

I’ve a note processing agent with the Query:
$Name.contains("^N([0-9]+)(.+)")

This picks up all those notes and them processes them with the following action:
type=note; page=$1; Name=$2;

And that’s it. I use this a lot when reading PhD theses; I’ve similar agents for questions and corrections. It could probably be adapted to work in the body of a note, but I’ve found one note per point is the easiest way to work. The main limitation I’ve found it you have to be careful if you frequently use text of the form N198, C25, etc. This has bitten me more than once–so the regex now looks for these at the start of a line, not perfect but more than good enough.

2 Likes

FWIW, interest piqued, I had a go with Applescript but i can’t get the correct syntax for the “selected note”. In Script Debugger pasting a tell from the Tinderbox dictionary results in selected note of document but that doesn’t compile. Otherwise one may need a more elaborate preamble to get a reference to the current note, ‘just’ so you can set the value of $Pages.

1 Like

I have taken loads of such notes in the past and I always put the page number in the text. I never used the system attribute $Pages because that was designed for recording the spread of pages for something like an article in a journal, or a chapter in a book. I use Bookends as my bibliographic manager, and any item that I drag from Bookends to Tinderbox is likely to be using the system attribute $Pages for that purpose (it is sometimes blank for other reference types).

Anyway, I find myself wondering why the page number needs to be an attribute rather than just being in the text. Is there some use that the information is put to that requires it to be in an attribute? Like perhaps sorting the notes according to page number? Just curious. And wondering if some complication could be avoided.

Thanks for flagging this! I haven’t tried writing anything in AppleScript yet, though now might be just the time to start!

This is brilliant, thank you! I was suspecting there was some clever workaround that I had not thought of yet.

I guess it’s mostly an aesthetic question. I find it important to clearly and visually distinguish between page number and content when using Map View. I have the caption of my note prototype set to the page attribute, which looks like this: Screenshot 2020-05-27 at 14.26.41

Well, it’s clearly up to you and what you need. In my case, I want to export a list of one type of note (in page order) without any of the others.

I’ve used this for a while and may have forgotten what I was thinking when I made it, but it could also be that having the page number everywhere is visual clutter I’m happier without.

And most likely–I came across the technique on the forum and wanted to try it out!

Both of those make sense. My working practices are different, and I mention them just for the sake of exchange. I like to make sure that any note I make is linked to the source (where it is not my own head, though not a lot comes out of that). So my notes typically have a Bookends style temporary citation in them, which would be something like {Smith, 2003, #123@20}. The number after the ampersand is the page number. The number after the hashtag is the ID of the item in the Bookends database. If I search for that, I can find any note that uses the same source work. Usefully, it is also part of the URL for the item in Bookends, and can be made into a clickable link that will go straight to the item in Bookends. Once in a while a quick export of data is useful, and copying and pasting the text of the note is as fast as I can get. Having all the information in the text of the note prevents loss.

Edit: not ampersand, you dolt! The @ sign. It’s too hot here.

If I were doing this all the time, I might set up a convention for naming notes like this:

The Intentional Fallacy p. 65

An agent could look for notes that end with " p. " followed by some digits. We’d extract those digits and store them in $Pages, then remove the entire expression from the title.

1 Like

Very clever, @rjdreid

The bare bones of an AppleScript targeting the selected note could go something like this, where MyNumber is changed to whatever.

set pageNum to text returned of (display dialog "Page Number" default answer 0)
tell front document of application "Tinderbox 8"
	tell first selection to set value of attribute "MyNumber" to pageNum
end tell

At some point it would be good to clean up some of the documentation about AppleScript. Some of it is not very “AppleScripty,” and some is just wrong, whereas the implementation itself in the app is first class.

1 Like

Thanks for the script, @sumnerg.

Reminds me that a feature I wish Tinderbox had for use in making stamps, was an internal Tinderbox action to pop a dialog box and ask for text when executing the stamp, which then is used in the processing of a stamp. IOW, a notional stamp to do what your script does might be:

$MyNumber.prompt("Please enter a number")
2 Likes