Change Title to Title Case

Summary: Fixes the capitalization of the selected records’ titles.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2010-11-27

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

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 _code to "import sys; print sys.argv[1].title()"
    
set _script to "/usr/bin/python -c " & _code's quoted form & " " & _string's quoted form
    
return do shell script _script
end titleCase