Tinderbox Forum

How to to a mass unlinking on specific notes

I was experimenting with running agents to automated linking and I linked very one of my notes to 48 other notes. Ugh. :slight_smile: See attached, so many outbound links.

I think I can use unlinkFrom on the notes, one at a time, or in a group, but I can’t seem to get it to work. I tried to make it work with one note as a test and it just won’t work. Can someone help?

You can see the links below the text pane if you press ⌘7. It should be possible to delete links from there more easily, I believe.

Yes, I tried that and there are hundreds of them. It will take forever. Also, the file keeps crashing when I try to do it too fast.

Anytime you find a repeatable crash — especially when doing something unusual like deleting lots of links very quickly! — send a crash log and sample file to tinderbox@eastgate.com! That will help the folk who come next.

Easy solution: duplicate the note. The duplicate won’t have any of the links, but has the same text and attribute values. Delete the original.

Ok. Will do. Thanks.

I think @eastgate’s dupe/delete answer probably solves the immediate problem, but I’ll try and answer the action code aspect.

To unlink an object (note or agent) from other object, i.e. remove outbound links, you need unlinkTo(). As the article states to unlink everything (outbound) use:


If you only want to remove links of a particular type, e.g. “Benefit”;


if note A links to note B with links of type “Benefit” and “Example”:


would result in only one remaining link from a to B, of type “Example”

On a wider point, the opening problem has hopefully shown why advice is to test things on small test files first and only apply them in a larger context once your are confident that you understand the process. Working on small tests makes it much easier to see what is happening and only leaves issues of scale or interference from other code in your app to deal with.

If I am going to do something in a document that might have uncertain results, I’ll duplicate the document and try there first. Easy to throw away the test document than to repair a major mess in my main document.

1 Like

Another useful aspect of making a twist is because you need to make necessary/sufficient test data, even that small amount of customisation is often a prompt to (re-)consider choices, e.g. prototype naming, number/type of new user attributes, custom link types, etc.

In hindsight, if got as much benefit from those reflections if not more as from the original intent of a small safe test. Test docs are useful.

Testing a lot, with the same customisation? Make a ‘starter’ file’ and add it as a favourites file. That way you can crack open a new-but-customised file for next to no effort.