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

Re: [MacPerl] Deleting files & interaction with AppleScript



At 10.09 -0500 1999.01.07, Bart Lateur wrote:
>	use Mac::Files;
>	while($file = shift) {
>		my($volume)= $file=~/^([^:]+):/;
>		my $trash = FindFolder($volume, kTrashFolderType);
>		print "Volume = $volume, Trash folder = $trash\n";
>	}

FindFolder takes a VREFID, not a volume name.

#!perl -wl
use Mac::Files;
use Mac::MoreFiles;
use strict;

# ex 1
for my $vol (MacPerl::Volumes()) {
    print FindFolder(hex(substr($vol, 1, 4)), kTrashFolderType);
}

# ex 2
my $file = 'Bourque:Desktop Folder:mytestfile';
(my $vol = $file) =~ s/^(.*?:).*$/$1/;

print FindFolder(hex(substr(MacPerl::MakeFSSpec($vol), 1, 4)),
    kTrashFolderType);

__END__

Note that MacPerl::Volumes() returns FSSpecs, and so in the second example,
you need to run MacPerl::MakeFSSpec() on $vol first.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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