Tinderbox v10 Icon

Selections

Selections are an element of the document object.

Setting a selection

To select a named note:

set selected note of front document to "Test note" 

… selects a note. N.B. presently, selecting more than one note is not supported.

Working with selections

The current selection:

set mySelection to selection of front document 

… returns a list of a selected note(s). If several notes are selected, to code returns one of those notes, typically the first selected note. If no notes are selected, this returns 'missing value'.

To ensure all of the currently selected note(s) are captured:

set mySelection to every selection of front document 

Note that selection is an element of a document object, so must be used with a specified document as above, or the code will not compile. But that form cannot be used if already inside a document tell block (code errors). Instead use selected note as below.

To get a reference to a selected note:

set mySelection to selected note of front document 

… returns the selected note. If already inside a document tell use :

set mySelection to selected note 

If several notes are selected, to code returns one of those notes, typically the first selected note. If no notes are selected, this returns 'missing value'.

To put a list of names (also works for other attributes) of all selected notes into an AppleScript list (theNames):

tell selection of front document to set the theNames to value of attribute "Name" 


See also—notes linking to here: