Are ziplinks "paragraph aware" in terms of their location within the $Text field?

Since a picture supposed to be worth a thousand words I include an conceptual illustration below of what I’m looking for.

I use TinderBox a lot for meeting notes was well as for notes to help keep track of projects which range from studies, publications through to large satellite projects. Each project as a rule will have it’s own container to store the notes relevant to the project.

On the other hand if I’m meeting with my team we cover many projects in the same meeting, essentially updating each other on recent developments and next steps. My challenge is then to map the material from my team meeting to the projects so that next time I consult my project container I can also get a summary of recent inputs from my team meeting. As an order of magnitude I have perhaps 30 projects on-going at the same time.

Here I’ve found zip links very useful. All I need to know is the project name (or rough idea of the name) and I can directly link the paragraph in my meeting notes through a text link to an equivalent entry in the project container. It’s fast, efficient (no jumping around windows, just pure keyboard and text).

image

So for so good. It’s already a good solution. What I’m looking for is some way of copying/replicating the paragraph from my meeting notes to the $Text of the project container (perhaps also with some filtering - say the 10 most recent notes) so that when I jump to that container I have a written overview of what was said about this project during the meetings.

I don’t think this is possible currently as I see no action code to retrieve the text location of the zip link. This could be a feature request if there is a wider resonance in the community and/or there may be alternatives that you can suggest.

1 Like

Are ziplinks “paragraph aware” in terms of their location within the $Text field?

I can’t say this often enough: there is no such thing as a ‘ziplink’. The term ziplinks refers to the means of creating a text link via type, i.e ‘zip’ as in zippy, fast. I make the point not out of pedantry, but because it is important to understand how links work. A text link made via the ziplinks method is no different from Tinderbox’s perspective from one made via drag/drop or other means.

Hopefully, from the above you can see why this isn’t possible. Action code has, as at v8.9.2, no means of knowing where in a note a text link occurs or its anchor text. However, it can report the number of text links ($TextLinkCount) though I think that is little use here.

But, I wonder if AppleScript could help. My hunch is no, but you could take a look at that: IOW, detecting links in $Text.

3 Likes

This is a very interesting idea. It could certainly be done technically. I worry that it’s too specialized — that, while your case makes plenty of sense, others might want to copy just the current sentence, or the entire text of the note. Or include timestamps. Or put the new text at the top of the destination page, rather than at the bottom.

Perhaps what is needed is an OnZipLink action that would have access to the currentParagraph, currentSentence, and whatever else is useful. Or, if ziplinks allowed you to choose a link type, you could have a special link type that performed this action as an OnLink action.

5 Likes

The above is indeed a very interesting idea - I would love to have the possibility mentioned for my work and my use of Tinderbox. It is obvious that wishes to use it will vary, and therefore an action like the one mentioned by @eastgate with options would be a great solution!
Might that be something for Tinderbox 9, I wonder? :wink:

1 Like

I agree that the idea can be generalised along the lines you suggest. At the core of the idea is the ability to query the context of the source text link and transmit this to the destination note. Other users might want the sentence, full text or other extract from the source note and insert it into the destination note in another way than simply appending.

To me it suggests either OnZipLink actions and/or (I’m less sure about this) the ability to query the links from the destination note for instance via edict or rule and retrieve information from the source note (e.g. via currentParagraph and similar).

Thinking it through the advantage of the OnZipLink actions is that whatever action one takes applies to the link that was just created. An alternative to parse the incoming links in the destination note along the lines (only for one link) in this case

$MyString=links.inbound..$Text;

The is no attribute for paragraph or sentence but would something like this be an option with current paragraph referring to the location of the link in the source ?

$MyString=links.inbound..currentParagraph($Text);

