• 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: Styled Text doesn't work :(
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Styled Text doesn't work :(


  • Subject: Re: Styled Text doesn't work :(
  • From: kai <email@hidden>
  • Date: Fri, 20 May 2005 12:58:39 +0100


On Thursday, May 19, 2005, at 06:12 pm, Clem'Sail wrote:

i've make this little script to test because i want edit styled text for an email.
But AppleScript not remeber style of text


in this script the file app05.rtf containt 3 line and the first as in bold
but when it create the new doc with text, nothing style are present !


Ps: Sorry for my english but i'm french and i never learn english at school.

I tried to learn a bit of French at school, Clém - but your English is still a whole lot better than my own linguistic efforts. :-)


Script :

tell application "TextEdit"
open ":Volumes:HD:app05.rtf"
set APP05 to text of document "app05.rtf" as styled text
set docRef to (make new document at beginning with properties {text:APP05 as styled text})
end tell

One way around this might be to dig out the style attributes of the original text and then apply them to the text in the new document. While this "goes around the houses" a bit, it works here:


----------------

tell application "TextEdit"
	tell document "app05.rtf" to set {e, t, a, f, c, s} to ¬
		{0, its text} & {it, font, its color, size} of attribute runs
	tell (make new document at end with properties ¬
		{text:t}) to repeat with n from 1 to count a
		set b to e + 1
		set e to e + (count a's item n)
		tell characters b thru e to set {font, its color, size} to ¬
			{f's item n, c's item n, s's item n}
	end repeat
end tell

----------------

---
kai

_______________________________________________
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


References: 
 >Styled Text doesn't work :( (From: "Clem'Sail" <email@hidden>)

  • Prev by Date: Re: Text - change case
  • Next by Date: Desktop Bounds Broken in Tiger?
  • Previous by thread: Re: Styled Text doesn't work :(
  • Next by thread: RE: Text - change case Resolved
  • Index(es):
    • Date
    • Thread