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

Re: [MacPerl] more brain hurtage



At 00.22 -0400 1998.09.08, Ramesh R. wrote:
>Would it be possible to create a generic AE object?
>
>My initial thoughts are for the module to create separate methods for each
>event.

Already done.  That is the plan all along.

>Each method would take whatever necessary parameters, figure out
>whatever other info it needs and passes all these info to the generic AE
>obj which does the actual generating and sending of AE.
>
>Thus, I can do
>
>$f = new Mac::Glue::Finder;
>$f->open_about_box();
>$f->copy_to ('Path_to_Folder_receiving_copies', 'Path_to_File1',
>'Path_to_File2');
>$f->duplicate ('Path_to_File1', 'Path_to_Folder1');
>$f->duplicate (@ARGS);
>$f->empty_trash();
>
>and so on.
>
>Hope I didn't make your head hurt some more ... :-).

You misunderstand, I think.  There is a thing called an AE object, and
there are Perl objects.  Above, $f is a Perl object.  An AE object is
something like this:

  obj {want:type(cobj), from:null(), form:indx, seld:1}

That is, this takes the item whose index is one.

I already it now that methods are created dynamically with a similar name
to the AppleScript event name (Perlized, as you did above).  And class
names are automatically taken care of too, so when I say:

  $f->clean_up({window=>'project'});

it knows that "clean_up" is of class "fndr" and is the "fclu" event, which
takes an AE object as its required first parameter, that window is type
"cwin".  What it does not know yet is how to determine that 'project'
should be of type:name instead of type:indx (though I will probably just
test to see if the value is numeric or not, and if it is boolean, I dunno
yet ... we'll see).

It also knows it has a parameter "by" that has the ID "by  ", but it does
NOT know that this refers to item properties.  That is not in the aete, so
this might be an example of where I have to hook something up manually in
the module.  I am unsure how to do this, and I'll cross the bridge when I
get to it.

So right now, I am concerning myself with finishing up the AE object (not
Perl object) stuff.  I think I am going to use an ae_object() object method
which constructs an AEDesc object.  I think I am going to determine the
"form" by if_number() ? 'indx' : 'name', but then if the text
/^bool_(true|false)$/ then it would be boolean.  Any thoughts on the
boolean?  I cannot figure out a way to determine what to expect.  Now, I
can know that a folder can contain an item that can be references by indx
or name from that class's elements structure:

    'folder'   => {'id' => 'cfol', 'properties' => [
                ], 'elements' => {
                'file' => ['indx', 'name'],
                'cfol' => ['indx', 'name'],
                # ...
                'cobj' => ['indx', 'name'],
                }},

But what is the name is all numeric?  What if it can also accept an 'ID  ',
which is likely to be numeric?  Should the form be explicitly stated by the
moudle user?

  $f->clean_up({window=>ae_name("project")});
  $f->clean_up({window=>ae_indx("2")});

More thoughts on this will help, too.  I'd like to stay away from such
things as that, but it might be the only way.

Thanks,

--
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 mac-perl-request@iis.ee.ethz.ch