Book Title Capitalize - v1.0
Intro:
Titles and topics normally only upper-case the 1st letter of the first word, and keep the rest of the line all lower-case.
But there is another way to capitalize titles, I am calling it: Book Title Capitalize, and this can be found on book or movie titles. Here the first letter of every word is upper-cased, excepting articles and prepositions that are all lower-case,
e.g. ThE end oF THE game.tXT
→ The End of the Game.txt
I use this style for all my mp3 files. And finally - a least for the file and folder names - this can be automated. It would be even better to be able to do this for ID3 tags in the mp3 files... but alas that must be for another day.
Details:
For more details see the comment header of the script. As you will read there are quite a things you can do with the script:
/*
* ae_opus_book_title_caps.js (Based by my UltraEdit JavaScript:
* ----------------------------- ae_book_title_capitalize.js)
* by AEon (C) 2008 http://www.planetquake.com/aeons
* Code Provided as is, use at your own risk.
* Creation Date: 10/23/2008
* Last Modified: 10/26/2008 v1.0
*
* Purpose: Capitalize selected file (folder) names into "Book Title" style:
* Upper-case the 1st letter of each word, but keep all articles
* and prepositions in lower case.
* E.g.: "ThE end oF THE game.tXT" -> "The End of the Game.txt"
*
* Install: This Rename JavaScript is intended to be run from Opus v9.1+.
* Open advanced Rename dialog, set Old name to * and New name to *,
* turn on "Script mode", paste this code into the edit view,
* save under "Presets" as "Book Title Caps".
*
* Usage: Select files and folders you want to capitalize, open Rename
* dialog, then run the "Book Title Caps" preset. Rename preview
* (Ctrl+W) will show the renamed files. And/or use the Test button!
*
* Note: - Only key word (i.e. articles & prepositions) are lower cased.
* - Exception 1st word in file/folder name.
* - Exception 1st word *after* " - ", i.e. "10 - For Those.mp3"
* - For all other words *only* the 1st letter is upper-cased,
* this preserves e.g. "valid" all upper-case words!
* - Works on any number of files or folder names.
* - Words *need* to be separated by spaces or tabs or _.
* - Tabs (if present) and Underscores _ are replaced by spaces!
* - Multiple spaces are reduced to one space.
* - The file extensions are lower cased.
* - Special Case Delimiters () [] ... ,
* - Words starting with ( or [ after " - " are capped:
* "01 - (THE) blah" -> "01 - (The) Blah"
* - Words ending on ) or ] or , are properly cased:
* "01 - Blah (the end OF)" -> "01 - Blah (The End of)"
* - Words ending on ... are properly cased:
* "01 - Blah (the OF...)" -> "01 - Blah (The of...)"
* - User the global var switches to control script behavior.
* Tip: - You can use all the "pre-rename" switches from the Rename dialog
* with the script, e.g. Modify capitalization, All Lower-case.
* - Use DOpus.OutputString("Text"); to write to Output window.
*/
Features:
- Upper-case the first letter or each word, excepting prepositions and articles.
- Lower-case file extensions.
- Special treatment of delimiters: ( ) [ ] ... ,
- Special treatment of articles and prepositions after " - ", 1st letter is also upper-cased.
- etc.
Tips:
- A few settings, i.e. replacement of underscores or the special treatment of words after " - " can be controlled via Global Variables in the script.
- You can use the default rename features of in the Rename dialog to "pre-rename" the file/folder names, e.g. Modify capitalization, All Lower-case works nicely.
- If you want to add more exceptions to the list of words that should always be/stay in lower-case, add them in the create_art_prep_array() function.
- The JavaScript is extensively commented, so it should help those interested in JavaScript or in changing the code.
Preview:
Download:
Feedback:
Should you be missing some feature, or find a bug, drop a line and I will look into it.
Hope the script is useful.
AEon