Note that the system scrap can (and very often does) contain multiple "flavors" of data...one common combination is 'TEXT' plus 'styl' (together forming styled text of the sort that the TE part of the toolbox understands) plus 'PICT' (a QuickDraw picture of the data) and perhaps 'xxxx' as well...a private type known to the application which placed the data into the system scrap. The ordering is significant: the creating application places its flavors in the order in which it prefers them (so the private form would usually be first). At 23:05 +0100 4/14/2000, Alan Fry wrote: >At 7:08 am -0400 14/04/00, Chris Nandor wrote: > >>BTW, here is what I came up with: >> >>#!perl -w >># get >>use Mac::LowMem; >>my $lmh = LMGetScrapHandle(); >>my $type = $lmh->get(0, 4); >>my $len = unpack 'l', $lmh->get(4, 8); >>print $lmh->get(8, $len) if $type eq 'TEXT'; > >Interesting -- in MPWrite the 'get' subroutine runs: > >sub get_scrap { > my $str = $lmh->get; > my @clip = unpack("a4La*", $str); > if ($clip[0] eq 'TEXT') { > return substr($clip[2], 0, $clip[1]) > } >} > >which boils down to pretty much the same thing I think? > >>#!perl -w >># set >>use Mac::LowMem; >>my $lmh = LMGetScrapHandle(); >>my $text = 'fooooo'; >>my $hand = 'TEXT' . pack('l', length($text)) . $text; >>$lmh->set(0, length($hand), $hand); > >In MPWrite it goes: > >my $len = $lmh->size; >$lmh->set(0, $len, 'TEXT'.pack("L", length $str).$str); > >which is not quite the same. It was some time ago and the details >have got a bit hazy but I think $len should be an offset and not the >length of the string being set. > >There are some mysteries. For example LM will not always get the >whole of a long string put on the clipboard by BBEdit for example. >Then there is 'public' and 'private' scrap and I was never able to >get to the bottom of, for example, how TE makes transfers from one to >the other, or even where TE puts its private scrap. > >Alan Fry > > >==== Want to unsubscribe from this list? >==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org -- John Baxter jwblist@olympus.net Port Ludlow, WA, USA ==== Want to unsubscribe from this list? ==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org