• 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: automator/script to delete pages from MS Word document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automator/script to delete pages from MS Word document


  • Subject: Re: automator/script to delete pages from MS Word document
  • From: Lars Blumberg <email@hidden>
  • Date: Mon, 23 Feb 2009 13:27:26 +0100

As far as I understood the documentations

Applescript for Word 2004 (works as well for Word 2008) - look for "Working with text range objects"
http://download.microsoft.com/download/1/3/E/13E8AE25-78F7-41A8-B252-F09C465CE29C/Word2004AppleScriptRef.pdf
and
http://www.microsoft.com/mac/developers/default.mspx


you need to use "text tanges". At first you specify your text range, then select it and then delete it. Deleting a whole pages at once does not seem to be supported. So maybe you know the count of text paragraphs to be removed from each document (or you know at least for which text to look for to find the ending of the. Then you can apply the following script

tell application "Microsoft Word"
set doc to active document
--set r to create range doc start (start of content of paragraph 1 of doc) end (end of content of paragraph 3 of doc)
--set r to text object of paragraph 1 of doc
set r to text object of last paragraph of doc
select r
type backspace selection
type backspace selection
end tell


The first commented line does not seem to select anything - so use it as an idea. I observed that you need to type backspace twice, and make sure that you didn't select anything manually before - otherwise it does not seem to work always.

Lars

Am 23.02.2009 um 04:42 schrieb Christopher Sutton:

Hi All,

I was just wondering if anyone might have any ideas how to do the following in Automator/AppleScript:

I need to strip the first 2 pages and the last 4 pages from a large Word doc. The Word documents vary in length, but it's always the first 2 pages and last 4 pages that need to be removed.

I'd like to be able to dump multiple documents into an Automator application or workflow and basically end up with with the middle section as the result.

Thank-you for your time and any ideas you may have.

Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >automator/script to delete pages from MS Word document (From: Christopher Sutton <email@hidden>)

  • Prev by Date: automator/script to delete pages from MS Word document
  • Next by Date: Subject: automator/script to delete pages from MS Word document
  • Previous by thread: automator/script to delete pages from MS Word document
  • Next by thread: Subject: automator/script to delete pages from MS Word document
  • Index(es):
    • Date
    • Thread