On Oct 12, 2005, at 5:37 PM, Ted Zeng wrote:

I would like to find out if an application like Illustrator is running
On OS X or not from a perl script. How can I do it?

"ps" doesn't list the processes like Illustrator.

"px x" does. ;-)

    #!/usr/bin/perl

    use strict;
    use warnings;

    my $ps = (grep /Adobe Illustrator/, split("\n", `ps x`))[0];
    my ($pid, $tt, $status, $time, $cmd) = split(" ", $ps, 5);

    print <<EOF;
        PID = $pid
         TT = $tt
     STATUS = $status
       TIME = $time
        CMD = $cmd
    EOF

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Reply via email to