p.s. I’m ok with the use of the word ziplinks to refer to the quick method for linking based on “[[” and text links to describe the actual link type.

I’d prefer OnTextLink action. Not pedantry, but reifying an object that doesn’t exist is a surefire way to confuse learners—unless “ziplinks” re going to be a discrete type of links. Not arguing either way, but just thinking of those who are confused enough already.

3 Likes

I’m curious. Couldn’t this be done via explode note plus an action and/or agent? Explode note is paragraph aware…

Not at present, as text link anchors (the ziplinks method creates untyped text links) are not exposed to any other features in Tinderbox.

Even with access to text link’s anchor text it is not possible to know if that is the first or Nth occurrence of the sub-string within the overall $Text string.

So the exploded notes could be gathered in defined (In this case Project 1, 2 and 3) containers, but you’d lose the links, right?

I guess it seemed to me that once the paragraphs from “Fictional Meeting Notes” got distributed to the appropriate containers, you wouldn’t really need the links anymore … Although if you wanted to easily go back and see at what point in a given meeting a particular project/issue was discussed the links would remain useful…

So assuming one is ok ditching the links in the service of getting the exploded paragraphs into their appropriate containers, during or after the meeting you would have to add a single identifier to each paragraph marking it as relevant to Project 1, 2 or 3, which is definitely overhead, but not terrible…

1 Like

I’ve never come across Explode being used other than for imported data, so it’s not recorded how it affects links. Testing with v8.9.2, as I suspected, text links in the source note’s $Text are not preserved. However, styling like bolding and italics are preserved.

I think @Ejspark’s observation is good: it’s quite possible that one could accomplish what’s really needed in this example using Explode.

More generally, it can be just as useful to create relationships by moving things as it is by linking them.

Yet, still, the linking question is intriguing.

Don’t shoot me. The request sounds a lot like what Roam does - it includes a snippet of the paragraph backlinked to the page.

1 Like

An overlooked part of the original message is this

Actually, this is do-able today using text preview and an export template. Set the container to collect the first N paragraph(s) of each child note (or first N notes sorted on whatever criterion) and display as export. Note that you don’t have to export anything, the result of the ‘report’ is shown when you select the preview sub-tab of the container’s text pane. If you want to explore this aspect, I suggest starting a new thread as it is a separate task to that of copying/moving data around.

Thanks for following up. Perhaps I was not clear enough: the idea is to extract only the (one) paragraph from the $Text of the source note which contains the link and not the first N paragraphs or indeed the whole text.

If I’ve understood correctly your solution involves retrieving all or part of the source note text to be summarised in the destination container text area. There is to my knowledge no way of zeroing in on the specific paragraph containing the link.

That paragraph will contain the anchor text of the project in question.

I wasn’t suggesting it was the exact feature you are positing, but rather if you have a need today then there is a means to do the same albeit via other means.

Yes, Also known as Block referencing.

I don’t have the time currently to finish the demo and the changes in Mac OS 12 to the security settings for running an AppleScript app are crazy. But just as an idea to play with:

Create an AppleScript app and register a custom URL schema - in the info.plist of the app (show package content-…) you have to add:

<key>CFBundleIdentifier</key>
<string>de.somedomain.CallByURL</string>

and

	<key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLName</key>
			<string>CallByURL</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>callbyurl</string>
			</array>
		</dict>
	</array>

Now you have to start the AppleScript app once and then you can open the app with the url structure:

callbyurl://de.somedomain.CallByURL?doc=AnchorTest&note=Note01&param=#1

The AppleScript itself will parse the parameters: doc = the name of the tinderbox file, note = the name of the note (or a path…) and param = the anchor in your TBX note (something like “#1”.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

--> callbyurl://de.somedomain.CallByURL?doc=AnchorTest&note=Note01&param=#1

-- open location ("callbyurl://de.somedomain.CallByURL?doc=AnchorTest&note=Note01&param=#1")

on open location this_url
	set x to the offset of "?" in this_url
	set the argument_string to text from (x + 1) to -1 of this_url
	set AppleScript's text item delimiters to "&"
	set these_arguments to every text item of the argument_string
	set AppleScript's text item delimiters to ""
	set myNoteName to ""
	set mySearchParam to ""
	set myDocument to ""
	
	repeat with i from 1 to the count of these_arguments
		set this_pair to item i of these_arguments
		set AppleScript's text item delimiters to "="
		copy every text item of this_pair to {this_key, this_value}
		set AppleScript's text item delimiters to ""
		if this_key is "doc" then
			set myDocument to this_value
		end if
		if this_key is "note" then
			set myNoteName to this_value
		end if
		if this_key is "param" then
			set mySearchParam to this_value
		end if
	end repeat
	
	if myDocument is not "" and myNoteName is not "" and mySearchParam is not "" then
		tell application "Tinderbox 9"
			tell its document myDocument
				set myNote to note named myNoteName
				set value of attribute named "Edict" of myNote to "$Text.contains(" & quote & "(" & mySearchParam & ".*\\n)" & quote & "); $LastFoundString=$1;"
			end tell
		end tell
	end if
end open location

This script will add an $Edict for the selected note (I found no better way to select the text with evaluate from AppleScript) and this $Edict will copy the paragraph starting with the anchor tag to a new attribute called $LastFoundString.

$Text.contains("(#1.*\n)"); $LastFoundString=$1;

This is just a sample - you could alter the action code to do whatever you need. It’s only a showcase that an URL could trigger something to get the selection around this anchor. Maybe it’s helpful…

1 Like