replace characters

dear all
this is in one of find and replace action I got and I need some help in it

here the script I did…

tell application “Adobe InDesign CS4”
–Set the user interaction level to allow InDesign to display dialog boxes and alerts.
set user interaction level of script preferences to interact with all
set myTextObjects to {text, text frame, insertion point, character, word, text style range, line, paragraph, text column, cell, table, row, column}
if (count documents) is not 0 then
if (count stories of active document) is not 0 then
display dialog “do like this and this … blb blb” buttons {“yes”, “cancel”} default button 1 with icon 1
if button returned of the result is “yes” then
– this is the script to change all the text
–first clear the preferences
try
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to “AB^?^?EF”
set change to of change text preferences to “BB^?^?EE”
set myFoundItems to change text
end try
end if
end if
end if
end tell

as I know if you like to change some part of word and it have multiple character you can use the sign “^?” for unknown character…
this what I did …
the original word was

ABCDEF

but I got the result like that

BB^?^?EE

I think there is something I don’t know … to keep the original character in the place of ^?

hope to get help for that

Hi alsadr,

There is no ^? in AppleScript. There’s no regular expressions also, although the ? is probably wrong.

What you’re looking for is a grep search, something like this:

 set find grep preferences to nothing
 set change grep preferences to nothing
 set find what of find grep preferences to "AB(.{2})EF"
 set change to of change grep preferences to "BB$1EE"

There are lots of resources on the Web for InDesign grep searches.