Working with Selected text in MS Word 2008 find/Replace
Working with Selected text in MS Word 2008 find/Replace
- Subject: Working with Selected text in MS Word 2008 find/Replace
- From: jscriven <email@hidden>
- Date: Mon, 30 Nov 2009 16:45:46 -0500
- Acceptlanguage: en-US
- Thread-topic: Working with Selected text in MS Word 2008 find/Replace
I am trying to convert an old Word 2004 macro into Applescript. It
basically takes whatever text the user has highlighted/selected and replaces
all of the characters with their phoenetic Russian equivalents. I have the
basic find and replace part working, but it affects the whole document. I
would like to set the range to only include the selected text in the
original document. In the original macro, I copied the text block to a new
document, ran the replacements on the whole new document, and copied the new
text block back to the original. In applescript it looks like I might be
able to set the selected text as my range, but I don't understand the
syntax. Any help would be greatly appreciated. Here is what I have so far.
Obviously, there are many more replacements in the real one.
Thanks in advance, Julie Scriven
tell application "Microsoft Word"
activate
set docRange to text object of active document
execute find (find object of docRange) find text "g" replace with "г"
replace replace all with match case
execute find (find object of docRange) find text "f" replace with "ф"
replace replace all with match case
execute find (find object of docRange) find text "h" replace with "ч"
replace replace all with match case
end tell
Confidentiality Notice: This email and any attachments are intended for use of the addressee(s) only and may contain privileged, confidential, or proprietary information that is protected by law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. If you have received this email and associated documents in error, please notify the sender immediately and delete the original. Thank you for your cooperation.
_______________________________________________
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