• 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
Re: (standard additions) read file as styled text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (standard additions) read file as styled text


  • Subject: Re: (standard additions) read file as styled text
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 25 Apr 2001 10:10:57 -0700

On Tuesday, April 24, 2001, at 02:17 PM, Brennan Young wrote:

I know there are a couple of scripting additions which can extract
resources, (Akua is the one that springs most immediately to mind), and
I can work that out, but how would I go about 'combining them with the
raw text'? This sounds easier said than done.

As far as AppleScript is concerned, styled text is a record with a special type ('STXT') and two keys: key 'ktxt' (type 'TEXT') containing the plain text, and key 'ksty' (type 'styl') containing the style information in (I believe) the same format as a 'styl' resource.

If you can manage to get both globs of data, I'm pretty sure Programmer's Tool can combine them in the right way, but I don't know the exact incantation. It's also possible, if somewhat circuitous, to do it in straight AppleScript by running the data through the clipboard, like this:

set x to +data styl000400000000000C000900150000000C00000000000000000005000C000900150100000C00000000000000000009000C000900150000000C0000000000000000000A000C000900150200000C000000000000;
set y to "This that those"
set the clipboard to {styled Clipboard text:x, string:y}
get the clipboard
--> "This that those", with "that" bold and "those" italic.


--Chris Nebel
AppleScript Engineering


  • Follow-Ups:
    • Re: (standard additions) read file as styled text
      • From: Brennan Young <email@hidden>
References: 
 >Re: (standard additions) read file as styled text (From: Brennan Young <email@hidden>)

  • Prev by Date: Re: Selecting a file by creator
  • Next by Date: Re: applescript-users digest, Vol 2 #623 - 15 msgs
  • Previous by thread: Re: (standard additions) read file as styled text
  • Next by thread: Re: (standard additions) read file as styled text
  • Index(es):
    • Date
    • Thread