Change Title to Title Case

Summary: Fixes the capitalization of the selected records’ titles.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2022-03-01

Description

This script helps you clean up titles with improper case. For example, some Web pages or PDFs have titles that are all in capital letters. This script changes the title so that only the first letter of each word is capitalized.

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

Script

use AppleScript version "2.4"
use framework "Foundation"
use scripting additions

tell application "EagleFiler"
    
set _records to selected records of browser window 1
    
repeat with _record in _records
        
set _title to _record's title
        
set _newTitle to my titleCase(_title)
        
set _record's title to _newTitle
    
end repeat
end tell

on titleCase(_string)
    
set _nsString to my (NSString's stringWithString:_string)
    
return _nsString's capitalizedString as Unicode text
end titleCase