• 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
MS Word 2004 basic questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MS Word 2004 basic questions


  • Subject: MS Word 2004 basic questions
  • From: email@hidden
  • Date: Fri, 02 Feb 2007 15:49:33 -0700

I have the MS Word Applescript documentation, but it is NOT easy to
figure everything out, especially as some concepts do not seem to be
clearly layed out. I am a pretty experienced AppleScripter, but there
are a few fairly rudimentary questions I can't seem to easily resolve.

*** read/find pointer

tell application "Microsoft Word"

-- Create a text range out of the entire document
set wholeStory to (create range active document start 0 end (count of
characters in active document))

-- Now search for a string
set selFind to find object of selection
		set content of selFind to <string of interest>
		execute find selFind
end tell

If I run this script, it finds and selects the first occurrence of
<string of interest>. If I then run it again, it finds the *second*
occurrence of <string of interest>, the next time it finds the third
occurrence.

Clearly, there is a read pointer that is not getting reset so the find
starts from where the last one stopped. How do I reset this pointer?

I tried setting the selection to the first word in the document and then
collapsing the selection to the start, but that doesn't seem to do it.

*** testing characters: spaces don't count

Although I'm familiar with object-oriented programming, I'm still
getting my head around Word's objects (text object, font object, etc.)
A lot of it is reasonably intuitive, for instance, it's not hard to
understand that you must get the content of a range to get the actual
text in it, but the relationship of the text object of the range to the
content of the range is a little fuzzy. Is there content of the text
object as well content of the range?

Further, when I try to set a range that includes spaces, the spaces seem
to get ignored. What I need to do is test a few characters following a
selection. So far, I'm doing it by creating a new range defined by

start (end of content of selection +1)
end (end of content of selection +2)

to select the two characters after the selection. But if I then examine
character 1, it ignores the space between words. Is this because it is
treating it as AppleScript's text item delimiter? Do I need to redefine
the text item delimiter to do this operation?

Is there a way I could get the whole word that the selection is part of?

Thanks!

Larry the O



 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: MS Word 2004 basic questions
      • From: kai <email@hidden>
  • Prev by Date: Re: Placing images in Quark
  • Next by Date: Getting the location of mailboxes from mail/Eudora
  • Previous by thread: Re: add users remotely
  • Next by thread: Re: MS Word 2004 basic questions
  • Index(es):
    • Date
    • Thread