script to close topmost document and move it to trash

i’m wondering if a script like this already exists - have been looking for it but in vain.

i often myself in the situation that i download a file (mostly doc, pdf, or mp3), take a look at it and realize that i don’t want to keep it. but in order to trash it, i have to close the file, bring up finder or desktop, find it and delete it. sometimes that’s super annoying if the desktop is cluttered and the file has a weird name…

so… is there an applescript that could identify the topmost file open, that could close it and then move it to trash.

if you know of it, please let me know.

all best,
psychomachine

It could be done easily in a scriptable application with a good dictionary, but you can’t create a “universal” script. For instance, Preview is not scriptable, etc.
The best method I know is command+click the document name, then choosing the enclosing folder. Such method works in nearly all applications and it reveals and select in the Finder the document, which makes easy moving it to the Trash.