• 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: Copy file across volumes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy file across volumes


  • Subject: Re: Copy file across volumes
  • From: Simon Forster <email@hidden>
  • Date: Thu, 28 Jul 2005 19:08:44 +0100


On 28 Jul 2005, at 16:25, Gary (Lists) wrote:

"Simon Forster" wrote:


If I get the Finder to copy the files, occasionally I've received a
"Finder is busy" message. I suppose I could trap for this error but
then how?

From least specific to most...


To "trap" for an error, you use a 'try...on error...end try' block of code.


try
    tell app "Finder" to -- do some stuff
on error errMsg_ number errNum_
    return {errNum_, errMsg_}
    -- or whatever else
end try

Sorry. I wasn't specific at all. I know about try blocks. My question was more about how to capture the error and then retry - presumably a set number of times before finally failing. But then I've just gone and answered my own question really.



Okay, that's that. But, in your case, when you are copying a file, what you
probably want to do is to wait until the file is finished before moving on.


To do that, you don't need the Finder. Use the 'busy status' property of
the file information record you get from the 'info for' command.


tell app "Finder" -- to do some copying with 'f'
...
repeat until busy status of (get info for f) is false
    -- wait, twiddle thumbs
end repeat

OR

repeat while busy status of (get info for f) is true
    -- wait, twiddle thumbs
end repeat

Both of those repeat formats work for me, X.3.9. That may work for your
application as well.

Useful - in that it's sparked a line of thought for why a completely different (AppleScript) app throws the "Finder is busy" error - but not so useful here in that the calling app doesn't (call) until the file is completely written out.


OK. I'll just script the Finder for this I think.

ATB

Simon Forster
_____________________________________________________
 LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
 Tel: +44 (0)70 9230 5244   Fax: +44 (0)70 9230 5247
_____________________________________________________

In theory, theory and practice are the same.
In practice, they're not.

_______________________________________________
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: Copy file across volumes (From: "Gary (Lists)" <email@hidden>)

  • Prev by Date: Re: shallow vs deep copying [was Re: Applescript-users Digest, Vol 2, Issue 492]
  • Next by Date: Re: Copy file across volumes
  • Previous by thread: Re: Copy file across volumes
  • Next by thread: Re: Copy file across volumes
  • Index(es):
    • Date
    • Thread