In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Chris Nandor) wrote:

Oops, typo.  This:

>    print 1 if grep 'Photoshop', `ps auxw`;

should be:

>    print 1 if grep /Photoshop/, `ps auxw`;



And I forgot to mention -- just because it may be useful -- you can also 
convert between PID and PSN.  Also in Mac::Processes, there are 
GetProcessPID() and GetProcessForPID().  The former converts a PSN to a PID, 
and the latter a PID to a PSN.

Much of the Mac:: API can accomodate either if necessary (Mac::Glue can 
target by PSN or PID, and a "process" object from System Events can give you 
a PSN or PID), but if you need to convert from one or the other, you can use 
this API.

One example I like:

   use Mac::Processes;
   while (my($psn, $psi) = each %Process) {
      kill 15, GetProcessPID($psn) if $psi->processName =~ /Photoshop/i;
   }

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Technology Group       [EMAIL PROTECTED]     http://ostg.com/

Reply via email to