My Bold Script is slow

Terry Vogelaar terry at discovery.nl
Fri Feb 8 09:53:01 EST 2002


> Well, my bold Script is really slow, and I would appreciate any input
> for making it faster. Concrete are the loops at the bottom the problem,
> but I don't know an other way to change the bold, but leave other styles
> alone, as the forever-be-damned-and-burn-in-hell "textstyle" property is
> set to the uglier-as-my-dogs-ass "mixed" state.
> 
> here it comes, please be aware, that any brain injures caused by this
> script are the brain owners problem:
> 
> on mouseUp
> repeat with myChar = the second word of the selectedChunk to the
> fourth word of the selectedChunk
> put the textStyle of char myChar of field "text" into myRepeat
> replace myStyle & "," with "" in myRepeat
> replace myStyle with "" in myRepeat
> set the textstyle of char myChar of field "text" to myRepeat
> end repeat
> end mouseUp
> 
> note:
> I tried the "for each char" loop, but it was not applicable the way i
> used it. (it provided always the character, but no number or other
> location possibility)
> for better reading copy to a button and tab on each line.
> for use set the traversalon to false
> 
> hope you find something faster...

Hello Björnke,

It took a while before I knew how to handle this, but the resulting script
is fast and simple. As far as I know, it only works with fields, not with
selections. I hope you don't mind. If it is important, maybe you can make a
workaround by copying the selection in an empty field first.

on mouseUp
  put the htmltext of fld 1 into var1
  replace "<b>" with "" in var1
  replace "</b>" with "" in var1
  set the htmltext of fld 1 to var1
end mouseUp

Terry




More information about the use-livecode mailing list