Tinderbox Forum

Change text format

For working with selected text, DT’s WordServices and Brett Terpstra’s Markdown Service Tools can be used in any application. They don’t solve the problem of not being able to batch change $Text format in several notes but, if I understood this thread well, neither can Keyboard Maestro, or does it?

I’m late to the party and the link is broken. @brookter, would you be willing to make the link available again or does anyone else have this file.

This looks great! I can recreate this, but it would save some time if it is available.

Hi Steve,

Of course: the new link is here — https://www.dropbox.com/s/wtrhx5lo2f4ajsp/TBX8%20Misc%20Macros.kmmacros?dl=0

NB: the old one was for TB7 so I’ve converted it for TB8.

I’ve disabled the original cleanup commands because TB8 uses a separate dialogue box which unfortunately doesn’t respond to tab or arrow commands, so I can’t easily manipulate the dropdown box with KM. (I’m sure there’s a way, I just haven’t spent any time looking.)

For the time being, use opt-Mc which opens the dialogue and then you’ll have to use the mouse to pick the option.

HTH.

David

1 Like

David, thanks for taking the time to clean it up and reshare it. It works!

It gives me a lot of ideas on how I can speed up my TBX workflow. I’m working on a big project and my forearm that I’m using to use the mouse is hurting! I want brainstorm how I can keep my hands off of the mouse.

I’m glad it’s useful!

I too am dealing with 100s of notes that have residue font settings I wish to wipe out. Font settings include not only font, but also color, highlighting, size, etc.

I am looking for a stamp to Strip-All-Formatting from $Text. The stamp would nuke everything, including highlighting, colors, underline, boldface, fonts, etc. I see piecemeal solutions, e.g., resetting font to Standard Font using Format -> Style -> Standard Font (Cmd+Opt+Ctrl+T).

I am not suggesting any sort of fundamental change to how $Text is handled in TBX. I specifically am avoiding the topic of RTF vs plain text vs markdown as some sort of default for $Text. That is a complicated topic that I suspect does not have one-solution-fits-all.

I am just looking for a way to “reset” all font features in $Text without having to go through the onerous manual method outlined here. The reason for a Stamp or equivalent is so that it could be applied to many notes at once.

If your text has the same font as $TextFont, then changing $TextFont will change the font of the text.

There is, at present, no “strip all formatting” command.

Not tried, but might not an AppleScript be able to do this. I’ve not tested, and so i’ve no idea if editing the text would affect text links. My presumption is not as these are stored outside the note (and use character offsets based on the note’s stored plain text).

Style changes, in AppleScript or internally, won’t affect links.

Note, though, that the manual method is surprisingly viable. Let’s say we have 500 notes. We need to select each note in turn, select all the text, and apply Format ▸ Text ▸ Standard Font. In outline view, I think we could do 3-4 of these a minute and still have time to drink our coffee, but let’s say we manage just 2/minute.

That’s 120/hr, so the whole thing takes 4 hr 10 min. That’s not fun or elegant, but you only have to do it once.

It can be done—and I have, several times as the aTbRef.TBX has lived in 7 major version from v2.3.4 to date as well as countless minor builds and betas. As thinks like the default $Text font changes it helps to update the docs.

I find you need to apply both Standard Font and Reset Margins from the same sub-menu). Whilst the former resets font face/size/colour it doesn’t reset tabs or paragraph spacing (i.e. whether you need a return between paragraphs or it’s spaced for you). I find that is, from my user perspective what I want/need for a ‘full’ text reset. An option to do these both (reset all aspects of text & style) has been a feature request for some while, so I assume as it may be less easy to implement than the act of asking for it.

. The $TextFont default has changed along the way: MercurySSm-Book in v7.x/v8.x, HoeflerText-Regular in v6.x, Hoefler Text in v5.x, Lucida Grande in v2.3.x, v3.x, v4.x, and from initial launch it was Geneva. So, aTbRef (started in v2.3.4 but with pre-v2.3 data) has had all then-existing notes manually reset at least 4 times (plus a few more times during thrill seeker early betas of v6). :open_mouth:

This is where you’re glad you’ve bought Keyboard Maestro…

(TBX) Outline Mode -> first note -> opt-tab -> (Keyboard Maestro) Record Macro -> (TBX) cmd-a -> cmd-opt-ctl-t -> cmd-opt-down -> (KM) Stop Macro -> Give macro shortcut -> (TBX) type this short cut x 499 times -> done.

First step 2 minutes (ish). Remaining steps 499 x 2 seconds. Total time < 20 minutes (ish). (Less if you program the macro to run 499 times instead of pressing the shortcut…)

:wink:

1 Like

@brookter I appreciate your suggestion and agree that KM is a godsend. Unfortunately, I need to change the color of the font, which is not so easily done from a menu command. After choosing Format>Font>Show Colors, one has to select the color from a palette. I believe KM is capable of emulating a mouse click at a specified coordinate on the monitor. By keeping the color palette in a fixed position and adding a mouse-click step, a KM macro might provide a workable solution. Thanks.

I should add that the value of $TextColor is not the issue here, as far as I can tell. I’ve changed its value and it has no effect on this note. As I understand it, $TextColor sets a “base” font color. However, if the color of the font is changed by some other means, then the new color setting gets recorded in the RTF layer of $Text which is not accessible via TBX attributes. If there were a Boolean attribute, such as $AllowRTF, that one could set to false, it could provide a way for TBX to disallow RTF fontifications (and wipe out any existing RTF) for that note.

I see… Do you know about the Click at Found Image action?

Take a screenshot of the colours palette and clip it to just the colour entry you want and save it with a name (Red.png). Finally, use ‘Click at Found Image’. The action has a few options, so it will probably need a bit of playing with, but it may be more robust that trying to set the palette at a certain location every time.

That’s good to know, and it suggests an avenue. I am considering deleting <rtf>...</rtf> blocks for target notes in the TBX file. I assume this will remove remove RTF formatting (while preserving the raw text and in-text links). Initial testing on 1-2 notes suggests this could work. However, before I implement across 100s of notes, I want to confirm that apart from stripping RTF fontifications (which includes embedded images, I assume), I won’t lose other information in the notes.

I’d be very leery of doing this. It might work, provided the notes possess <text>...</text> blocks, but it’s emphatically unsupported.