using "find" you'll receive a textlocation. Now you have to "manually" change the text with oDoc.Delete(TextRange) and then insert your replace-text.
I hope, I understood your question right???
I think you have given me the answer, which is "no." I was looking for a way to programmatically emulate the "Change" buttons. While you explain the simple case of text replacement, it gets much more complicated when you are using regular expression replacements and other special replacement types. So, I think this is simply not exposed in the API, as a packaged operation. It would be nice if they would open that up.
can you give a quick code example, what you have to code now and how you would like to have it in the future?
Thanks for asking! So, what we have today is a very comprehensive interface to do the Find; that is, to do all the things that you see in the top of the Find pod. But, no way to invoke the things in the bottom of the pod.
Imagine this scenario... I want to find web pages in a document and add a fully-qualified domain. For example, if I have:
...and I want to replace all instances with something like this:
In the Find dialog box, I can use a regex like this:
...then in the Change area, I can use something like this, noting the regex substitution ($1)
In ExtendScript, I have full ability to do the search:
var findParams = AllocatePropVals (3); findParams.propIdent.num = Constants.FS_FindText; findParams.propVal.valType = Constants.FT_String; findParams.propVal.sval = "Page: [a-z]+\\.htm"; findParams.propIdent.num = Constants.FS_FindCustomizationFlags; findParams.propVal.valType = Constants.FT_Integer; findParams.propVal.ival = Constants.FF_FIND_USE_REGEX; findParams.propIdent.num = Constants.FS_FindWrap; findParams.propVal.valType = Constants.FT_Integer; findParams.propVal.ival = false; var findTR = oDoc.Find(/*some text loc*/, findParams);
But, if I want to do the change, I have to programmatically extract the string, to the regex work, do the replacement, etc. Wouldn't it be nice if I could just do something like this, which would emulate clicking the Change button:
var changeParams = AllocatePropVals (3); changeParams.propIdent.num = Constants.FS_ChangeType; changeParams.propVal.valType = Constants.FT_Integer; changeParams.propVal.ival = Constants.FS_ChangeToText; changeParams.propIdent.num = Constants.FS_ChangeItem; changeParams.propVal.valType = Constants.FT_String; changeParams.propVal.sval = "Page: http://somedomain/$1"; changeParams.propIdent.num = Constants.FS_ChangeCloneCase; changeParams.propVal.valType = Constants.FT_Integer; changeParams.propVal.ival = false; var changeTR = oDoc.Change(findTR, changeParams);
That's what I'm thinking about. An interface to the change operations.