Tinderbox Forum

Change Color of all occurrences of a word

An old post suggests it is not possible to automatically change the color of all occurrences of a word in $Text in all notes found by an agent. Is that still the same?

Could this be done via Applescript?

If I wanted to do the same to the HTML output I presume I would need to do a Regex Replace on $Text ?

Possibly. There isn’t—as in the app itself—a Tinderbox method for that but AppleScript could probably set an RTF string with coloured $Text. Whether that can be persisted back in to Tinderbox you’ll just need to try.

You could insert HTML markers into $Text, which would show in Preview and get exported.

Unless the words are unique, like a product name, be careful with a regex-based approach. They match characters not semantics/contexts, and many words have different meanings according to context.

To understand better, what is the use case (the need) to do this? I ony ask in case that suggests an alternative approach.

The use case would be to readily identify key words when reading either an abstract or full-text in an academic paper in medicine.

I would highlight either individual words or short phrases which. have highly specific meaning within the set of papers being reviewed.

For example, suppose my Tinderbox database contains a few thousand papers on carpal tunnel syndrome and I am interested in advanced cases where the muscles atrophy. Searching for and changing the color of the term “thenar atrophy” would rapidly identify the subgroup of papers I am interested in.

My plan is to take it a bit further by the way and use Regex to extract each full sentence containing that phrase and then in the HTML export display each of those sentences as active deep-link hyperlinks to that sentence in the original article. If the phrases in the HTML export are in a different color within those sentences, then it would be very a very efficient process overall to find very pertinent passages in what is otherwise an unmanageable volume of data.

1 Like