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: "Kumar Shailove" <email@hidden>
- Date: Fri, 16 Sep 2005 11:44:32 +0530
- Thread-topic: How to deal with Asynchronous Finder operations
Hey Guys,
Thanks for your valuable responses, the below mentioned scripts are fine
when dealing with Trash, but since in my script, I am concerned about
many of the Finder operations (copy, move, and delete typically) from a
folder to Trash, or possibly, from one folder to another; and sincerely
speaking - there is a larger number of such folders spread over my local
disk as well as over the network, so I can't hard code the paths of all
the folders as well. I just search for a set of folders satisfying a
predefined search criterion and then proceed with different File-Folder
operations.
What I am looking for a generic AppleScript statement which may give me
such a level of flexibility to wait and watch on when that particular
operation gets completed and then only proceed with the next AppleScript
statement (because the further statements are strictly dependent on the
contents of these folders).
Thanks.
-----Original Message-----
From: applescript-users-bounces+kshailove=email@hidden
[mailto:applescript-users-bounces+kshailove=email@hidden]
On Behalf Of deivy petrescu
Sent: Friday, September 16, 2005 4:32 AM
To: applescript
Subject: Re: How to deal with Asynchronous Finder operations
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:
rk.co.in
This email sent to email@hidden
_______________________________________________
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