Need help with AppleScript that converts a selected string of words to "Title Case"

424 views
Skip to first unread message

Michelle

unread,
Oct 20, 2015, 9:21:06 PM10/20/15
to BBEdit Talk
Can anyone help me with this?  I have the following, very helpful AppleScript that capitalizes the first letter of every word that I select/highlight:

tell application "BBEdit"
 tell window 1
 if selection as text is "" then
 set cursorPoint to characterOffset of selection
 find "\\b\\w" options {search mode:grep, backwards:true} with selecting match
 set selection to (grep substitution of "\\U&")
 select insertion point before character cursorPoint
 else
 change case selection making capitalize words with replacing target
 end if
 end tell
end tell

It does what it's supposed to do perfectly.  However, I also need it to make (or keep) all of the following words lower-case: 

a
an
and
as
at
but
by
for
from
in
into
it
nor
of
on
onto
or
so
the
to
with

Basically, I need it to convert selected text to "Title Case."  For example, both "converts a selected string of words to title case" and "CONVERTS A SELECTED STRING OF WORDS TO TITLE CASE" need to become "Converts a Selected String of Words to Title Case." 

I'd greatly appreciate the help.

Thank you!

Fletcher Sandbeck

unread,
Oct 21, 2015, 1:21:33 AM10/21/15
to bbe...@googlegroups.com
I found a regular expression online and adapted it for BBEdit. If you replace the else conditional of your script with this it seems to work.

tell application "BBEdit"
tell window 1
if (selection as text) is "" then
set cursorPoint to characterOffset of selection
find "\\b\\w" options {search mode:grep, backwards:true} with selecting match
set selection to (grep substitution of "\\U&")
select insertion point before character cursorPoint
else
replace "\\b(a)(?!(nd?|s|t)?\\b)|\\b(b)(?!(ut|y)?\\b)|\\b(f)(?!(or|rom)?\\b)|\\b(i)\\b|\\b(i)(?!(n|nto|t)?\\b)|\\b(n)(?!(or)?\\b)|\\b(o)(?!(f|n|nto|r)?\\b)|\\b(s)(?!(o)?\\b)|\\b(t)(?!(he|o)?\\b)|\\b(w)(?!(ith)?\\b)|\\b([^abfinostw])(?!\\b)" using "\\u\\0" options {search mode:grep} searching in selection
end if
end tell
end tell

The find pattern is kind of a bear, but it breaks down to selecting the first letter of a word which is not equal to one of the items in your list. You can use this directly in BBEdit and then it's double escaped in the AppleScript above. For example, it selects an "a" which starts a word and is not followed by "n", "nd", "s", or "t", a "b" which starts a word and is not followed by "ut" or "y", etc.

\b(a)(?!(nd?|s|t)?\b)|\b(b)(?!(ut|y)?\b)|\b(f)(?!(or|rom)?\b)|\b(i)\b|\b(i)(?!(n|nto|t)?\b)|\b(n)(?!(or)?\b)|\b(o)(?!(f|n|nto|r)?\b)|\b(s)(?!(o)?\b)|\b(t)(?!(he|o)?\b)|\b(w)(?!(ith)?\b)|\b([^abfinostw])(?!\b)

The replacement pattern is \u\0 which changes the found character to uppercase.

The regex pattern I adapted can be found here, but it uses a different engine than BBEdit and didn't code quite the same list of words.

http://indesignsecrets.com/grep-solution-to-flawed-title-case-feature.php

[fletcher]
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "sup...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To post to this group, send email to bbe...@googlegroups.com.

Michelle

unread,
Oct 21, 2015, 2:23:43 AM10/21/15
to BBEdit Talk
Hello, Fletcher,

Thanks!  It's a big improvement over my original.  However, it's still not quite 100% there.  Couple things: 

1.  I need it to change "THE" and "The" to "the" (and the same for all of the other words that I listed).  Currently, it leaves lower-case "the" uncapitalized, which is good, but it completely ignores "THE" and "The."

