I need to find any sequence of 4 digits (that is inside an InDesign text frame) and replace it with another given number from a given list.
What I need to know is the found number so that I can pass that to my given list to get the replacement number. How can I do that? This is what I figured out so far:
tell application "Adobe InDesign CS6"
set find grep preferences to nothing
set change grep preferences to nothing
set myTextFrame to item 1 of selection -- I have a text frame selected that contains for instance "1234" among other text
set find what of find grep preferences to "[0-9]{4}"
set change to of change grep preferences to "other number"
-- set applied paragraph style of find grep preferences to "body"
tell myTextFrame
-- code to find out what the found number is
change grep -- this is the replace action, unfortunately I don't know what the number was that was replaced. I really need to know, because each found number has it's own corresponding replacement number from a given list.
end tell
end tell
Thanks in advance for any help.
Bert.