开发者

Delete file without playing sound in Applescript?

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

The problem is I repeatedly ca开发者_如何学Pythonll this script from my Cocoa application so the sound is played repeatedly too. Is it possible to disable that sound ?


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


one simple way (doesn't move to Trash)

do shell script "rm '/Users/test.pdf'"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