• 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
tell block question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tell block question


  • Subject: tell block question
  • From: Jim Brandt <email@hidden>
  • Date: Thu, 23 Jun 2011 08:39:29 -0500

I have a library I use to decode the rows of a table from a page of HTML text.

This routine seems to be a bottleneck from a speed standpoint. It is taking 2 seconds per table row to extract the 15 items from the row text. I'm using TextCommands and regex expressions to do the parsing of the HTML data. 

So I'm trying to determine how I can speed this routine up, as I call it from several different scripts.

My question is, I think, one of best syntax.

Which would be faster:

set allHTML to "<[^<>]+>"
set StoryRecord to {}
tell application "TextCommands"
set c1str to "<td class=\"x1\">.*?</td>"
set Column1 to search RowText for c1str with regex
set file_num to search Column1 for allHTML replacing with "" with regex
set MyRecord to MyRecord & {file_num} -- item 1
...
end tell -- TextCommands

or

set allHTML to "<[^<>]+>"
set StoryRecord to {}
set c1str to "<td class=\"x1\">.*?</td>"
tell application "TextCommands"
set Column1 to search RowText for c1str with regex
set file_num to search Column1 for allHTML replacing with "" with regex
end tell -- TextCommands
set StoryRecord to StoryRecord & {file_num} -- item 1
...

Does it matter, from a speed standpoint, to only put statements in a tell block that are targetted to that application?

Jim Brandt
 _______________________________________________
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

  • Follow-Ups:
    • Re: tell block question
      • From: Shane Stanley <email@hidden>
    • Re: tell block question
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Re: width of column id name column
  • Next by Date: Re: width of column id name column
  • Previous by thread: Tell Acrobat to send doc via email
  • Next by thread: Re: tell block question
  • Index(es):
    • Date
    • Thread