Simple problem: duplicate Word doc contents...not so simple
Simple problem: duplicate Word doc contents...not so simple
- Subject: Simple problem: duplicate Word doc contents...not so simple
- From: Mahlon Lovett <email@hidden>
- Date: Sun, 7 Feb 2010 18:35:37 -0500
Problem
Begin with a batch of protected Word documents, which I do not have privileges to modify, but which I none-the-less need to modify in order to complete an assignment...
Starting from a Finder file selection... (This script is not complete from that perspective; I just wanted to share the MS Word piece of it.)
Open a Word document (protected .docx file) and save entire contents into a new document (.doc) at the same location as the original. This copy will contain the contents of the input, formatted as the original, but w/o protection.
tell application "Microsoft Word"
launch
open (thisfile as string) -- assume that thisfile is a Finder alias
copy object text object of active document
close active document saving no
create new document new blank document
paste object text object of active document
save as active document file name newfile file format format document
close active document saving no
end tell
Success.
I wanted to share this script because unlike Textwrangler, which could have recorded the essence for me in about 30 seconds, I had to invest 45 minutes trying to make sense of the document model and dictionary entries for MS Office/Word.
No matter how well or not that it reads, none of the words in the script shown above are UNnecessary; remove a single one and the script will fail.
Anyone else have MS Office tidbits that they care to share?
Mahlon
Princeton NJ
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden