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

Re: [MacPerl] Understanding glue pods



At 13.57 -0700 1999.10.26, Brian McNett wrote:
>Okay, So I dropped BBEdit on "gluemac".  WOW!  Major HUGELY scriptable
>app!  Unfortunately the POD gets a bit opaque, so I need help.
>
>What I'm trying to do is have BBEdit run a Perl filter, then select the
>entire output and run a second Perl filter on that.  I can work out how
>to get BBEdit to launch the filters, but I'm having trouble understanding
>what's meant by:
>
>$obj->select(obj)
>
>		Select the specified object (misc/slct)
>
>BBEdit's docs aren't particularly clear either (from a Perl standpoint,
>having been written with Applescript in mind (not really BareBones'
>fault),

Well, moving away from what you are intending to do with it, the basic idea
is this:

    use Mac::Glue ':all';
    $bb = new Mac::Glue 'BBEdit';
    $bb->select( $bb->obj(characters => gAll(), document => 1) );
    print $bb->get( $bb->prop(selected_text => document => 1) );

The obj() and prop() stuff is discussed in the Mac::Glue docs.

Or if you want to get all the text anyway, you can avoid the select part:

    use Mac::Glue ':all';
    $bb = new Mac::Glue 'BBEdit';
    print $bb->get( $bb->prop(window_text => document => 1) );

But it seems you just want to select it, so you can do:

    $bb->select( $bb->obj(characters => gAll(), document => 1) );

Or the somewhat simpler:

    $bb->select( $bb->obj(characters => document => 1) );

(When a plural is not followed by a modifier like gAll or something, then
it is taken to mean "all" and it needs no value following it; this is
explained in the Mac::Glue docs, too.)

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

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