Re: Setting AS Var to Perl Result
Re: Setting AS Var to Perl Result
- Subject: Re: Setting AS Var to Perl Result
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 29 Nov 2010 11:27:54 -0500
The result of do shell script is the *output* of the executed command.
So just have the Perl "print" the result you want returned to AS.
On Mon, Nov 29, 2010 at 11:23 AM, Marconi <email@hidden> wrote:
> I have an assortment of data files consisting of multiple lines that are:
>
> DatumName : DatumValue
>
> There are 20-40 lines per file -- 20-40 data per file.
> DatumName1 : DatumValue1
> DatumName2 : DatumValue2
> DatumName... : DatumValue...
> DatumName40 : DatumValue40
>
> Each line starts with a datum name; the datum value is followed by an end of
> line.
>
> I am interested in extracting from each file just a few of the data.
>
> Now, I have and use a couple of AppleScript bundles that have a Perl script
> within them and which act on any files dropped onto the AppleScript droplet.
> The contained Perl script is called once for each dropped file and does a
> Find/Replace correcting irregularities in the data file.
>
> What I don't know how to do is get the Perl script to return a value to the
> calling AppleScript.
>
> I'd like to call the Perl script with a command line consisting of:
>
> /path/to/the/contained/perl/script /path/to/the/dropped/data/file.txt
> name_of_datum_to_extract
>
> That is, the Perl script will be passed two arguments: the path to the data
> file and the datum whose value is to be extracted. For example, I'd build a
> command line:
>
> /path_to_my_perl_script /path_to_DataFile.txt DatumName1
>
> and have the AS execute the command line as:
>
> set theResult to (do shell script commandLine)
>
> but theResult is empty.
>
> Given data files as described above, what's a quickie Perl script to return
> to the AppleScript the value of the datum named in the second argument?
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
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:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden