-- ASCIInumbers  
-- The script shows the ASCII number of a character user defines or some numbers of control characters.

-- 2000 Tuomas Rosberg <vanhentunut>
-- Lähdekoodi on ilmaista ja tarkoitettu yleiseen käyttöön (public domain).
-- Sitä lainattessa kirjoittajan nimi on mainittava.
-- Koodilla ei ole mitään takuuta, ja sen sisältävää ohjelmaa käyttävät
-- toimivat omalla vastuullaan.
on run
   set theChar to "å"
   display dialog "Type any alphanumeric character and hit OK." & return & ¬
      "To check the numbers of control characters," & return & ¬
      "select “Ctrl chars”." default answer theChar buttons {"Ctrl Chars", "Cancel", "OK"} default button 3
   if button returned of result is "OK" then
      set theChar to text returned of result
      if theChar is not "" then
         set theChar to item 1 of theChar
         set theNumber to (ASCII number of theChar)
         display dialog "The ASCII number of  “" & theChar & "”  is " & space & theNumber buttons {"OK"} default button 1
      end if
   else if button returned of result is "Ctrl Chars" then
      display dialog ¬
         "The ASCII numbers of control characters: " & return & return & ¬
         "home 1, enter 2, end 4, help 5, delete 8," & return & ¬
         "tab 9, pg up 11, pg down 12, return 13," & return & ¬
         "any function key 16, escape 27," & return & ¬
         "left arrow 28, right arrow 29, up arrow 30," & return & ¬
         "down arrow 31, del 127." & return & ¬
         "Have a nice day." buttons {"OK"} default button 1
   end if
end run