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

Re: [MacPerl] Changing CDs during a script.



At 13.52 1998.04.08, WESTMJ@ESVAX-MAIL.ES.DUPONT.COM wrote:
>What is the easy way to pause the script so that I can get to the desktop
>and  eject the CD?

You might want to instead eject the CD from the script.  This will eject
every CD whose name matches /Audio CD \d+/ (which should be all of them,
AFAIK).

Code from Alan Fry.

#!perl -w
use Mac::AppleEvents;
use Mac::Files;
my($volume, $alias, $evt, $rep) = MacPerl::Volumes();

foreach my $vol (MacPerl::Volumes()) {
  if ($vol =~ /:(Audio CD \d+)/) {
    $volume = $1 . ':';
    $alias = NewAliasMinimal $volume;

    $evt = AEBuildAppleEvent('fndr', 'ptwy',
      typeApplSignature(), 'MACS', 0, 0,
      q"'----':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