Change Rich Text Font

Summary: Changes the font and size for the selected records.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2019-12-10

Description

EagleFiler has a preference where you can set the font for new rich text documents. This script lets you change the font of existing documents. Styles such as bold and italic that depend on the font may not be preserved, although there are ways to modify the script to do this (that depend somewhat on the chosen font).

Installation Instructions · Download in Compiled Format · Download in Text Format

Script

on run
    
tell application "EagleFiler"
        
set _records to selected records of browser window 1
        
repeat with _record in _records
            
set _filename to _record's filename
            
if _filename ends with ".rtf" or _filename ends with ".rtfd" then
                
my changeFont(_record)
            
end if
        
end repeat
    
end tell
end run

on changeFont(_record)
    
tell application "EagleFiler"
        
set _file to _record's file
    
end tell
    
tell application "TextEdit"
        
open _file
        
set font of text of front document to "Helvetica"
        
set size of text of front document to 13
        
save front document
        
close front document
    
end tell
    
tell application "EagleFiler"
        
tell _record to update checksum
    
end tell
end changeFont