Re: Retrieving Rich Text from a file
Re: Retrieving Rich Text from a file
- Subject: Re: Retrieving Rich Text from a file
- From: John Woodrow <email@hidden>
- Date: Mon, 28 Jul 2003 10:50:57 +0100
Do you have TextEdit? If so you might use something along the lines of:
--begin script
tell application "TextEdit"
activate
open alias "MyHD:Users:myshortname:Desktop:Testfile.rtf" --
substitute path inside the quotes with colon separated path to your
rtf file
end tell
set theText to {}
set theFont to {}
set theColour to {}
set theSize to {}
tell document 1 of application "TextEdit"
repeat with i from 1 to count of (get attribute runs)
set styleIndex to i as integer
set nextText to attribute run styleIndex
if nextText is not "" then
set theText to theText & attribute run styleIndex
set theFont to theFont & font of attribute run styleIndex
set theColour to theColour & color of attribute run styleIndex
set theSize to theSize & size of attribute run styleIndex
end if
end repeat
end tell
--end of script
The result will be lists containing text, typeface, colour and point
size respectively.
(Note, the colours are themselves each a list of three values.)
John
----
John Woodrow
<
mailto:email@hidden>
----
<
http://www.goldendustman.co.uk>
_______________________________________________
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.