Re: Replacing braces in search and replace strings "{" and "}"
Re: Replacing braces in search and replace strings "{" and "}"
- Subject: Re: Replacing braces in search and replace strings "{" and "}"
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 26 Jan 2001 15:44:50 -0800
On 1/26/01 1:00 PM, "Bill Planey" <email@hidden> wrote:
>
I need to automate a search and replace function in MS Word with pattern
>
matching turned on. Braces ( "{" and "}" ) already have special meaning
>
in AppleScript (as well as the pattern matching feature of search and
>
replace in Word). How can I get my find string to contain braces?
Those braces made in word with commad-F9 and option-F9 aren't regular braces
anyway. You can't really do what you're attempting in "straight"
applescript. You have to use the 'do Visual basic' command and do it in
Visual Basic. Then you can script the .Find property in VB to do the same
thing as what you do manually with braces. It's very tricky: you have to use
_exactly_ the typography you see with the field labels showing. If you
download my script 'Print Mailing Labels' from AppleScript Central
<
http://www.applescriptcentral.com/> and look at the VB Script for inserting
bar codes there, you'll see an example. I got invaluable help for this from
the newsgroup microsoft.public.word.mailmerge.fields accessible through the
Microsoft News Server. I suggest you ask there for more help that you might
need.
You use 'do Visual Basic' by putting the VB script in quotes. You have to
"process" it in a handler to add the applescript escape backslash to any
double-quotes within the script (\" instead of plain ") and vbCr to line
endings within VB variables. You can insert applescript variables whenever
you want. Again, my script will show you a few examples.
--
Paul Berkowitz