Re: Styled text in Panther
Re: Styled text in Panther
- Subject: Re: Styled text in Panther
- From: Hanaan Rosenthal <email@hidden>
- Date: Mon, 26 Jan 2004 10:05:14 -0500
- Organization: Custom Flow Solutions
Hello Brennan
Try parsing RTF text, it's relatively easy and unlikely to change.
Save a simple file using text edit and then read it into AppleScript.
I have a tutorial that explains that as part of a comprehensive AppleScript
book I'm writing but it won't be out until August.
I can send you more info if you want.
Hanaan
>
>
From: Brennan <email@hidden>
>
Date: 2004/01/26 Mon AM 08:38:20 EST
>
To: applescript-users <email@hidden>
>
Subject: Styled text in Panther
>
>
Looking at the dictionary for Image events and TextEdit, it would appear
>
that we are on our way to some kind of standard Applescript treatment of
>
styled/rich text. Unfortunately, I can't fathom it, so I wonder whether
>
this is unfinshed or never properly started.
>
>
My goal is to have a piece of styled text open in a standard text editing
>
Application (preferably TextEdit, Appleworks or something which has a
>
chance of having been bundled with a Mac) and then pull out the style
>
information.
>
>
You don't need to know what I want to do with this style data afterwards,
>
suffice to say it will be akin to generating HTML code for formatted text.
>
>
It would also be acceptable to read the styled text directly from a file.
>
>
TextEdit has this nice 'attribute run' class, but this includes font,
>
fontsize and color, it omits actual style information (bold, underline
>
etc.). Most cocoa applications seems to offer this, but I can't see
>
any/many which actually support it explicitly.
>
>
For example, Image events seems to offer this class, but I can't see how
>
to get some styled text into that app in the first place. The 'open'
>
command only returns image objects.
>
>
Beyond that, there's TexEdit Plus and Style, both of which I trust to do
>
what they say on the tin, although their terminology is different. It used
>
to be possible to get style information from a chunk of Appleworks text,
>
but it appears that the terminology has changed in some recent version.
>
>
I have some ugly old code for generating styled text, involving a
>
clipboard hack which still works under OSX (astonishing!)
>
>
set styleRecord to {styled text:"AppleComputer", style:<<data
>
styl000200000000000C000C2F8B0100000CFFFF00000000000000050018
00182F8B020000
>
18FFFF0000FFFF>>}
>
>
-- hack: use the clipboard to coerce the record to rendered styled text
>
set oldClipboard to the clipboard
>
set the clipboard to styleRecord
>
set myStyledClip to the clipboard
>
set the clipboard to oldClipboard
>
return myStyledClip
>
>
>
(watch those chevrons). However I actually want to go the *other* way.
>
>
Any ideas?
>
>
Brennan
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/
listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.