You're right, AppleScript does not seem to recognize it as rich text. That's strange, as we definitely return rich text and we also declare it as such in the scripting definition. This may be due to a long standing bug where Apple consistently defines rich text the wrong way (I know TextEdit does it wrong on Tiger). That bug often gets AppleScript confused (and AppleScript is easily confused).
Christiaan On 5 Jan 2008, at 3:08 PM, James Harrison wrote: > On Jan 5, 2008, at 6:03 AM, Christiaan Hofman wrote: > >> That's a general AppleScript problem with rich text. AppleScript does >> not have a primitive rich text type. Rich text is declared as type >> text, so whenever you evaluated it (e.g. by assigning it to a >> variable) it is converted to just text. > > Right. > >> So you can only use it as >> rich text as a reference. Either use it directly in a command (such >> as saving to file or putting on a clipboard or getting rich text >> properties) that has a rich text parameter, or use 'a reference to'. > > This successfully moves styled text from one document to another in > TextEdit: > > tell application "TextEdit" > set the clipboard to the text of document "Styled text document" > end tell > > tell application "TextEdit" > set the text of document "Target document" to the clipboard > end tell > > However, this yields a TextEdit document with only plain text: > > tell document 1 of application "BibDesk" > set thePub to item 1 of (get publications whose cite key is myKey) > set the clipboard to (templated rich text using "Abbrv export" for > thePub) > end tell > > tell application "TextEdit" > set the text of document "Untitled" to the clipboard > end tell > > I get similar results using "a reference to." However, I have to admit > I can't successfully move styled text into TextEdit from other > programs (Pages, VoodooPad) using the clipboard or references, either, > but there I get class and type errors. On top of that, Applescript in > Leopard has changed the way it handles strings (everything is unicode > now, and styled text may not be handled the same way). I might just > need to wait for all this to settle out and for documentation to catch > up. > > Thanks anyway, > > Jim Harrison > >> >> On 5 Jan 2008, at 2:49 AM, James Harrison wrote: >> >>> In 1.3.13, the Applescript command "templated rich text" now yields >>> the correct text string, but it's not clear whether it includes any >>> text style information (in Leopard). I don't have a complete handle >>> on >>> the situation, since it's easy to strip style information from >>> strings >>> in Applescript and Applescript 2.0 in Leopard handles strings a bit >>> differently from previous versions. However, I can copy styled text >>> from one document in TextEdit directly to the clipboard and then >>> insert it into another document with styles preserved. When I set >>> the >>> clipboard to the output of templated rich text in BibDesk using the >>> Abbrv export template (which should italicize journal names) I can >>> insert the correct text into the TextEdit document from the >>> clipboard, >>> but the styles are absent. Is there a way to confirm that the >>> current >>> output of "templated rich text" is what's intended? >>> >>> By the way, the "About" box still reads 1.3.12 in the nightlies. Is >>> it >>> supposed to retain the old number until the official release? >>> >>> Jim Harrison >>> UVa >> >> >> >> --------------------------------------------------------------------- >> ---- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Bibdesk-users mailing list >> Bibdesk-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/bibdesk-users > > > > James H. Harrison, Jr., MD, PhD > Associate Professor and Director of Clinical Informatics > Departments of Public Health Sciences and Pathology > University of Virginia > Hospital West Complex 3181 > PO Box 800717 > Charlottesville, VA 22908-0717 > > Phone: 434-924-8054 | Fax: 434-924-8437 > <[EMAIL PROTECTED]> > > > > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Bibdesk-users mailing list > Bibdesk-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bibdesk-users ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Bibdesk-users mailing list Bibdesk-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-users