Chris,
I don't receive your earlier post. I will check out your solution.
Thanks.
Thanks for everyone who has responded. Both
Solutions (use AppleScript or just "ps x") work
Well.
BTW, Apple just reported yesterday that Mac units shipped increased
By 48% last quarter. Sound like Mac is gaining market share.
Ted zeng
On 10/12/05 4:24 PM, "Chris Nandor" <[EMAIL PROTECTED]> wrote:
> 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;
> }