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

Re: [MacPerl-Modules] Glue: working with reference forms



Oh, I see what happened.  I should have asked you what "print $selection"
said.  It has been a long day for me.  :)

What happens is that AppleScript objects are returned as AEObjDesc Perl
objects.  The actual object is in $selection->{DESC}.  You can do, for
instance:

  print AEPrint $selection->{DESC};

But the best thing to do is see if there is a data type you can request the
data as, such as:

  get foo as bar

I would try:

  as => 'number'

or something.  Check the enumerations section of the app's dictionary.  Or, do:

  $foo = $selection->{DESC}->get

and then parse the returned string yourself.  Note that since the DESC
value is an AEDesc, you can all get() on it, like any Apple event
descriptor.  Consider:

  #!perl -wl
  use Mac::Glue ':all';
  $f = new Mac::Glue 'Finder';
  $i = $f->get($f->obj(item => gFirst));
  print $i;
  print $i->{DESC}->get;

  AEObjDesc=HASH(0x79e62ec)
  obj {want:type(file), from:'null'(), form:name, seld:³BBEdit text
clipping 1²}

And:

  #!perl -wl
  use Mac::Glue ':all';
  $f = new Mac::Glue 'Finder';
  $i = $f->get($f->obj(item => gFirst), as=> 'string');
  print $i;

  Bourque:Desktop Folder:BBEdit text clipping 1

So it depends on the app.  Now, if you cannot coerce the data type with as
=> $foo, then send me a printout of "print $selection->{DESC}->get" and we
can take a looksee at how we can best parse out the data therein.

-- 
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-modules-request@macperl.org