Setting AS Var to Perl Result
Setting AS Var to Perl Result
- Subject: Setting AS Var to Perl Result
- From: Marconi <email@hidden>
- Date: Mon, 29 Nov 2010 09:23:52 -0700
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