Search/Replace Question
Posted: Tue Aug 07, 2012 7:52 pm
Hi, Jussi,
I'm trying to use the ReplaceNext() keyboard function in a LUA macro and running in to a bit of a problem. What I would like is for it to search forward from the current line and replace the next occurrece. I do not want to use the Replace Dialog to start this - what I would like is to set the search options and find/replace text in the macro, then do the ReplaceNext().
My problem is that it appears that the replace dialog establishes the reference point for "next". My current line in the file is ignored by the test macro - instead it seaches from the previous replace. If I've moved forward in the file past some text that matches the find, the first matching text past the previous match is what is replaced, not the first match past the current position.
Is there a way to manipulate the starting point for ReplaceNext? Is there some other keyboard function or macro builtin that I should be calling before the ReplaceNext?
The way it works now is certainly not unreasonable, might even be beneficial in certain circumstances, but it's not what I need at the moment. Any alternatives come to mind?
Bill
I'm trying to use the ReplaceNext() keyboard function in a LUA macro and running in to a bit of a problem. What I would like is for it to search forward from the current line and replace the next occurrece. I do not want to use the Replace Dialog to start this - what I would like is to set the search options and find/replace text in the macro, then do the ReplaceNext().
My problem is that it appears that the replace dialog establishes the reference point for "next". My current line in the file is ignored by the test macro - instead it seaches from the previous replace. If I've moved forward in the file past some text that matches the find, the first matching text past the previous match is what is replaced, not the first match past the current position.
Is there a way to manipulate the starting point for ReplaceNext? Is there some other keyboard function or macro builtin that I should be calling before the ReplaceNext?
The way it works now is certainly not unreasonable, might even be beneficial in certain circumstances, but it's not what I need at the moment. Any alternatives come to mind?
Bill