• 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: Why won't the trash empty?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why won't the trash empty?


  • Subject: Re: Why won't the trash empty?
  • From: email@hidden
  • Date: Sun, 17 Dec 2000 19:41:46 EST

In a message dated 12/17/00 7:20:42 PM,
email@hidden writes:

>I've written this script as a stay-open app and everything works
>fine...except the trash doesn't get emptied! If I run it from as a
>regular script from the editor to test it (no handlers, etc) it works
>fine. So, any idea what's up?

I've had the same problem. It turned out to be a timing error. From Script
Editor, it does not execute as quickly, so the trash has time to get the
files. When run otherwise, it's moving a little faster and the item(s) are
not in the trash yet. Here's how I fixed it:

tell application "Finder"
set sel to selection
if not (sel = {}) then
move sel to trash
(item 1 of contents of trash) as text
empty
end if
end tell

By adding the line "(item 1 of contents of trash) as text", it causes just
enough of a delay to allow the items to show up and the empty command works
correctly. This was contributed to me by someone else on this list last year.

Ken Fleisher
email@hidden


  • Prev by Date: Re: newest file in a folder
  • Next by Date: Re: Booleans in positional parameter sub routines
  • Previous by thread: Re: Why won't the trash empty?
  • Next by thread: Re: applescript-users digest, Vol 2 #141 - 12 msgs
  • Index(es):
    • Date
    • Thread