[comp.sys.mac] How to use the clipboard of Word?

kjr@utacs.UUCP (Kari-Jouko R{ih{) (03/05/87)

(I am posting this for a friend who does not have access to the news.
Please mail replies directly to the address given below.)

I have made a desk accessory that uses the clipboard.
I have a problem with MS Word, for I have not managed
to read (or write) its clipboard directly. However,
my desk accessory works well with other applications
(and DA's) tried so far. I'd like to know how a DA can
read (and write) the clipboard of MS Word.

Jorma Tarhio
seismo!mcvax!santra!uhecs!tarhio

dplatt@teknowledge-vaxc.ARPA (Dave Platt) (03/06/87)

Posting-Front-End: GNU Emacs 18.33.2 of Fri Feb 13 1987 on teknowledge-vaxc (berkeley-unix)


Jorma Tarhio asks how to write a desk accessory that can access MS
Word's clipboard.  Jorma, I believe that your inability to access the
MS Word clipboard may be due to a failing on Word's part to follow the
rules of the clipboard (a.k.a. scrap), as described in Inside
Macintosh.  As I recall, it's quite legal for applications to maintain
their own, private scrap, but if they do so then they must be able to
copy its contents to, and from the standard desk scrap at the
appropriate times.

Details about the "rules of the road" can be found in the Scrap
Manager chapter in Inside Macintosh.  I believe that there's a
low-memory counter that is incremented whenever a DA pastes something
into the scrap, and that Word should notice this and copy the desk
scrap into its private scrap.  Similarly, I believe that Word should
be copying its private scrap into the desk scrap when it terminates,
receives a "deactivate" Switcher event, or sees that a desk accessory
is being invoked (via a menu pulldown) or activated (via a mouse-click
in the DA's window). It sounds as if Word is maintaining a private
scrap, but isn't always copying its contents to the desk scrap area
when your desk accessory gains control.

If this is the case, then I fear that you probably can't program
around it, unless you're willing to poke into the guts of Word with
MacNosy or something similar, figure out how it maintains its private
scrap (the format probably won't be the same as the desk scrap), and
interpret its data directly.  Think three times, count to 1000, and
take a long vacation before doing this!!

Disclaimer: "I am only an egg", and have never written a DA.
Correction of my hunch by those more knowledgable is eagerly invited.

                Dave Platt

Internet:  dplatt@teknowledge-vaxc.arpa
Usenet: {hplabs|sun|ucbvax|seismo|uw-beaver|decwrl}!teknowledge-vaxc.arpa!dplatt
Voice: (415) 424-0500
USnail: Teknowledge, Inc.
        1850 Embarcadero Road
        Palo Alto, CA  94303