[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] victim of background copying?



D.Thomas@vthrc.uq.edu.au (Danny Thomas) writes:
}Hello, I'm writing a simple MacPerl script to move/copy files around and
}thought I'd get Finder to do the actual work ... but it seems the AS
}fragment returns before the operation completes. Presumably the Finder
}queues up a sequence of operations, but my trouble is that some later ones
}depend on folders copied during earlier operations. Is there a way I can
}make the following wait until the operation completes?

Applescript is asynchronous.  A fact of life that one must live with.
*Never* rely on one action finishing before another begins when using
Applescript.  (This has interesting consequences when running the same
Applescript on machines of different speed, where things happen in
different orders.)

[snip]
}
}cheers,
}Danny Thomas  <D.Thomas@vthrc.uq.edu.au>
}
}PS not surprisingly, the Finder Scripting docs don't mention this because
}'background' copying was a recent addition to the Finder. Nor does anything
}look promising in the dictionary of Finder 7.5.6
}
}PPS the cc to the MacPerl list is in case there's an existing module to do
}this, but Mac::Files doesn't seem to fit the bill.

It's called File::Copy, and Matthias has rewritten it so that it copies the
entire file (both forks), so it's appropriate for what you want to do.

use File::Copy;

copy($from,$to); #$to contains the new path

Shuck will give you the gory details if you point it at :lib:File:Copy.pm.

---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch