[LA.pm] app_running status...
Peter Benjamin
pete at peterbenjamin.com
Tue Oct 31 22:05:08 PST 2006
At 07:58 PM 10/31/2006, you wrote:
>I meant to add this to the last email.
>
>If I call:
>system("osascript -e 'tell app \"System Events\" to count processes
>whose name is \"firefox-bin\"'")
>
>how do I return the shell results/truth back to a perl variable for a switch?
You could use back tics instead.
$results = `osascript -e 'tell app \"System Events\" to count processes
whose name is \"firefox-bin\"'`
Otherwise, pipe it to a temp file. The exec instead of system
should be looked to know all three ways of invoking commands
outside of perl. I prefer backtics, and the return value can
be an array of records.
system("osascript -e 'tell app \"System Events\" to count processes whose name is \"firefox-bin\"' > /tmp/myscript_datetimestamphere"
open (IN, "</tmp/myscript_myscript_datetimestamphere" )
my @standardout = <IN>;
close IN;
Must do:
Also, check $! to check that system returns no error.
More information about the Losangeles-pm
mailing list