Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scripting Word top copy text - should be simple, but ain't



Short answer...

tell application "Microsoft Word"
content of text object of document "Hello.doc" -- or document 1, or document whatever
end tell

Long answer...

Buy Script Debugger 4. The above script took me 20 seconds to write. Well, I say 'write', but all I had to do use SD4's Explorer Tab to find how Word refers to the contents of a document. I then dragged the reference from the Explorer Tab into a new script document.

Simon

p.s. I've never even opened Word's dictionary before.
p.p.s. Buy SD4. you'll never regret it.


On 25 Apr 2006, at 05:37:11 pm, Charles Arthur, UKClimbing Editor wrote:

Thanks for the attempted answers on this (which have come up in my RSS
newsreader before the digest has arrived - uh).

textutil: nice try, Shane, but I'm afraid that it can't do Word 5 files -
it leaves the control characters in.

Mr Tea: did you look at what Word Vx produced as the result of the script?
set mytext to text of window 1

for me, that just gives "text of window 1" as an application object. But
there's no way I can coerce it to the actual *text*. (A reminder: I'm using
Word 2004, which has - no exaggeration - something like 100 entries in its
dictionary for "text" (including text range, text column, text columns
evenly spaced) including two different ones called "text", both of which
are for text insertion, and about 20 called  "text object" which seem to be
properties of all sorts of different things.

But none that is just the "word things in the document/window". Argh!!

This *must* be possible, surely.

     best
     Charles
-- 
http://www.ukclimbing.com : 1,000+ British crags, 350+ British climbing walls
- searchable by distance rock type, etc, with 5-day weather forecasts for
every one - plus maps, articles, news, and the New Routes database. There's
even a cool shop attached...
 _______________________________________________
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



Simon Topliss
Senior Systems Developer

Trident UK
Connaught House
Connaught Road
Kingswood Business Park
Hull HU7 3AP
Switchboard: +44 1482 828100
Fax: +44 1482 710600
DDI: +44 1482 710359
Mobile: +44 7788 587394


This email message and all documents which accompany it are intended only for the use of the individual or entity to which addressed, and may contain privileged or confidential information. Any unauthorised disclosure or distribution of this email message is prohibited. If you have received this email message in error, please notify the sender and delete this from all computers.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden

References: 
 >Re: scripting Word top copy text - should be simple, but ain't (From: "Charles Arthur, UKClimbing Editor" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.