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

Re: [MacPerl-Modules] OK, Here is Something



At 3:40 PM -0400 5/18/99, Chris Nandor wrote:
>Here is a simple script I have working that takes the contents of the
>frontmost file in BBEdit, gets the file's name, and saves it to a backup
>directory in a file of the same name.
>
>#!perl -wl
>use Mac::Glue;
>use strict;
>
>my $b    = new Mac::Glue "BBEdit";
>my $path = 'Bourque:Desktop Folder:Tabs:T: petetemp:';
>my $text = $b->get($b->p( window_text => document => 1 ))->get;
>my $name = $b->get($b->p( name        => document => 1 ))->get;
>
>open(F, "> $path$name") or die $!;
>print F $text;
>close F;
>
>__END__


Lemme see if I get the syntax you're proposing.

If what I want to do looks like this in AppleScript:

tell application "Finder"
   set the visible of application process "FileMaker Pro" to false
end tell


Would it look like this in the glue?
my $b    = new Mac::Glue "Finder";
$b->set($b->p( visible => application_process
                       => "FileMaker Pro"), 'false');

I realize that you're example was "get" and I'm bastardizing
it to assign a new value to a property.  Is this what you had
in mind?  Just trying to start by understanding the syntax.



>  * Using $b->p() to specify that this is a property.  I would rather I could
>    surmise that automatically, but I don't think I can.  I _could_ export
>    functions named p() and o() or prop() and obj() that would simply mark
>    the contents as objects, and then I could process them specially when
>    they are returned.

I like the prop() and obj() options for legibility.  Esp. 'cos
one of the apps I wanna glue is FileMaker Pro.  And it has
nasty nested objects that I'm gonna want to take in pieces.

For example, to get the value from a field in a database, here's
the AppleScript:

tell application "FileMaker Pro"
   cell "LastName" of record 10 of database "Person"
end tell


If I'm understanding correctly...

my $b     = new Mac::Glue "FileMaker Pro";
my $db    = $b->o(database => "Person");
my $rec   = $b->get(o(record => 10 => $db))->get;
my $last  = $b->get(p(cell => "LastName" => $rec))->get;
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
                          |
            +-------------+
            |
Actually, this part I'm confused about.  What's the gluish for
"record 10 of database 1" or "cell 'LastName' of ...".  I've
assumed the following:
"(record => 10 => database => 1)" or
"(cell => 'LastName' => $rec)"
But it looks a bit strange to me.

If it'll help, here's what Capture AE offers (I've added the
returns and tabs so I can read it.):

Process("FileMaker Pro").SendAE "core,getd,'----':
obj {
   form:indx,
   want:type(crow),
   seld:10,
   from:obj {
      form:indx,
      want:type(cDB ),
      seld:1,
      from:'null'()
   }
}"

???
-Eric



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