• 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: Calling an Applescript from a Perl Script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling an Applescript from a Perl Script


  • Subject: Re: Calling an Applescript from a Perl Script
  • From: Christopher Nebel <email@hidden>
  • Date: Mon, 30 Jun 2003 17:21:53 -0700

On Monday, June 30, 2003, at 12:01 PM, Jean-Baptiste LE STANG wrote:

I'm trying to use perl to call an AppleScript but I'd like to be able to get the result of the applescript in my Perl script because I'll need to return the result later, and I owuld like also that the perl script wait until the Applescript has finished its work. Has anyone done such a thing and could help me?

osascript(1) will do what you need -- it prints the result of the script. To use it from Perl, use backticks or qx//, which (by default) will wait until the command finishes. For example:

#!/usr/bin/perl
$x = `osascript -e '"hello " & "world."'`;
print $x;

--> hello world.

Someone has probably written a Perl package that can invoke an OSA script directly, but this works with a stock system.


--Chris Nebel
Apple Development Tools
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Calling an Applescript from a Perl Script (From: Jean-Baptiste LE STANG <email@hidden>)

  • Prev by Date: [FYI] Casady & Greene
  • Next by Date: Re: [FYI] Casady & Greene
  • Previous by thread: Calling an Applescript from a Perl Script
  • Next by thread: Re: Calling an Applescript from a Perl Script
  • Index(es):
    • Date
    • Thread