Re: set the clipboard not available in in some apps (like Word)
Re: set the clipboard not available in in some apps (like Word)
- Subject: Re: set the clipboard not available in in some apps (like Word)
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 12 Dec 2004 14:04:05 -0800
On 12/12/04 1:12 PM, "Joseph Weaks" <email@hidden> wrote:
>> ...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).
>
> I am not queazy about calling this a bug! At best, it's incomplete and
> poor Unicode implementation.
It's not really to do with Unicode, but with some coercions for transferring
content from the system clipboard to Word's clipboard. I'm not sure that
that's a bug - is there some law that says every application MUST use the
system clipboard? But I'll see if I can find out whether it would be
possible to extend the coercion that works for strings to also work for
Unicode. It's bug-like, in any case.
>
>> ...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'.
>
> This does not answer my situation, I don't think. My project is an ASS
> app which places Unicode Text onto the clipboard for the user to then
> do with as they please (presumably, paste it into whatever app they are
> primarily working in). So, am I completely helpless around this Word
> bug? Must I simply tell the users, "You can then use the clipboard in
> any unicode aware app you wish, well, except for Word."?
> I am willing to add a handler that treats Word as a special case, if I
> know of some way to place a variable of class Unicode Text into the
> selection of the front document in Word 2004. In other words, given
> set theString to "Can you place me now" as Unicode Text
> is there ANY way to get that into the selection of the front Word
> document?
Yes. Here's a workaround. Ask the user to click a checkbox or button if they
intend to paste into Word (so as not to create unnecessary activity for
other users). If so then add on (after
set theString to "Can you paste me now ¥?" as Unicode text
set the clipboard to theString
)
tell application "Microsoft Word"
set newDoc to make new document
set content of text object of newDoc to theString
set selection's selection end to ((end of content of newDoc's text
object) - 1) -- extends selection to end
copy object selection
close newDoc saving no
end tell
Now you can paste it into Word.
--
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