2.  If one of the listed words happens to be the first or last word of a string, it should be capitalized. 

Thanks again!  I hope that many others can benefit from this, too.

Michelle

TJ Luoma

unread,
Oct 21, 2015, 8:29:30 AM10/21/15
to BBEdit Talk

I have noticed this with most “titlecase” programs that I have
tried. My solution has been to first make everything lowercase and then
apply the titlecase, which seems to work more reliably.

YMMV.

TjL
>> <http://www.google.com/url?q=http%3A%2F%2Findesignsecrets.com%2Fgrep-solution-to-flawed-title-case-feature.php&sa=D&sntz=1&usg=AFQjCNHwWf_wBasrURjqoZf-4lO_HtZpWw>
>>
>> [fletcher]

Christian Boyce

unread,
Oct 21, 2015, 5:01:13 PM10/21/15
to bbe...@googlegroups.com
Hi Michelle. I did this a few years ago and modified it a few times too. You will find an array of words that you want to keep lowercase in the script— first you see the array capitalized, then you see it lowercase (the way you want it).

I found, after using my original script, that there were exceptions: words like “MacBook” and “iPhone” and “iTunes” needed to stay capitalized as they are. I made a list of words like those and put them in a text file. You would do this too. The name of the file doesn’t matter as it will be stored as a property. Next time you run the script, it will not ask you to locate the file as it will already know where it is. You can edit that file as time goes by— easier than editing the script since it’s just a list of words. You could delete this section of the script of course.

I also found that even though you don’t want to capitalize words like “a” and “an” you might need to anyway. For example, if you have a sentence like “A horse is not a good house pet” you want the first “a” to be capitalized and the second “a” not to be. So I added code to test whether I was leading a sentence with one of those words. You could throw this part of the script out too.

I also found that I was messing up URLs. Some are case-sensitive. So, if it’s a URL, I save it and put it back. In my case I knew that the URL would be on a line by itself, so I test for that. This should be generalized but I didn’t do it.

I also set this script up to allow you to display a dialog box asking whether you want to use the regular Change Case box or this new one. But it is commented out here. 

Hoping this helps and makes sense. Here’s the script.

property the_file : ""
--If there is no value for "the_file" there will be the next time you run the script.
-- Using "grep" throughout.
-- February 18th, 2011. Corrected Step 2 for single-quotes. 
-- Revised June 4th, 2011. Changed initial case change step to better method.
-- Revised again June 22nd, 2011. Was making errors by mistakenly affecting URLs. 
-- Revised/corrected June 24th, 2011 to catch case where there aren't any links.
-- Created new method in which lines that begin with "http" are stored, and later put back into the changed text. Much more efficient than working line by line. Other speed improvements also. 
--
--This script, with the "on run {} and "end run" wrapper, works when it is
--in the Menu Scripts folder, inside the BBEdit folder, inside the Application Support folder,
--in your user Library ("~/Library/Application Support/BBEdit/Menu Scripts/").
--
--The script gives the option of using the original Change Case command.
(*
-- we would use this On Run handler if we put the script into the Menu Scripts folder.
--
on run
-- The run handler is called when the script is invoked normally,
-- such as from BBEdit's Scripts menu.
changecaseformichelle()
end run
*)
--
(*
--commented out because we are not going to attach to a menu item after all
on menuselect()
-- The menuselect() handler gets called when the script is invoked
-- by BBEdit as a menu script.
-- true means we do the changecaseformichelle script instead of the normal command
-- false means we do the normal command
--
set the_status to changecaseformichelle()
return the_status
end menuselect
*)
--
-- this would be called "on changecaseformichelle() if we wanted to put this in the Menu Scripts folder.
on run {}
(*
-- User gets to choose whether to use standard Change Case or this modified version. Added 2-14-2011. Happy Valentine's Day.
set the_button to display dialog "Would you like to use the standard Change Case, or Michelle's version?" buttons {"Standard", "Michelle's"} default button "Michelle's"
*)
--set the_button to button returned of the_button-- as if it had been clicked.
set the_button to "Michelle's"


