Re: MS Word 2004 basic questions
Re: MS Word 2004 basic questions
- Subject: Re: MS Word 2004 basic questions
- From: Larry the O <email@hidden>
- Date: Wed, 7 Feb 2007 18:28:40 -0800
Thank you SO much, Kai. Looking at your code, I realized that setting
the content of the find object of the selection had to be inside my
repeat loop, which was why it kept finding the next occurrence
instead of the next text to be searched for. Your code for finding
the complete word had some nifty tricks, too. There's still a few
bugs to work out, but this feature now basically works, which is huge
for me.
Thanks again!
Larry the O
On Feb 7, 2007, at 7:49 AM, kai wrote:
On 7 Feb 2007, at 14:01, some blabbermouth wrote:
On 2 Feb 2007, at 22:49, email@hidden wrote:
Is there a way I could get the whole word that the selection is
part of?
Something like this should do it:
That was a bit more convoluted than it needed to be. Take 2:
---------------
set search_text to text returned of (display dialog "Enter the text
to find:" default answer "")
tell application "Microsoft Word"
set selection's selection end to 0
set selFind to find object of selection
set selFind's content to search_text
set text_found to execute find selFind
if not text_found then return beep (* signal failure *)
tell (create range active document start 0 end selection's
selection end)
set word_count to count words
set word_start to end of content of words 1 thru (word_count - 1)
set word_end to end of content of words 1 thru word_count
set found_word to set range it start word_start end word_end
end tell
content of found_word
end tell
---------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40meyersound.com
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden
_______________________________________________
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