How to access PART of a record and KEEP formatting?

How do I use AppleScript to get PART of a record’s rich text AND KEEP THE FORMATTING?

If I use

set rich_method to the rich text of the_rec

then the text is rich UNTIL I access PART of it—a paragraph, say.

Even sending keystrokes and copying to the clipboard fails. If, after sending keystrokes for SELECT ALL and COPY, I then do this:

set key_method to the clipboard

the clipboard indeed contains rich text. But if I then set some variable to the clipboard, and access only PART of this variable (paragraph), it again fails.

I’ve also tried using “attribute run,” but this also failed. My guess is that this is the way to do it, but when I GET paragraphs, the attribute runs on those PARTS yield, you guessed it, no attributes.

All I want to do is copy a paragraph of rich text from record A to record B—not the WHOLE thing, but just a PART. It seems that accessing only PART is what kills the formatting.

Hmm… not completely certain what you want to do without a specific example, but maybe this will help. Try:

That will get the attribute strings of your entire text record. You can then do something like:

Just remember that in Applescripts, “paragraphs” and “attribute runs” are entirely independent of one another, so I believe that you can have paragraphs enclosing attribute runs and vice versa. You can say stuff like:

and get the formatting:

Hopefully from the above you can piece together a request that meets your needs.
C

Rich text scripting of Mac OS X 10.6.1 is unfortunately still limited to visible rich texts (see “text” or “selected text” properties of “think window”).

You can also have a look at some of the smart templates we provide, e.g. the Quote or Project ones. They do some limited rich text editing and explicitly show the document for doing this.

Wow! When did those arrive? They are INCREDIBLE! You are doing really fine work on this program. Thank you.

Question: what is the best way to attach a keyboard short cut to these “smart templates”? System Preferences?

Matt