• 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: Retrieving Rich Text from a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Counting Identical lines in a file with BBEdit & Grep
  • Next by Date: Re: Locating A Menu Item
  • Previous by thread: Retrieving Rich Text from a file
  • Next by thread: Sorting A List - Need Help
  • Index(es):
    • Date
    • Thread