[LA.pm] app_running status to perl

David Heayn davidmailinglist at cloudgraphics.com
Tue Oct 31 19:49:29 PST 2006


I'm currently trying to check if firefox is running before I edit 
pref files with perl (mac 10).

#!/usr/bin/perl -w
use strict;
my $results;
$results = system "osascript -e 'tell app \"System Events\" to count 
processes whose name is \"firefox-bin\"'>output";
print $results;


Either way I run the above with firefox running or not running 
-though the terminal, my results are "0".


I snarfed a small piece of code (for my project) from::
http://daringfireball.net/2006/10/how_to_tell_if_an_app_is_running




The same page offers another way to figure out the status of a 
running app. Said author promotes detecting mac creator codes?!?! I 
would have sworn mac x killed off that metadata, and I couldn't find 
any online notes on how to figure firefox's creator code. I tried to 
check with "FileInfo"(shareware). Firefox apparently has ???? creator 
code. Either non-existant, or beyond display range?

The last method on the web page is 10.4 specific, and I'm looking to 
build portable code (that won't break easily).


David Heayn * http://www.cloudgraphics.com * (213)925.3283


More information about the Losangeles-pm mailing list