font changing script?

Jan Schenkel janschenkel at yahoo.com
Mon Jun 9 05:51:01 EDT 2003


--- Nicholas Thieberger
<paradisec at linguistics.unimelb.edu.au> wrote:
> I'm trying to find all "$" in a field and change
> them to the font 
> IpaTimes. I use the following script, but it refuses
> to recognise the 
> font name. I try it wih Geneva and it still doesn't
> work...  Any 
> advice gratefully received.
> 
> 
> on mouseup
>    put field "text" into tempOne
>    repeat with x=1 to the number of characters in
> tempOne
>      if char x of tempone is "$" then
>        set the textfont of char x of tempone to
> "IpaTimes"
>      end if
>    end repeat
>    put tempOne into fld "text"
> end mouseup
> 
> Thanks
> 
> Nick
> -- 

Hi Nick,

The key thing to remember is that variables don't have
a textFont of their own ; they're just flat text.
In this case, I'd change your script to :

on mouseup
  put length(field "text") into tLength
  repeat with x=1 to teLngth
    if char x of tempone is "$"
    then set the textfont of char x of field "text" \
          to "IpaTimes"
  end repeat
end mouseup

If you want to avoid the user seeing each textfont
change, you can always insert 'lock screen' at the
front and 'unlock screen' at the end.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com



More information about the use-livecode mailing list