1
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 ?

Irwan
  • 783
  • 1
  • 13
  • 28

2 Answers2

1

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
  • 18,848
  • 5
  • 41
  • 49
-1

one simple way (doesn't move to Trash)

do shell script "rm '/Users/test.pdf'"
cobbal
  • 69,903
  • 20
  • 143
  • 156