• 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: set the clipboard not available in some apps (like Word)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set the clipboard not available in some apps (like Word)


  • Subject: Re: set the clipboard not available in some apps (like Word)
  • From: Paul Berkowitz <email@hidden>
  • Date: Sun, 12 Dec 2004 12:34:24 -0800

On 12/11/04 10:33 PM, "Joseph Weaks" <email@hidden> wrote:

>
> Aha!!!!  I've found the problem. Word won't receive a programmatically
> set clipboard of class Unicode Text. But I can't simply coerce to class
> String, because my application is using multilingual unicode text.
> This is bizarre because Word 2004 copies to the clipboard as Unicode
> Text.

But this is a completely different issue.  You weren't using Unicode before,
when setting 'theString'. Or perhaps you were using Script Editor or Smile.
In Script Debugger, 'theString' was string, not Unicode.

>To see the problem, try this:


> 1.  Copy some text from Word
>
> 2. Go to Smile or somewhere and run:
> set xxx to the clipboard
> class of xxx
> -- Unicode Text -- proving that Word is using Unicode text

Correct.

> set the clipboard to xxx
>
> 3. Bring Word to the front and see that the paste options are dimmed
> (presumably because it doesn't recognize the class on the clipboard.

Right. Word doesn't seem to recognize the same clipboard here. As far as
Word is concerned, there's nothing on its clipboard. And it does not help to
put any of the clipboard commands within a Word tell block.

I.e.

        set xxx to the clipboard
        set the clipboard to xxx

makes the clipboard unavailable to Word. That's when you can't paste. Same
if either or both lines are in a Word tell block.

>
> Surely this is a bug, or at least "half a bug" (see previous thread),
> on Microsoft's part?
>
> Solutions? Word-Applescript-guru Paul Berkowitz, are you aware of this
> issue?

I think there may be two issues. One of those is Unicode. This does not
work:

set theString to "Can you paste me now?" as Unicode text
set the clipboard to theString


Then you can't paste into Word, although you can into TextEdit, and you can
(we've seen) if you remove 'as Unicode text'. But it's really to do with
Word (or Office) having its own clipboard. They'll communicate one-way but
not the other way. We've seen that setting the clipboard to a string  via
AppleScript somehow is transferable to Word's clipboard, so it pastes.
Unicode doesn't transfer from the system clipboard to Word's (I expect it's
still using an old-fashioned method of getting styles).

But Word has its own clipboard=, which _is_ accessible in Word 2004 script.
Try this:

1) Select some text in Word - whether ordinary Roman text or multi-lingual
characters inserted form the Character Palette in any language.

2) Now run:

    tell application "Microsoft Word"
        copy object (the selection)
    end tell

3) Now put the cursor somewhere else in the Word doc.

4) Paste. It works.

So you should determine if your source application is Word or another app.
If any other app, use 'set the clipboard to the selection', or however it
works in that app. If Word, 'tell application "Microsoft Word" to copy
object selection'.



--
Paul Berkowitz


 _______________________________________________
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

  • Follow-Ups:
    • Re: set the clipboard not available in in some apps (like Word)
      • From: Joseph Weaks <email@hidden>
References: 
 >Re: set the clipboard not available in some apps (like Word) (From: Joseph Weaks <email@hidden>)

  • Prev by Date: Re: Do shell script to dial a number
  • Next by Date: Re: Do shell script to dial a number
  • Previous by thread: Re: set the clipboard not available in some apps (like Word)
  • Next by thread: Re: set the clipboard not available in in some apps (like Word)
  • Index(es):
    • Date
    • Thread