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

Re: [MacPerl-Toolbox] Oops (Getting/setting clipboard)



At 23.05 +0100 2000.04.14, 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?

Yeah, except the latter saves a couple of get() calls.


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

Ah, perhaps.


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

Yeah, but that happens to me sometimes with any app.  I'll do a copy and go
to another app to paste and it will be a different clipboard.

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

Yeah.

-- 
Chris Nandor       |     pudge@pobox.com      |     http://pudge.net/
Andover.Net        | chris.nandor@andover.net | http://slashcode.com/

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-toolbox-request@macperl.org