I’m trying to write a script to convert names in Excel to their proper punctuation. So if a cell shows “george washington”, my script will change it to “George Washington”. To do this, I’m reading the text of the names in Excel by their ASCII characters to determine if the letters are capitalized or not.
I ran into a problem with names like “GEORGE WASHINGTON”, where every letter is capitalized.
I know I can break down that name with AppleScript into ASCII characters like this:
set theName_ascii to {}
repeat with a from 1 to the count of characters in theName
set the end of theName_ascii to (ASCII number of (character a of theName))
end repeat
And I know that the “EORGE” and “ASHINGTON” parts of the names are what need to be in lower case letters. Looking at the ASCII charts, I know that each one of those letters “E”, “O”, “R”, ect… represented by their respective ASCII characters need to be added by 32 each to get to their lower case letters.
Is there a way in AppleScript to add 32 to each “item” of the text in the Excel cell after breaking it down into ASCII characters?
In English, I’d say “For each character in the variable theName_ascii, add 32”. And the results would be such that each letter would now be represented by their lowercase ASCII character.