The script below displays the path of the frontmost finder item in a dialog. Is it possible to do something like this with the foremost text edit document?
#display path of frontmost finder item in dialog
tell application "Finder"
set pathOfSelectedFinderItem to (folder of the front window) as text
display dialog pathOfSelectedFinderItem
end tell