I am some code that cuts up the text in a text box and puts it in mulitple text boxes. The problem is that it gets formatted text but I need to capture the formatted text. My code that gets the text is below:
set myText to contents of selection of myDocument
But this only captures the plain text. How should I change my approach?
1) Select and cut the overset text from the original text box. Create or find the second box and paste. Cut the overset again. Repeat until there is no more overset. The clipboard gets styled text.
2) Create the second frame and thread it to the first. Repeat. Be aware that type will reflow from one threaded frame to another when/if changes are made. This might be a good thing or a bad thing.
@Paul – I'm not too much into AppleScript, but you are using the "contents" (unformatted text) property of an object.
How would it work if you are using the text directly?
Dummycode here (don't know if it will work at all):
set myText to text of selection of myDocument
var myText = app.selection.texts;
What exactly is selected? A text frame? Or is it the text itself?