tags:

views:

53

answers:

1

I mean the right way must able to "Put Back" in Finder and isn't playing sound

Here are the methods I tried so far:

NSString * name  = @"test.zip";
 NSArray  * files = [NSArray arrayWithObject: name];

 NSWorkspace * ws = [NSWorkspace sharedWorkspace];

 [ws performFileOperation: NSWorkspaceRecycleOperation
       source: @"/Users/"
     destination: @""
        files: files
       tag: 0];

Downturn : can't "Put Back" in Finder

OSStatus status = FSPathMoveObjectToTrashSync(
              "/Users/test.zip",
              NULL,
              kFSFileOperationDefaultOptions
 );

Downturn : can't "Put Back" in Finder

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

Downturn : playing sound so it's annoying if I execute it repeatedly

A: 

I think if you want "put back" then applescript is the way to go. I was able to do it without any sound by muting the volume, moving the file, then unmuting the volume. Note I needed a delay to get it to work.

set f to (path to desktop folder as text) & "myFile.txt"
set volume with output muted
tell application "Finder" to move file f to trash
delay 1
set volume without output muted
regulus6633