• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Creating an environment variable from AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Creating an environment variable from AppleScript
      • From: Philip Aker <email@hidden>
References: 
 >Re: Creating an environment variable from AppleScript (From: Steve Hayman <email@hidden>)
 >RE: Creating an environment variable from AppleScript (From: "Kumar Shailove" <email@hidden>)

  • Prev by Date: Renaming a copied file with Finder
  • Next by Date: Re: Renaming a copied file with Finder
  • Previous by thread: RE: Creating an environment variable from AppleScript
  • Next by thread: Re: Creating an environment variable from AppleScript
  • Index(es):
    • Date
    • Thread