• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: using tell with proc. serial numb. in OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using tell with proc. serial numb. in OS X


  • Subject: Re: using tell with proc. serial numb. in OS X
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 13 Nov 2001 15:09:35 -0800

On Tuesday, November 13, 2001, at 01:04 AM, Neal A. Crocker wrote:

Suppose my script, during the course of its execution has a variable containing a value of class "psn " which is a valid process serial number, corresponding to a currently runing process that can receive appleevents. Can I use this variable as the argument of a tell statement to send events to the application corresponding to the process serial number?

A related question is whether I can use the tell statement in an application to direct events to a process using its unix "process id", or "pid".

...command line tools, unlike application processes, can only be uniquely identified by their pids or psns.

The Apple Event Manager supports both psn and pid addresses in Mac OS X 10.1. If you're sending events from C, it's no problem. We haven't exposed them in AppleScript yet, partly because we'd need a sensible way to get one in the first place.

Your observations about unique identification are well taken, but I think you're still missing the point: if you've got ten different invocations of, say, widgetd running, how are you going to tell which one you want to talk to? Either there is a way, so the pid isn't the only means of identification, or there isn't, in which case you're either screwed or you just don't care and pick one at random.

Now, if we made *all* processes (not just ones with PSNs) visible through the "processes" property, then there might be a way to interrogate the list and find out (somehow) that, yes, this copy of widgetd is the one you want. Internally, AppleScript would hold widgetd's "address" as a pid, but as a scripter you wouldn't need to be aware of that. There are some interesting technical issues with doing this, but hey, we're already considering this an enhancement request, so that's ok. :-)


--Chris Nebel
AppleScript Engineering


  • Follow-Ups:
    • Re: using tell with proc. serial numb. in OS X
      • From: "Neal A. Crocker" <email@hidden>
References: 
 >using tell with proc. serial numb. in OS X (From: "Neal A. Crocker" <email@hidden>)

  • Prev by Date: Re: Crontab v. Applescript & Command Line
  • Next by Date: Re: Newbie to Applescript
  • Previous by thread: using tell with proc. serial numb. in OS X
  • Next by thread: Re: using tell with proc. serial numb. in OS X
  • Index(es):
    • Date
    • Thread