This will convert any number from 1 to 9,999 into a word. I am aware that I could have shaved a few more lines off with an ignore error command and I could have made it work with negatives, decimals, and fractions with three more arrays. I am also aware that I could have made it work up to trillions. But I did it this way because I made this script as a school requirement so I am just showing it to you. Lastly, I didn’t make notes because I had to keep it in limited space for my school to accept it.

```
property num : ""
tell application "Finder"
display dialog "Input Number:" with title "Num2WordConverter" default answer num
set num to text returned of result
set thousandsList to {"one thousand", "two thousand", "three thousand", "four thousand", "five thousand", "six thousand", "seven thousand", "eight thousand", "nine thousand", "zero"}
set hundredsList to {"one hundred", "two hundred", "three hundred", "four hundred", "five hundred", "six hundred", "seven hundred", "eight hundred", "nine hundred", "zero"}
set tensList to {"teenies", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", "zero"}
set teeniesList to {"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen", "zero"}
set onesList to {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "zero"}
set userInput to items of num
set helper to 4
set initiallimiter to count of userInput
set thisisFirst to 1
if item 2 of userInput is "," and initiallimiter is equal to 5 then
set item 2 of userInput to item 3 of userInput
set item 3 of userInput to item 4 of userInput
set item 4 of userInput to item 5 of userInput
set userInput2 to (items 1 thru 4 of userInput)
set userInput to (items 1 thru 4 of userInput2)
end if
set limitofAll to count userInput
set initiallimiter to count of userInput
repeat until limitofAll is 0
if limitofAll is greater than 4 then
display dialog "Too many"
set limitofAll to 0
else if limitofAll is equal to 4 and thisisFirst is equal to 1 then
set helper to (limitofAll - (limitofAll - 1))
set thisisFirst to 0
set bug to item helper of userInput
set final to item bug of thousandsList
set limitofAll to limitofAll - 1
else if limitofAll is equal to 4 then
set helper to (limitofAll - (limitofAll - 1))
set bug to item helper of userInput
set final to item bug of thousandsList
set limitofAll to limitofAll - 1
else if limitofAll is equal to 3 and thisisFirst is equal to 1 then
set helper to (limitofAll - (limitofAll - 1))
set thisisFirst to 0
set bug to item helper of userInput
set final2 to item bug of hundredsList
set limitofAll to limitofAll - 1
else if limitofAll is equal to 3 then
set helper to helper + 1
set bug to item helper of userInput
set final2 to item bug of hundredsList
set limitofAll to limitofAll - 1
else if limitofAll is equal to 2 and thisisFirst is equal to 1 then
set helper to (limitofAll - (limitofAll - 1))
set thisisFirst to 0
set bug to item helper of userInput
set final3 to item bug of tensList
set limitofAll to limitofAll - 1
else if limitofAll is equal to 2 then
set helper to helper + 1
set bug to item helper of userInput
set final3 to item bug of tensList
set limitofAll to limitofAll - 1
else if limitofAll is equal to 1 and thisisFirst is equal to 1 then
set helper to (limitofAll - (limitofAll - 1))
set thisisFirst to 0
set bug to item helper of userInput
set final4 to item bug of onesList
set limitofAll to limitofAll - 1
else if limitofAll is equal to 1 then
set helper to helper + 1
set bug to item helper of userInput
set final4 to item bug of onesList
set limitofAll to limitofAll - 1
else
nullplace
end if
end repeat
if initiallimiter is equal to 4 and final3 is equal to "teenies" then
display dialog "" & final & ", " & final2 & " " & item bug of teeniesList & ""
else if initiallimiter is equal to 4 then
display dialog "" & final & ", " & final2 & " " & final3 & " " & final4 & ""
else if initiallimiter is equal to 3 and final3 is equal to "teenies" then
display dialog "" & final2 & " " & item bug of teeniesList & ""
else if initiallimiter is equal to 3 then
display dialog "" & final2 & " " & final3 & " " & final4 & ""
else if initiallimiter is equal to 2 and final3 is equal to "teenies" then
display dialog item bug of teeniesList
else if initiallimiter is equal to 2 then
display dialog "" & final3 & " " & final4 & ""
else if initiallimiter is equal to 1 then
display dialog "" & final4 & ""
end if
set final to 0
set final2 to 0
set final3 to 0
set final4 to 0
end tell
```

Model: MacBook Pro

AppleScript: 2.1

Browser: Safari 532.0

Operating System: Mac OS X (10.6)