Page 1 of 1

set textstyle bold

Posted: Thu Apr 21, 2016 8:40 am
by link76
I would like to set textstyle "bold" of all words after the character ":"

example my field:

Lorem Ipsum: is simply dummy text

Film:
The point
The point1
The point2
The point3

Sound: exmple1

thank you

Re: set textstyle bold

Posted: Thu Apr 21, 2016 3:28 pm
by dunbarx
This is a good example of brute-force coding. Put your text into fld 1. Make a fld 2. Put this into a button:

Code: Select all

on mouseUp
   put fld 1 into fld 2
   repeat with y = 1 to the number of lines of fld 2
      switch
         case char -1 of word 1 of line y of fld 2 = ":" and the number of words of line y of fld 2 = 1
            put "bold" into tStyle
            break
         case char -1 of word 1 of line y of fld 2 = ":" and the number of words of line y of fld 2 > 1
            set the textStyle of word 2 to (the number of words of line y of fld 2) of line y of fld 2 to "bold"
            break
         case line y of fld 2 <> ""
            set the textStyle of line y of fld 2 to tStyle
            break
      end switch      
   end repeat
end mouseUp
I recommend testing this...

Craig Newman