Re: How to deal with Asynchronous Finder operations
Re: How to deal with Asynchronous Finder operations
- Subject: Re: How to deal with Asynchronous Finder operations
- From: deivy petrescu <email@hidden>
- Date: Thu, 15 Sep 2005 19:01:57 -0400
On Sep 15, 2005, at 13:42, Andrew Oliver wrote:
On 9/15/05 2:21 AM, "Kumar Shailove" <email@hidden> wrote:
Hi list,
Finder operations are asynchronous, i.e. if I execute the following
script -
tell application "Finder"
empty trash
display dialog "abc"
end tell
If the Trash is taking, say, 5 minutes to become empty, the dialog is
displayed and the script execution completes. I want to wait until
the
statement in the first line has been executed (or more precisely I
should say, the operation corresponding to this statement should be
completed) and then only the script should proceed with the next
statement(s). Any ideas ?
Use the standard Applescript 'ignoring application responses':
ignoring application responses
tell application "Finder"
empty trash
end tell
end ignoring
display dialog "ABC"
Since you're ignoring the response of the Finder's empty trash
command, the
rest of the script is free to proceed.
Andrew
:)
I think he meant the other way around. He wants to wait for the Finder.
This should do it:
<script>
set k to path to "trsh" as string
tell application "Finder"
empty trash
repeat
if (count of (get contents of (alias k))) = 0 then exit repeat
end repeat
end tell
display dialog "done"
</script>
_______________________________________________
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