• 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: How to deal with Asynchronous Finder operations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to deal with Asynchronous Finder operations


  • Subject: Re: How to deal with Asynchronous Finder operations
  • From: "John C. Welch" <email@hidden>
  • Date: Fri, 16 Sep 2005 11:54:46 -0500
  • Thread-topic: How to deal with Asynchronous Finder operations

Title: Re: How to deal with Asynchronous Finder operations
On 9/16/05 11:37, "John C. Welch" <email@hidden> wrote:

>> That's the exact opposite of what Kumar said he wanted to do. He said he
>> *wanted* to wait until the trash is empty.
>>
>> One possibility (I have not tried this) might be to loop with a delay and
>> see whether the trash is in fact empty yet...? m.
>
> Um...couldn't you use a folder action with this? The  "removing folder items
> from, and whenever it kicked off, run a handler that checks the contents of
> the folder. once it's empty then run the script. You might still have to
> loop it, but you could reduce the overhead a bit maybe, and that way, you'd
> only have to worry about the actual emptying of the trash.
>
> It could be a better starting point?

As a followup, if you attached this code to a "remove items from" folder action, I think you would get the desired result (assuming that folder action works on the Trash):

set theTest to path to the trash
set theTestR to info for theTest
repeat while (size of theTestR) is greater than 0.0
   set theTestR to info for theTest
end repeat
display dialog "trash emptied"

If you wanted to empty the trash and all manually, then this would work too:

set theTest to path to the trash
set theTestR to info for theTest
tell application "Finder"
    
empty
end tell
repeat
while (size of theTestR) is greater than 0.0
   set theTestR to info for theTest
end repeat
display dialog "trash emptied"

My (quick) tests showed that the second script works well enough.

--
Some days, you just have to pimp - slap people with the hard, cold glove of reality.

john c welch
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: How to deal with Asynchronous Finder operations (From: "John C. Welch" <email@hidden>)

  • Prev by Date: Re: How to deal with Asynchronous Finder operations
  • Next by Date: Running scripts from cron AND passing arguments. A solution.
  • Previous by thread: Re: How to deal with Asynchronous Finder operations
  • Next by thread: Re: How to deal with Asynchronous Finder operations
  • Index(es):
    • Date
    • Thread