Use Headline Style Capitalisation for Titles

This is a nifty way to change selected text to initial capitals, ignoring minor words.

So, the above sentence would be changed to: This is a Nifty Way to Change Selected Text to Initial Capitals, Ignoring Minor Words.

Steven Marzuola shared it a few years ago. Minor words can be edited and localised to other languages. Control F3 is a logical shortcut because it's similar to toggling upper/lowercase with shift F3

 

; ----------------------------------------------------------

; Change selected text to headline style capitals

; ----------------------------------------------------------

^F3::
{
MinorWords := "a,an,and,also,are,as,at,but,by,de,for,from,in,is,it,of,on,or,out,the,to,with,nor,so"
MajorWords := Format ( "{:Us}", "I,II, III,IV,V,VI,VII,VIII,IX,X,XI,XII,XIII,XIV,XV,XVI,XVII,XVIII,XIX,XX,XXI,XXII,XXIII,XXIV,XXV,XXVI,XXVII,XXVIII,XXIX,XXX,XXXI,XXXII,XXXIII,XXXIV,XXXV,XXXVI,XXXVII,XXXVIII,XXXIX,XL" )

Clipboard =
SendInput, ^c
Clipwait
rString := ""

string := StrReplace(ClipBoard, "-", " - ")
string := StrReplace(string, "/", " / ")
string := StrReplace(string, "&", " & ")
string := Format( "{:Ts}", string )
wordList := StrSplit( string, " " )
for each, word in wordList
{
if( each > 1 and each < wordList.MaxIndex() )
if word in %MinorWords%
word := Format( "{:Ls}", word )
if word in %MajorWords%
word := Format( "{:Us}", word )
rString .= word . " "
}
string := SubStr( rString, 1, -1 )
string := StrReplace(string, " / ", "/")
string := StrReplace(string, " - ", "-")
string := StrReplace(string, " & ", "&")
string := StrReplace(string, " ", " ")
Clipboard := % string
Clipwait
SendInput, ^v
return
}

Parents Reply Children
No Data