Re: Creating an environment variable from AppleScript
Re: Creating an environment variable from AppleScript
- Subject: Re: Creating an environment variable from AppleScript
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 9 Oct 2006 08:01:47 -0400
On 10/9/06, Kumar Shailove <email@hidden> wrote:
I have written a utility script using AppleScript which is being called from
within a Perl Script using "system" function.
OK. You can almost certainly do that more efficiently within Perl,
with no system and no AS, but that'd be off-topic...
Can you think of an alternative solution to this? The worst one, that I
though of is to redirect the output of AppleScript to a text file and then
reading this value from the Perl Script.
OS X is UNIX based; there's no need for such shenanigans. You can
read the output of any program you launch directly using "pipes".
From Perl:
# Fire off the AS - which will run in parallel to the Perl
open(AS, "osascript /path/to/my/script.as|") or die "$0: couldn't run
AppleScript: $!\n";
# Now read the output of the AS. This does it one line at a time,
# but you can also read it all in as one chunk. Which is better depends
# on what it looks like.
while (<AS>)
{
# the line of output is in $_
}
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden