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

Re: [MacPerl-Toolbox] Apple events and PSN ... bug?



At 20:56 +0200 4/28/99, Matthias Neeracher wrote:
>In article <v04020a1db34cf4499b41@[192.168.0.77]>, Chris Nandor
><pudge@pobox.com> writes:
>
>> This seems to me it should work.  I confirm that the PSN I get from
>> Mac::Processes (in this case, 8208) is indeed the decimal number
>> corresponding to the hex PSN that an app called Process Watcher tells me is
>> assigned to BBEdit (2010).  So I seem to have the right number.  But the
>> script produces:
>
>> $evt = AEBuildAppleEvent(qw(aevt quit), typeProcessSerialNumber, $psn,
>>     kAutoGenerateReturnID, kAnyTransactionID, '') or warn $^E;
>
>If I remember correctly, I take no precautions to transform a numerical
>psn you pass into binary form. Try pack()ing the PSN to a 64 bit number first.

Aside from that, a PSN is really a number plus a bunch of flags, which may
vary from moment to moment.  The number is (as of now, and "I think") in
the low longword (or perhaps the low part of the low longword).

Nonetheless, I don't recall having had to do anything special in C code to
stuff a PSN into an Apple event.  Perhaps I was only working with some of
the special ones (eg kCurrentProcess, which is always given (by us) a high
longword of 0), not ones I got out of GetNextProcess().  But if PSNs don't
"go in" with the bits identical to how they "came out" I would expect
problems.   (Apple provided the SameProcess() thing for comparing PSNs for
this reason.)

See IM, Processes, around page 2-16 (printed version)...under the "Data
Structures" header.

[Actually, I think I did package PSNs from GetNextProcess() into AEs--as
the addressing information) successfully.]

   --John
--
John Baxter   jwblist@olympus.net      Port Ludlow, WA, USA
Give a man a fish and you feed him for a day.  Teach him to fish,
and you get rid of him for the weekend.

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