There's got to be a better way

Richard Gaskin ambassador at fourthworld.com
Tue Apr 12 20:38:22 EDT 2005


Jim Hurley wrote:
> I have html text from a web site. (Thanks again to Dave Cragg for his 
> nifty handler to extract text from a web site with forms.)
> 
> It is awkward to parse in this form. I would like to be able to parse 
> the text without the html code.
> 
> So this is what I am using:
> 
> set the htmltext of field 1 to tHTMLtextFromWebSite
> set the text of field 1 to field 1
> put field 1 into tTextToParse
> 
> It is hard to imagine anything more clumsy. It wastes a lot time putting 
> things into and out of fields. There must be a better way of stripping 
> out the html code. I understand that one cannot use variables for this.

I understand the trepidation about fields, but for this particular task 
it's damn fast relative to any parsing option.

Normally all those internal mechanics involving style runs work against 
you for simple data access in fields, but for this type of translation 
they work in your favor, putting as much work as possible into the 
engine and outside of scripts.

Benchmark it and I think you'll find it quite acceptable.

Here's a tip to get even better performance (sometimes as much as two or 
three times more): use a field in an unopened window for the translation.

When a field is on the current card, even if hidden, it's initialized 
with additional things that don't come into play when accessing a field 
on an unopened card.

In all versions of WebMerge through v2.3 I had been using a hidden field 
on the main card for the translation.  But after I learned this trick 
from Tuviah in v2.4 I now do that translation in an unopened substack, 
and even thought my customers had long raved about WebMerge's 
performance I was able to give them a 100% performance boost in one step. :)

--
  Richard Gaskin
  Fourth World Media Corporation
  __________________________________________________
  Rev tools and more: http://www.fourthworld.com/rev


More information about the use-livecode mailing list