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

Re: [MacPerl] Toolbox help



At 07.24 1998.04.23, Paul J. Schinder wrote:
>Almost no control panel is scriptable.  What you need is the "Jon's
>Commands" OSAX, the one that everyone should have:
><http://www.seanet.com/%7Ejonpugh/>.  That will allow you to change monitor
>resolution and depth with AppleScript.
>
>Not that I'd discourage you from doing this in MacPerl if you want, but
>there are some (few, simple, don't expect it to work from Mac to Mac, and
>forget cross-platform...) things that AppleScript is actually good for.

#!perl -w
use Mac::AppleEvents;
use strict;
my($evt, $rep);

$evt = AEBuildAppleEvent(qw/aevt stdp sign MACS 0 0/, "'----':16");
$rep = AESend($evt, kAEWaitReply());

for ($evt, $rep) {
  print AEPrint($_), "\n";
  AEDisposeDesc($_);
}


I also have this, which works with some other OSAX, from the GTQ scripting
library that used to come with Mac OS.  It let you change between
color/greyscale and pick which mointor.  But I don't have that OSAX
anymore.

#!perl -w
package Monitor;
use Mac::AppleEvents;
use strict;
sub setdepth {
  my($depth, $mon, $col, $evt, $rep) = @_;
  $evt = AEBuildAppleEvent(
    'gtqp', 'dpth', typeApplSignature(), 'MACS', 0, 0, ''
  ) || die $^E;
  AEPutParamDesc($evt, 'dept', (AEBuild($depth)))  if (defined $depth);
  AEPutParamDesc($evt, 'devc', (AEBuild($mon)))    if (defined $mon);
  AEPutParamDesc($evt, 'CoLr', (AEBuild($col)))    if (defined $col);
  $rep = AESend($evt, kAEWaitReply) || die $^E;

  for ($evt, $rep) {
    print AEPrint($_), "\n";
    AEDisposeDesc($_);
  }
}
package main;
Monitor::setdepth(16, 0, 0);  #change first monitor to 8-bit greyscale

--
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