dot dot - 1 year ago 66
AppleScript Question

Turn number in to it's alphabet character equivalent in Applescript

How do I turn a number in to the equivalent letter? Like this?

0 => a
1 => b
2 => c
3 => d


Answer Source

This doesn't require a look-up list...

set aNum to 0
set theChar to character id (aNum + 97)

If you're also interested in capital letters something like this would do...

set aNum to 0
set lowerCaseNum to 97
set upperCaseNum to 65

set lowercaseChar to character id (aNum + lowerCaseNum)
set uppercaseChar to character id (aNum + upperCaseNum)
return {lowercaseChar, uppercaseChar}