开发者

Delete file without playing sound in Applescript?

开发者 https://www.devze.com 2023-01-01 00:16 出处:网络
tell application \"Finder\" set deletedfile to alias \"Snow Leopard:Users:test.pdf\" delete deletedfile
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

精彩评论

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

关注公众号