• 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: Moving Text from TextEdit to Word
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving Text from TextEdit to Word


  • Subject: Re: Moving Text from TextEdit to Word
  • From: Jeffrey Berman <email@hidden>
  • Date: Tue, 22 Oct 2002 12:16:30 -0500

On Mon, 21 Oct 2002, Michael Terry <email@hidden> wrote:

> On 10/21/02 8:03 PM, "Jeffrey Berman" <email@hidden> wrote:
>
>> I'm having difficulty in what I thought would be a simple process of copying
>> text of a TextEdit document into a document in Microsoft Word.
>
> Anything's simple once you know how.
>
>> tell application "TextEdit" to get text of document 1
>> tell application "Microsoft Word" to set text of document 1 to result
>>
>> produces the error message:
>>
>> Microsoft Word got an error: Can't set every text of document 1 to "boo".
>>
>> I noticed that the result returned from TextEdit had a class of Unicode
>> text. But the same error message occurs even if I coerce the text from
>> TextEdit to a string as in:
>>
>> tell application "TextEdit" to get text of document 1 as string
>> tell application "Microsoft Word" to set text of document 1 to result
>
> < s n i p >
>
> tell application "TextEdit" to set x to text of document 1
> set x to (x as record)'s <<class ktxt>> as string
> tell application "Microsoft Word" to set text of document 1 to x
>
> Yes, the problem is the unicode text, but you didn't coerce it hard enough.
> You have to put a lot more effort into it.

Mike:

Thanks for helping me. The following works without error:

tell application "TextEdit" to get text of document 1
get <<class ktxt>> of (result as record)
tell application "Microsoft Word" to set text of document 1 to result

As for my understanding why, well, I'm still working on that. I see that
when the text property from TextEdit is coerced to a record, the record has
two labeled properties, <<class ktxt>> and <<class ksty>>, with the first
containing the text as a string. Is there any documentaton that might help
me understand these raw syntax terms and how TextEdit uses them for the text
property?

-Jeffrey Berman
_______________________________________________
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: Skip current repeat iteration
  • Next by Date: Re: Recording in the script editor - Jaguar
  • Previous by thread: Re: Moving Text from TextEdit to Word
  • Next by thread: User Name in OS X +
  • Index(es):
    • Date
    • Thread