C-Command Software Forum

Batch-Convert to Preferred Rich Text Font

Hi Michael,

Does EagleFiler currently provide a way to convert the rich text font of multiple selected .rtf files to the font chosen in EagleFiler’s Preferences? I’m transferring a bunch of files from Mori to EagleFiler and would like to clean up the mess of fonts, sizes, etc… I have Scrivener installed and could use it as an intermediary for this task, but obviously that would be more time-consuming.

Thanks in advance for letting me know.

Sam.

I just wrote the Change Rich Text Font script to do this.

Great - thanks very much, Michael.

Hi Michael,

In case it’s of any use to anyone, I’m posting below a way to modify the Change Rich Text Font script so that it preserves bold, italics, and bold-italics. (The example uses Helvetica 13, but can be modified to any font that includes bold and italics).

The modification involves replacing these two lines in the current script…

set font of text of front document to “Helvetica”
set size of text of front document to 13

…with the following lines…

tell text of front document
set (font of every attribute run whose (font contains “BoldOblique” or font contains “BoldItalic”)) to “Helvetica-BoldOblique”
set (font of every attribute run whose (font contains “Oblique” or font contains “Italic”)) to “Helvetica-Oblique”
set (font of every attribute run whose font contains “Bold”) to “Helvetica-Bold”
set (font of every attribute run whose (font starts with “HelveticaNeue” or font does not start with “Helvetica”)) to “Helvetica”
delay 1
set size to 13
end tell

As always, there may be a much better way to do this than the one I’ve posted here.

Whoops - that last one missed some cases. Here’s an improved version.


	tell text of front document
		set font of every attribute run whose ((font contains "Bold" or font contains "Black") and (font contains "Italic" or font contains "Oblique")) to "Helvetica-BoldOblique"
		set font of every attribute run whose ((font does not contain "Helvetica-BoldOblique") and (font contains "Bold" or font contains "Black")) to "Helvetica-Bold"
		set font of every attribute run whose ((font does not contain "Helvetica-BoldOblique") and (font contains "Italic" or font contains "Oblique")) to "Helvetica-Oblique"
		set font of every attribute run whose (font starts with "HelveticaNeue" or font does not start with "Helvetica") to "Helvetica"
		delay 1
		set size to 13
	end tell