• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Move a file to the Trash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Move a file to the Trash


  • Subject: Re: Move a file to the Trash
  • From: Charles Srstka <email@hidden>
  • Date: Wed, 6 Nov 2002 17:40:06 -0600

I was going to recommend this, too, but System Events doesn't seem to support moving things to the Trash at present. At the end of the day, you're probably fine using the Finder - even if it's not running, sending it an AppleScript will cause it to launch. The only way it will break is if someone goes and deletes the Finder itself.

The only other method I know of is to move the file to the appropriate trash folder (~/.Trash if the file is on the boot partition, /Volumes/<disk name>/.Trashes/<uid number>/ if it's on some other disk) and using an undocumented API in CoreServices to make the Dock put the "trash full" icon on the Trash can. Much messier than just using AppleScript, IMHO, and certainly more difficult.

Charles

On Wednesday, November 6, 2002, at 10:55 AM, Olivier wrote:

another option would be to script system events
(/System/Library/CoreServices/System Events.app) as this is running in
the background, launch on start and in the system folder, chances of it
not running are smaller (if i remember correctly the finder actually
just forward the event to this guy). The only problem with it, i do not
know if this app is here to stay or not. I seem to remember some
discussion on the applescript mailing list about wether it was safe or
not to use the System Events app instead of the Finder.

Olivier
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Move a file to the Trash
      • From: Ondra Cada <email@hidden>
References: 
 >Re: Move a file to the Trash (From: Olivier <email@hidden>)

  • Prev by Date: Re: To all cocoa developers - new cocoa dev forum
  • Next by Date: Re: Getting thumbnail of document to appear?
  • Previous by thread: Re: Move a file to the Trash
  • Next by thread: Re: Move a file to the Trash
  • Index(es):
    • Date
    • Thread