There's got to be a better way

Richard Gaskin ambassador at fourthworld.com
Thu Apr 14 10:40:55 EDT 2005


Lynch, Jonathan 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 am not sure if someone else has already suggested this - but I just
> tried this and it seems to work fine:
> 
> On Mouseup
>   -- put the desired URL into U
>   set the clipboarddata["html"] to URL U
>   put the clipboarddata["text"] into A
>   -- the plain text version will now be in A
> End Mouseup
> 
> Sometimes I get weird things happening to my system when I mess around
> with the clipboarddata, so if you do it this way, look out for anything
> strange happening after the fact, like problems with copying and pasting
> or something similar.

IIRC when I benchmarked both appproaches last year, if memory serves the 
field method (on an unopened card) was surprisingly faster than the 
clipboardData method.

Any got time to run such tests again to verify?

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


More information about the use-livecode mailing list