• 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: Call a perl script from an AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call a perl script from an AppleScript


  • Subject: Re: Call a perl script from an AppleScript
  • From: Timothy Bates <email@hidden>
  • Date: Tue, 12 Jun 2001 13:29:28 +1000

On 12/6/01 9:06 AM, "Katherine Richmond" <email@hidden>
> I would like to improve an AppleScript that parses a large text file ( >
> 500k) and re-writes it to another file
> I would like to call a perl script to do the parsing part.
> Do you think perl will be faster than applescript at parsing large files?
could well be 100s of times faster, or just the same. Depends on what you
are doing

> The current applescript is not using regular expressions. I understand that
> you can use them in applescript.
You can use regex in AppleScript

http://www.osaxen.com/index.php3?keywords=regex
This may well increase the speed and ease of your task dozens of times over.

> I don't know how much to ask Perl to do. Should I open/create/move files in
> the AppleScript and let Perl do the text work? Or should I have Perl do
> everything?
> What is your advice about this project?
If you know perl, you know the answer. If like me you think perl looks like
a cat leant on the type writer, then do it all in AppleScript. That is my
advice.

> Here is my plan. Remember I don't know the correct commands to use. If you
> think
> this is a good plan, I will start writing the actual code.

You can do all that you show below in AppleScript and debugging will be
easier.
cheers,
tim

> AppleScript
> --------------------------
> loop while files in toBeParsed folder
> Call doScript to run the Perl script (pass fileName as arg)
> Tell FileMaker to run its import records script. (I already have this
> working.)
> end loop

> Perl script
> --------------------------
> open file
> create a new file named file+parsed in parsed folder
>
> loop while lines in file
> parse lines of file and create record (several lines make up one record)
> write one record at a time to file+parsed file
> end loop
>
> close file
> move file to finishedParsed folder
> close file+parsed file

Dr Timothy Bates <mailto:email@hidden>
Macquarie Centre for Cognitive Science (MACCS)
Macquarie University
Ph 61 (2) 9850 8623
Fx 61 (2) 9850 6059


  • Prev by Date: Re: Getting the name of a file from an "alias"
  • Next by Date: Re: Getting the name of a file from an "alias"
  • Previous by thread: Re: moving pages in Quark
  • Next by thread: Re: Call a perl script from an applescript
  • Index(es):
    • Date
    • Thread