Tinderbox Forum

Setting color of text etc. for text of selected notes

Is there an easy way to change the color and other font qualities of the text of selected notes?

Yes, Cmd+T opens the (OS) Fonts tab,. You can select a font, font size, face and colour.

It’s not be helpful in the longterm though as you can’t query for RTF feature like this or export such features.

Yes, that works fine for one note, but I have a thousand, of which I want to be able to select those that have a user variable set for “true” and make the text in them colored. Then I can export the text of all the notes and the ones with the user variable set will have red text and the others black. In other words, I want to put the text of a thousand or so notes into one rtf file and be able to see which ones were marked “true” by their color. It would take a long time to have to change the text in each individual note. Mark had mentioned once that he was planning to enable changing the font info for more than one note at once as can be done in Scrivener. In the current Tinderbox you can select more than one note and see the text of both at once, but you can’t edit the text or change the fonts/colors.

Changing the preference value of $TextFont will change spans that use the old $TextFont to the new $TextFont. That might help.

I think @eastgate 's answer above deal with that point. I’ll try to address the following part of your post

This is done much more easily using formatted export (aka HTML export) even if the intent is to end up in a RTF text workspace. Let’s assume for a moment your boolean is the system attribute MyBoolean. We can use an agent to find all the notes we need to export, and if necessary sort them in a specific order.

Now to the text colour. The fact there aren’t ‘simple’ controls to do what you want is a subtle indicator that the envisaged export plan is sub par. But there is an easier method. First we add an export template to our document, in this demo actually two but that distinction is not important now. The key part is the code exporting the Text of the notes we wish to export. In the template we have this code:

^if($MyBoolean==true)^<span style="color:red;">^endIf^
<h2>^title^</h2>
^text^
^if($MyBoolean==true)^</span>^endIf^

Basically it says "if the note being processed as a $MyBoolean value of true (i.e. ticked in the UI) then add an HTML tag to start colouring the text red. Then the text is exported - styles like bold, italic, underline and strikethrough are maintained; highlighting and source RTF colour are not. Lastly, we do the same test as before so as to be able to close the HTML tag we added at start, i.e. stop colouring the text red.

In the demo, 4 of 5 notes use the prototype we’ll use to select notes for export. One of these ‘CC’ (shown) has $MyBoolean ticked:

I’m using an agent ‘Text export’ to apply the export template and with the agent selected I ensure the text pane selectors are visible (Window menu ▸ Show Text Pane Selector) and then I click the ‘Preview’ selector and see this:

Now I click in the preview, select all (⌘+A), copy (⌘+C) and can now paste into Text Edit, Scrivener, etc.:

Once set up, this is a far easier route to your desired end point even if it appears to use HTML en route.

Here’s the TBX and the output test RTF file (latter zipped as I can’t upload ‘.rtf’ files) file:

text-demo.tbx (118.8 KB)

text-demo.rtf.zip (1.1 KB)

Thanks, Mark. This is awesome. As always, Tinderbox gives lots of options. Another option I just thought of is to use delimiters. Make a new note as a container and set its action to:

$Text=“aaa”+$Text+“bbb”

Put the needed notes into the container and take them out. Then select all notes, copy the text, and paste into Nisus. In Nisus, it is easy to use the delimiters to change the color of text between them and then delete them. I have to admit, your solution is more elegant.

By the way, I wouldn’t have thought of my solution without your input. Both solutions use delimiters. Obviously, the export solution you give is applicable in many more instances, though one has to be fairly proficient in html coding to use it.

Yes and no. Part of the point of making the demo was others can find this thread and use it. If someone needs a different outcome they can always reference this and describe the different outcome they need…

FWIW, I’m pretty sure we could use AppleScript to set to colour sections of text in the manner you describe for Nisus. But it seems like hard work.

Although Tinderbox has an RTF $Text space, I don’t think of it as a word processor. If desirous of such an app’s wider WYSIWYG features it is better, IMO to export to a formal word-processor type environment