Improved Shift F3

Hi,

Apologies for posting so much on here but I have been on a bit of an AHK mission these days...

Another function I have always wanted is a Shift F3 that gives true title case (i.e. minor words like "a" and "the" are in lowercase but the main words are in uppercase). I posted someone's script that does true title case before, but I managed to combine it into a toggle so you can use the normal Shift F3 to cycle between true title case, lowercase, and uppercase. It's a little slow on longer strings but it does the job.

toggle := 1

+F3::
if (toggle = 1) {
TrueTitleCase()
toggle := 2
}
else if (toggle = 2) {
StringLowerCase()
toggle := 3
}
else {
StringUpperCase()
toggle := 1
}
return

TrueTitleCase(){
MinorWords := "a,an,and,also,are,as,at,but,by,for,from,in,is,it,of,on,or,out,the,to,with,nor,so,into"
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")

Critical
clipx := ClipboardAll
clipboard =
send ^c
clipwait
sleep 50
string := clipboard
StringLen, len, string
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
sleep 50
send ^v{Shift Down}{Left %len%}{Shift Up}
Clipboard := clipx
clipx =
}

StringLowerCase(){
Critical
clipx := ClipboardAll
clipboard =
Send, ^c
clipwait
Sleep 50
string := clipboard
StringLen, len, string
StringLower, new, string
Clipboard := new
ClipWait
sleep 50
send {Delete}^v{Shift Down}{Left %len%}{Shift Up}
Clipboard := clipx
clipx =
}

StringUpperCase(){
Critical
clipx := ClipboardAll
clipboard =
Send, ^c
clipwait
Sleep 50
string := clipboard
StringLen, len, string
StringUpper, new, string
Clipboard := new
ClipWait
sleep 50
send {Delete}^v{Shift Down}{Left %len%}{Shift Up}
Clipboard := clipx
clipx =
}