• 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: Dave Johnson <email@hidden>
  • Date: Tue, 12 Jun 2001 08:17:36 -0400

The applescript/MacPerl interface can get messy. I find AppleScript is much
easier to talk to applications, Perl appears to be faster. If you want to pursue
this I suggest you get the book "MacPerl Power and Ease" It has a chapter on
calling AppleScript from MacPerl, and MacPerl from AppleScript.

I try to do projects in one or the other. If you go with AppleScript, the scripting
addition "regex" should be very helpful, be sure to read the docs and there are
some differences you need to know about.

Another approach, and this may be faster, is to use MacPerl to parse the text file
and create a new text file that has the fields you need delimited by tabs and then
import (possibly using applescript) that file into FileMaker. I find a mass import
to be much faster in filemaker then creating one record at a time in AppleScript

Dave


At 7:06 PM -0400 6/11/01, Katherine Richmond wrote:
Hi Everyone,

I'm very new at this. I know some Perl and barely any AppleScript. I would like
to improve an AppleScript that parses a large text file ( > 500k) and re-writes
it to another file so that it can be imported into a FileMaker database. 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? The current applescript is not
using regular expressions. I understand that you can use them in applescript. 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?

Thank you,
Kathy Richmond


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.

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
_______________________________________________
applescript-users mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/applescript-users


  • Prev by Date: [netscape] get text of window
  • Next by Date: Replace all attributes font in a quark document.
  • Previous by thread: Re: Call a perl script from an AppleScript
  • Next by thread: Re: Call a perl script from an applescript
  • Index(es):
    • Date
    • Thread