if the_button is "Michelle's" then
set the_exceptions_upper to {"A", "An", "And", "As", "At", "But", "By", "For", "From", "In", "Into", "It", "Nor", "Of", "On", "Onto", "Or", "so", "The", "To", "with"}
set the_exceptions_lower to {"a", "an", "and", "as", "at", "but", "by", "for", "from", "in", "into", "it", "nor", "of", "on", "onto", "or", "so", "the", "to", "with"}


-- Reading exceptions from a file
if the_file = "" then
set the_file to choose file with prompt "Choose the file where you store the exceptions."
end if
set the_text to read the_file
set replace_with to paragraphs of the_text


-- we will use "replace_with" in Part 4 below--


tell application "BBEdit"


replace ".http" using "\\rhttp" searching in selection of project window 1 options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
--
set the_text to the selection
set theCountOfLines to count of lines of the_text
set numberOfCharacters to number of characters of the_text
set startingPoint to characterOffset of the_text
set endingPoint to (startingPoint + (length of the_text))


-- Storing line number and content of every link from the original text. Then we make changes, then we restore with original link text. Brilliant move. 
try
set we_have_links to "false"
set link_line_text to contents of every line of the_text whose contents starts with "http"
set link_line_numbers to startLine of every line of the_text whose contents starts with "http"
set we_have_links to "true"
end try
--PART ONE: Capitalize The Words.
change case the_text making capitalize words


--Fixing numbers
set the_numbers to {"1St", "2Nd", "3Rd", "4Th", "5Th", "6Th", "7Th", "8Th", "9Th", "0Th", "11Th", "12Th", "13Th"}
set the_fixed_numbers to {"1st", "2nd", "3rd", "4th", "5th", "6th", "7th", "8th", "9th", "0th", "11th", "12th", "13th"}
tell the_text
repeat with k from 1 to count of the_numbers
replace item k of the_numbers using item k of the_fixed_numbers
end repeat
end tell
--/ixing numbers


--PART TWO: Look for the exceptions and fix them.
--loop through the_exceptions_upper
repeat with j from 1 to count of the_exceptions_upper
-- Added the "hyphenated word" case here.
set the_search_string to "(([>]+)|(\\s+)|(\\r+)|(-+))" & item j of the_exceptions_upper
set the_replace_string to "\\1" & item j of the_exceptions_lower


-- All parts of hyphenated words get capitalized
set the_hyphenation_search_string to item j of the_exceptions_lower & "-"
set the_hyphenation_replace_string to item j of the_exceptions_upper & "-"


-- Also handle the case where the hyphen is leading.
set the_hyphenation_search_string2 to "-" & item j of the_exceptions_lower
set the_hyphenation_replace_string2 to "-" & item j of the_exceptions_upper


tell the_text
replace the_search_string using the_replace_string options {match words:true, search mode:grep}
-- All parts of hyphenated words get capitalized
replace the_hyphenation_search_string using the_hyphenation_replace_string options {match words:true}
replace the_hyphenation_search_string2 using the_hyphenation_replace_string2 options {match words:true}
end tell
end repeat


--PART THREE: look for words that start sentences etc and Capitalize them.
--Fast Method: canned GREPS.
--Note: this could be written as one grep statement, in this form:
--(a|b|c|d) with a, b, c, and d being the first argument from each 
--replace below. But that's messy to read.


tell the_text
-- one or more returns, one or more returns and any number of spaces
replace "(\\r+\\s*)(\\w)" using "\\1\\u\\2" options {search mode:grep}


-- first word after period, exclamation point, question mark, with at least one space following the punctuation
replace "([\\.!\\?]\\s+)(\\w)" using "\\1\\u\\2" options {search mode:grep}


