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

[MacPerl] victim of background copying?



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?

for what it's worth: 7200 / US 7.6.1 / MacPerl 5.1.3r2

sub  finder_do ($$$$)
{
    my ($name, $op, $type, $from, $to) = @_;
    # $op can be "copy" or "move"
    # $type can be "file" or "folder"

    # neglecting the checks of $from & $to being valid paths...
    $res = MacPerl::DoAppleScript(<<"    END_SCRIPT");
    tell application "Finder"
        $op $type \"$from\" to folder \"$to\"
    end tell
    END_SCRIPT
    printf "'$name'; $op '$from' -> '$to'\n"
        if $VERBOSE;
}

finder_do("HyperCard", "copy", "folder", "$SRC_UTILG:HyperCard Player", $SYSU);

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.



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