Once I found here on the BBS a script that would do fast capitalisation of (ascii-text) strings. Does anyone recall that…?
This might work (not tested extensively):
set foo to convertToUpperCase("a bc d e fgh ijkl m n o pqrs t u v wxy z")
display dialog foo
on convertToUpperCase(targetString)
set convertedString to ""
repeat with thisChar in targetString
if (ASCII number of thisChar) is greater than 96 then
set convertedString to convertedString & (ASCII character ((ASCII number of thisChar) - 32))
else
set convertedString to convertedString & thisChar
end if
end repeat
return convertedString
end convertToUpperCase
Rob,
Thanks, you got me on the right track.
Your conversion might improve on diacriticals with the following code:
set kLowerCase to text items of "abcdefghijklmnopqrstuvwxyzáéíóúäëïöüâêîôûñãõàèìòùåçæœø"
set kUpperCase to text items of "ABCDEFGHIJKLMNOPQRSTUVWXYZÁÉÍÓÚÄËÏÖÜÊÎÔÛÑÃÕÀÈÌÒÙÅÇÆŒØ"
on MakeMaj(s)
set x to ASCII number of s
if (x ≥ 65) and (x ≤ 90) then return s
if (x ≥ 97) and (x ≤ 122) then return ASCII character of (x - 32)
if s is "à" then return "À"
if s is "é" then return "É"
if s is "è" then return "È"
if s is "ê" then return "Ê"
return s
end MakeMaj
repeat with i from 1 to number of text items of kLowerCase -- or 27...
set rr to character i of (kLowerCase as string)
set rr1 to character i of (kUpperCase as string)
display dialog rr & " -> " & MakeMaj(rr1)
end repeat