-- colon, colon and any number of spaces
replace "(:\\s*)(\\w)" using "\\1\\u\\2" options {search mode:grep}


-- two dashes, two dashes and any number of spaces
replace "(--\\s*)(\\w)" using "\\1\\u\\2" options {search mode:grep}


-- open parenthesis, open parenthesis and any number of spaces
replace "(\\(\\s*)(\\w)" using "\\1\\u\\2" options {search mode:grep}


-- one or more open double quote (curly)
replace "(\\s+)([“]+)(\\w+)" using "\\1\\2\\u\\3" options {search mode:grep} --searching in theCharacters


-- open double quote (straight), open double quote (straight) space
replace "(\\s+)([\"]+)(\\w+)" using "\\1\\2\\u\\3" options {search mode:grep} --searching in theCharacters



--PART FOUR: do the special case capitalizations, using "find_what" and "replace_with" lists at top of script. If you add something to "find_what" you have to add something to "replace_with" too. Example: change "pdf" to "PDF."
-- GREP
-- Reading from a file


repeat with i from 1 to count of replace_with
set the_search_string to "(([>]*)|(\\s+)|(\\r+)|(\\()|([\"]+))" & "(?i)" & item i of replace_with
set the_replace_string to "\\1" & item i of replace_with
replace the_search_string using the_replace_string options {match words:true, search mode:grep}
end repeat
end tell


--PART FIVE: now put the links back in
if we_have_links is "true" then
repeat with i from 1 to count of link_line_text
set contents of line (item i of link_line_numbers) of front text window to item i of link_line_text
end repeat
end if


--PART SIX: set the selection to be what it was when the script started
tell front text window
if endingPoint is greater than numberOfCharacters then
select (characters startingPoint through (endingPoint - 1))
else
select (characters startingPoint through endingPoint)
end if
end tell
end tell



return "true"
else


return "false"
end if
end run
On Oct 20, 2015, at 6:21 PM, Michelle <essa...@gmail.com> wrote:



--
Check out the One-Minute Macman Blog!

Christian Boyce
Christian Boyce and Associates
Mac, iPhone, and iPad Consultants

For appointments, please call the office: 424-354-3548.
We do not make appointments by email or text.

Now Playing on The Boyce Blog: How to Password-protect your documents

(Join The Boyce Blog mailing list and never miss a post! Plus, every 100th signer-upper gets a coffee cup!)

Current weather in Santa Monica, CA: Fair, 76° F 

Christopher Stone

unread,
Oct 21, 2015, 7:07:06 PM10/21/15
to BBEdit-Talk Talk
On Oct 20, 2015, at 20:21, Michelle <essa...@gmail.com> wrote:
Can anyone help me with this?  I have the following, very helpful AppleScript that capitalizes the first letter of every word that I select/highlight:
______________________________________________________________________

Hey Michelle,

This sort of job is precisely why I've used the Satimage.osax since 2003.

The fixedCaseWordList lets you designate the case of any given word.  It is arranged vertically for easy maintenance and sorting.

First and last words in the title are adjusted at the end of the script.

On my system the handlers are hidden in a library.

Back in the days I could use Eudora I had a 1000+ line script that reformatted reply-text using various rules for different email lists and people.  It hijacked Reply's keyboard shortcut and was only about 0.2 seconds slower than a normal reply.

I had a similar script for editing the junk out of list-mail I wanted to keep.

--
Best Regards,
Chris

