• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Add format to a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Add format to a string


  • Subject: Add format to a string
  • From: Joseph Weaks <email@hidden>
  • Date: Mon, 25 Oct 2004 13:33:04 -0500

I'd like a handler that would apply the bold style a specified sub-string in the first occurrence (or everywhere it is found if that's easier) in a string. I have read through StyledText <-> Record.scpt by julifos and still am not sure how to make a simplified handler for what I'm wanting. I'm looking for something like this:

on wholeString, subString)
-- returns styled text where subString becomes bold.
-- options for italic, color, highlight would be nice, as well
end formatSubString

formatSubString("This is a bold statement.", "bold")
-- Result:
This is a bold statement.

I am undecided if the wholeString should retain any style info it has at the beginning. Also, a third parameter allowing one to specify italics or color or highlighting or even font size or name instead of bold would be just swell.

Thanks,
Joe Weaks
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Proper use of run script commands
  • Next by Date: Re: Proper use of run script commands
  • Previous by thread: Re: Proper use of run script commands
  • Next by thread: Re: Add format to a string
  • Index(es):
    • Date
    • Thread