TB as an knowledge hub

That’s the AppleScript in Hookmark to deal with a TBX link:

use framework "Foundation"

tell application "Tinderbox 9"
    if (count of documents) is equal to 0 then
        return "No document is available"
    end if
    
    set openFile to file of first document
    if openFile is missing value then
        return "Hook can't link unsaved files"
    end if
    
    set filePath to my encodedPath(POSIX path of (openFile as alias)) as string
    
    set openNote to selected note of first document
    if openNote is missing value then
        -- link to file if no note is selected
        return "file://" & filePath
    end if
    
    set tinderboxURL to value of attribute "NoteURL" of openNote
    set tinderboxURL to (text (1 + (length of "tinderbox://")) thru -1 of tinderboxURL)
    set tinderboxURL to "tbx://" & tinderboxURL
    
    return tinderboxURL & "?filepath=" & filePath
end tell

-- encodedPath :: FilePath -> Percent Encoded String
on encodedPath(fp)
    tell current application
        (its ((NSString's stringWithString:fp)'s ¬
            stringByAddingPercentEncodingWithAllowedCharacters:(its NSCharacterSet's ¬
                URLPathAllowedCharacterSet))) as string
    end tell
end encodedPath

and this is a link Hookmark extracts from TBX:
[dummy](hook://tbx/ExternalCode?view=outline+select=1688838559;?filepath=/Users/detlefbeyer/Documents/Tinderbox/Projekte/ExternalCode.tbx)

So the TBX file will be referenced by name and the note by $ID. The ID is specific for a single TBX file. So Hookmark has no chance to find this note again after you copied it to a new TBX file.

But this has been discussed already in depth…

:woozy_face: