Hi. You all have really complex methods of changing the cases, but I used a much simpler way of doing things.
--Capitalize 1.0.1
--Copyright © Panah Neshati, 2011.
on replaceText(find, replace, subject)
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to find
set subject to text items of subject
set text item delimiters of AppleScript to replace
set subject to "" & subject
set text item delimiters of AppleScript to prevTIDs
return subject
end replaceText
on capitalize(a)
set a to (get replaceText("a", "A", a))
set a to (get replaceText("b", "B", a))
set a to (get replaceText("c", "C", a))
set a to (get replaceText("d", "D", a))
set a to (get replaceText("e", "E", a))
set a to (get replaceText("f", "F", a))
set a to (get replaceText("g", "G", a))
set a to (get replaceText("h", "H", a))
set a to (get replaceText("i", "I", a))
set a to (get replaceText("j", "J", a))
set a to (get replaceText("k", "K", a))
set a to (get replaceText("l", "L", a))
set a to (get replaceText("m", "M", a))
set a to (get replaceText("n", "N", a))
set a to (get replaceText("o", "O", a))
set a to (get replaceText("p", "P", a))
set a to (get replaceText("q", "Q", a))
set a to (get replaceText("r", "R", a))
set a to (get replaceText("s", "S", a))
set a to (get replaceText("t", "T", a))
set a to (get replaceText("u", "U", a))
set a to (get replaceText("v", "V", a))
set a to (get replaceText("w", "W", a))
set a to (get replaceText("x", "X", a))
set a to (get replaceText("y", "Y", a))
set a to (get replaceText("z", "Z", a))
return a
end capitalize
And, of course, the opposite,
--Lowercase 1.0.1
--Copyright © Panah Neshati, 2011.
on replaceText(find, replace, subject)
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to find
set subject to text items of subject
set text item delimiters of AppleScript to replace
set subject to "" & subject
set text item delimiters of AppleScript to prevTIDs
return subject
end replaceText
on lowercase(a)
set a to (get replaceText("A", "a", a))
set a to (get replaceText("B", "b", a))
set a to (get replaceText("C", "c", a))
set a to (get replaceText("D", "d", a))
set a to (get replaceText("E", "e", a))
set a to (get replaceText("F", "f", a))
set a to (get replaceText("G", "g", a))
set a to (get replaceText("H", "h", a))
set a to (get replaceText("I", "i", a))
set a to (get replaceText("J", "j", a))
set a to (get replaceText("K", "k", a))
set a to (get replaceText("L", "l", a))
set a to (get replaceText("M", "m", a))
set a to (get replaceText("N", "n", a))
set a to (get replaceText("O", "o", a))
set a to (get replaceText("P", "p", a))
set a to (get replaceText("Q", "q", a))
set a to (get replaceText("R", "r", a))
set a to (get replaceText("S", "s", a))
set a to (get replaceText("T", "t", a))
set a to (get replaceText("U", "u", a))
set a to (get replaceText("V", "v", a))
set a to (get replaceText("W", "w", a))
set a to (get replaceText("X", "x", a))
set a to (get replaceText("Y", "y", a))
set a to (get replaceText("Z", "z", a))
return a
end lowercase
While it’s not exactly efficient coding, it certainly gets the job done. I’m working on making an improved version that gets the ASCII number of the input, adds 32, and gets the new ASCII character.
I’ll reply when it’s finished.