Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on run
- set x to path to frontmost application as string
- tell application x to if exists document 1 then
- try
- try
- set p to path of front document -- some app use --> path of document
- p
- on error
- set p to file of front document -- some app use --> file of document
- end try
- my moveToTrash(p)
- close front document
- on error
- my speakText("can't delete this document")
- end try
- else
- my speakText("You have no open document in that application")
- end if
- end run
- on moveToTrash(p)
- if p starts with "/" then -- some app return posix path
- set tFile to p as POSIX file as alias
- else -- some app return HFS path
- set tFile to p as alias
- end if
- tell application "Finder" to delete tFile
- end moveToTrash
- on speakText(t)
- say t
- end speakText
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement