views:

70

answers:

3
tell application "Finder"
    set deletedfile to alias "Snow Leopard:Users:test.pdf"
    delete deletedfile
end tell

The problem is I repeatedly call this script from my Cocoa application so the sound is played repeatedly too. Is it possible to disable that sound ?

A: 

one simple way (doesn't move to Trash)

do shell script "rm '/Users/test.pdf'"
cobbal
Sorry, forgot to mention that I need to delete to trash
Irwan
A: 

How to move an item to the Trash. (That question was about symlinks, but that doesn't matter.)

Peter Hosey
A: 

Since the trash is just an invisible folder inside your home folder you can do this...

set myFile to (path to desktop folder as text) & "myFile.txt"
set trashFolder to path to trash folder from user domain

do shell script "mv " & quoted form of POSIX path of myFile & space & quoted form of POSIX path of trashFolder
regulus6633