-------------------------------------------------------------------------------------------
# Auth: Christopher Stone <script...@thestoneforge.com>
# dCre: 2015/10/21 17:20
# dMod: 2015/10/21 17:52 
# Appl: BBEdit & the Satimage.osax
# Task: Change case of selected text to title-case.
# Libs: None
# Osax: Satimage.osax { http://tinyurl.com/dc3soh }
# Tags: @Applescript, @Script, @BBEdit, @Change, @Case, @Selected, @Text
-------------------------------------------------------------------------------------------
# SCRIPT REQUIRES INSTALLATION OF THE SATIMAGE.OSAX APPLESCRIPT EXTENSION!
-------------------------------------------------------------------------------------------
set fixedCaseWordList to paragraphs 2 thru -2 of "
a
AFL-CIO
an
and
as
at
but
by
for
from
in
into
it
NAACP
nor
of
on
onto
or
so
the
to
with
"
set lowerCaseWordRegEx to change "(.+)" into "\\\\b\\1\\\\b" in fixedCaseWordList with regexp without case sensitive
set _text to getSelectionOfNamedBBEditWindow(1)
set _text to titlecase _text
set newText to change lowerCaseWordRegEx into fixedCaseWordList in _text with regexp without case sensitive
set newText to change "^(\\w)" into "\\u\\1" in newText with regexp without case sensitive
set newText to change "(\\w)(\\w*)$" into "\\u\\1\\2" in newText with regexp without case sensitive
setBBEditTextSelectionTo(newText)

-------------------------------------------------------------------------------------------
--» HANDLERS
-------------------------------------------------------------------------------------------
on getSelectionOfNamedBBEditWindow(_window)
  tell application "BBEdit"
    if _window = "front" then
      set _window to window (name of front text window)
    else if class of _window = integer or class of _window = text then
      set _window to text window _window
    end if

    

    tell _window to return contents of selection

    

  end tell
end getSelectionOfNamedBBEditWindow
-------------------------------------------------------------------------------------------
on setBBEditTextSelectionTo(_text)
  tell application "BBEdit" to set contents of selection's text to _text
end setBBEditTextSelectionTo
-------------------------------------------------------------------------------------------



Michelle

unread,
Oct 28, 2015, 9:15:31 PM10/28/15
to BBEdit Talk
ChristianBoyce and Christopher Stone: 

Thank you so very much for your help!  I ended up going with Christopher's solution because there is a lot less code and the one-per-line "white list" feature is super convenient and easy to edit/use. Thanks again!

For anyone else who is interested, following is my whitelist of carefully and thorougly-screened acronyms and "short words" that I have set Christopher's script to ignore.

10th
1st
2D
2nd
3D
3M
3rd
4H
4th
4WD
5th
6th
7th
8th
9th
a
A.I.
A.K.C.
AA
AAA
AAAA
AACN
AADP
AAPL
AAR
AARP
AB
ABA
ABC
ABM
ABS
ABT
AC
ACA
ACARS
ACCT
ACDC
ACEP
ACH
ACL
ACLU
ACM
ACME
ACRL
ADA
ADD
ADHD
ADMN
ADN
ADP
ADR
ADT
AECT
AED
AES
AEST
AFC
AFDC
AFL
AFL-CIO
AFLCIO
AFRICOM
AFSCME
AG
AI
AICPA
AIDA
AIDS
AIG
AIPS
AIS
AIU
AJAX
AK
AKA
AKO
ALIR
ALS
AMA
AMC
AMD
AME
AMEX
AMR
AMS
AMSN
an
ANA
and
ANOVA
ANPS
ANWR
AOL
AONE
AP
APA
APD
APEC
APHA
API
APN
APO
APR
APT
APU
AQOLI
AQP
AQP2
AR
ARDS
ARM
ARPN
as
ASAP
ASCA
ASCE
ASCII
ASCO
ASD
ASDA
ASDF
ASEAN
ASI
ASL
ASME
ASP
ASPCA
ASX
at
AT&T
ATF
ATM
ATP
ATT
ATV
AUC
AUS
AVG
AVON
AWOL
AZ
AZT
B2B
BAA
BAE
BART
BASF
BATNA
BBB
BBC
BC
BCDR
BCE
BCG
BCP
BCS
BETC
BF
BIM
BIOS
BLS
BMG
BMI
BMW
BMY
BNP
BNSF
BP
BPA
BPL
BPM
BPR
BRIC
BSB
BSC
BSN
BSRI
but
by
BYOD
C.S.
CA
CABG
CAC
CACREP
CAD
CAE
CAFR
CAFTA
CAHP
CALEA
CALS
CAM
CAPM
CARF
CAUTI
CBA
CBCA
CBE
CBIS
CBO
CBR
CBRNE
CBS
CBT
CC
CCTV
CD
CD83
CDC
CDN
CDO
CDS
CE
CEC
CEDAW
CEO
CES
CF
CFAM
CFIM
CF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SUV
SVC
SVU
SWAT
SWLOM
SWOT
TAJ
TANF
TB
TBC
TBI
TBS
TCA
TCAS
TCM
TCP
TCP/IP
TD
TDAC
TEC
TESOL
TFAH
TGR
the
TJX
TLC
TMA
TMC
TMJ
TN
TNA
TNT
to
TOC
TOEFL
TOGAF
TOS
TPIY
TPS
TQM
TR
TRW
TSA
TSO
TTIC
TTP
TUI
TV
TVM
TX
U.C.
U.K.
U.N.
U.S.
U.S.A.
U.S.S.
U.S.S.R.
UAE
UAL
UAS
UAV
UAW
UBL
UC
UCAV
UCB
UCC
UCITA
UCLA
UCO
UCR
UF
UFC
UFO
UFPR
UHS
UI
UK
UMBC
UMTS
UN
UNCF
UNESCO
UNICEF
UNIX
UNMIK
UOP
UPC
UPN
UPS
URL
US
USA
USAA
USAF
USB
USC
USCA
USCIS
USD
USDA
USDOJ
USFA
USMC
USO
USPACOM
USPS
USPTO
USS
USSR
USWA
UT
UTI
V
V.P.
VA
VACTERL
VARK
VAT
VATER
VCR
VF
VGA
VHS
VHSIC
VI
VII
VIII
VIP
VITA
VMI
VOIP
VP
VPN
VR
VRAM
VRE
vs
VT
VZ
W.B.
W.H.O.
WA
WACC
WAIS
WAIS-IV
WAN
WAREZ
WASP
WB
WBS
WCDMA
WEF
WI
WIC
WIMAX
with
WK
WLAN
WMD
WMI
WMS
WNBA
WSJ
WSPA
WTO
WV
WW1
WW2
WW3
WWE
WWF
WWI
WWII
WWIII
WWW
WY
X
XBRL
XDE
XI
XII
XIV
XIX
XL
XLS
XLSX
XM
XML
XP
XSL
XV
XVI
XVII
XVIII
XX
XXI
XXL
XXX
XYZ
Y
YMCA
YRS
ZIP

Christopher Stone

unread,
Oct 29, 2015, 6:41:22 AM10/29/15
to BBEdit-Talk Talk
On Oct 28, 2015, at 20:15, Michelle <essa...@gmail.com> wrote:
> I ended up going with Christopher's solution because there is a lot less code and the one-per-line "white list" feature is super convenient and easy to edit/use.
______________________________________________________________________

We aim to please. :)

> For anyone else who is interested, following is my whitelist of carefully and thorougly-screened acronyms and "short words" that I have set Christopher's script to ignore.

Thanks for that.

I'm impressed with how fast the script is even with a nearly 1400 word special-case list – yet another reason why I swear by the Satimage.osax.

--
Best Regards,
Chris

Doug Parker

unread,
Nov 27, 2023, 8:46:27 AM11/27/23
to BBEdit Talk
Eight years later, I posted the question to ChatGPT, took some of its suggestions, and now I have an Automator Quick Action that runs an Applescript that uses BBEdit's make title case as a service on my iMac. BBEdit's title case leaves unimportant words like "a," "and," and "the" lowercase unless they're the first or last word in the title.

on run {input}

     tell application "BBEdit"

          return change case item 1 of input making title case

     end tell

end run


Reply all
Reply to author
Forward
0 new messages