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

Re: [MacPerl] list of volumes (was UnmountVol)



At 10.00 1998.02.11, Kevin Walker wrote:
>Thanks to those who submitted applescript solutions to the UnmountVol
>problem (and, in advance, to Matthias for adding the toolbox call to the
>next release of MacPerl).
>
>Now I need a way to locate the (audio) CD that I want to unmount and eject.
>
>(1) If I could obtain a list of noames of mounted volumes (or a list of
>everything which shows up on the desktop, including the mounted volumes),
>I'd be happy to search for the volume name via /^Audio CD [0-9]+$/, and
>then plug into the above mentioned applescript methods.  But I can't figure
>out how obtain such a list.  Is there a magic pathname I can plug into
>opendir/readdir?

You can use MacPerl::Volumes() to return a list of all mounted volumes.


>(2) I already have (from another source) the vRefNum for the CD I want to
>unmount.  Is there a way to modify
>
>  $alias = NewAliasMinimal("theVolume:");
>  $evt = AEBuildAppleEvent('fndr', 'ptwy', 'sign', 'MACS', 0, 0,
>  "'----':alis(\@\@)", $alias) or die $^E;
>
>so that it works with a vRefNum instead of the name of the volume?

You can try something like NewAliasMinimal(FSMakeFSSpec(VREF, DIRID,
NAME)).  Make DIRID 2 and NAME ''.  That should work.  In fact, this does
work (it unmounted my CD, even with file sharing on ;-):

#!perl -wl
use Mac::Files;

#!perl
use Mac::AppleEvents;
use Mac::Files;

$vref = FSpGetCatInfo("CW11 Gold Tools:")->ioVRefNum();

$alias = NewAliasMinimal(FSMakeFSSpec($vref, 2, ''));

$evt = AEBuildAppleEvent('fndr', 'ptwy', 'sign', 'MACS', 0, 0,
"'----':alis(\@\@)", $alias) or die $^E;

$rep = AESend($evt, kAEWaitReply) or die $^E;

AEDisposeDesc $evt;
AEDisposeDesc $rep;

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#



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