Delete a currently-open file directly in the application?
I use this AppleScript:

tell application (path to frontmost application as text)
    set f to POSIX file (path of document 1) as text
    close document 1
end tell
tell application "Finder" to move f to trash


A hackier version that works with a few more applications:

try
    tell document 1 of application (path to frontmost application as text)
        set f to path
        close
    end tell
on error
    tell application "System Events" to tell (process 1 whose frontmost is true)
        value of attribute "AXDocument" of window 1
        set f to do shell script "x=" &amp; quoted form of result &amp; ";x=${x/#file:\\/\\/};x=${x/#localhost/};printf ${x//%/\\\\x}"
        keystroke "w" using command down
    end tell
end try
POSIX file f
tell application "Finder" to move result to trash