The script below will create outlines of every text item on the active InDesign document, if you wanted to point it to a particular selection you've made then you would set myTextFrames to the selection and repeat through that if there was more than one text item selected.
tell application "Adobe InDesign CS5"
set myTextFrames to every text frame of the active document
repeat with thisOne in myTextFrames
create outlines thisOne
Thanks for you reply. It is working in indesign. Can this same code be applied to Illustrator.
Unfortunately the scripting language is a little different between each program in the Creative Suite. In the case of Illustrator it looks like this:
tell application "Adobe Illustrator"
set myText to every text frame of current document
repeat with thisOne in myText
tell thisOne to convert to paths