set textReturned to text returned of (display dialog "Type characters to convert to Greek:" default answer "")
set textReturned to every character in textReturned
repeat with char in textReturned
set hexCode to missing value
considering case
if char contains "a" then set hexCode to "03B1"
if char contains "b" then set hexCode to "03B2"
if char contains "g" then set hexCode to "03B3"
if char contains "d" then set hexCode to "03B4"
if char contains "e" then set hexCode to "03B5"
if char contains "z" then set hexCode to "03B6"
if char contains "h" then set hexCode to "03B7"
if char contains "q" then set hexCode to "03B8"
if char contains "i" then set hexCode to "03B9"
if char contains "k" then set hexCode to "03BA"
if char contains "l" then set hexCode to "03BB"
if char contains "m" then set hexCode to "03BC"
if char contains "n" then set hexCode to "03BD"
if char contains "x" then set hexCode to "03BE"
if char contains "o" then set hexCode to "03BF"
if char contains "p" then set hexCode to "03C0"
if char contains "r" then set hexCode to "03C1"
if char contains "s" then set hexCode to "03C3"
if char contains "t" then set hexCode to "03C4"
if char contains "u" then set hexCode to "03C5"
if char contains "f" then set hexCode to "03D5"
if char contains "c" then set hexCode to "03C7"
if char contains "y" then set hexCode to "03C8"
if char contains "w" then set hexCode to "03C9"
if char contains "A" then set hexCode to "0391"
if char contains "B" then set hexCode to "0392"
if char contains "G" then set hexCode to "0393"
if char contains "D" then set hexCode to "0394"
if char contains "E" then set hexCode to "0395"
if char contains "Z" then set hexCode to "0396"
if char contains "H" then set hexCode to "0397"
if char contains "Q" then set hexCode to "0398"
if char contains "I" then set hexCode to "0399"
if char contains "K" then set hexCode to "039A"
if char contains "L" then set hexCode to "039B"
if char contains "M" then set hexCode to "039C"
if char contains "N" then set hexCode to "039D"
if char contains "X" then set hexCode to "039E"
if char contains "O" then set hexCode to "039F"
if char contains "P" then set hexCode to "03A0"
if char contains "R" then set hexCode to "03A1"
if char contains "S" then set hexCode to "03A3"
if char contains "T" then set hexCode to "03A4"
if char contains "U" then set hexCode to "03A5"
if char contains "F" then set hexCode to "03A6"
if char contains "C" then set hexCode to "03A7"
if char contains "Y" then set hexCode to "03A8"
if char contains "W" then set hexCode to "03A9"
end considering
if hexCode is not missing value then
set characterNumber to convertHexToNumber(hexCode)
tell application "Microsoft Word"
set theRange to text object of the selection
set content of theRange to ""
insert symbol at theRange character number characterNumber with unicode
tell selection to set selection start to selection start + 1
end tell
end if
hexCode
end repeat
(* Courtesy of Qwerty Denzel's post *)
on convertHexToNumber(hexString)
if hexString starts with "0x" then set hexString to text 3 thru -1
set n to 0
set s to 16 ^ ((count of hexString) - 1)
repeat with c in hexString
ignoring case
tell (offset of c in "abcdef") + 9 to if it > 9 then set c to it
end ignoring
set n to n + c * s
set s to s div 16
end repeat
return n
end convertHexToNumber