Apply macro to a selected characters in a file
-
hello, i am looking for a way to apply a macro to a selected characters in a file.
For example:line1
line2
line3
line4
line5
…I want to :
- select line2 and line3
- run macro and only affects those two lines
Today, I am 1) copying and pasting to another tab line2 and line3 2) running the macro and 3) copy/paste back
Thanks
-
Any operation that works on the active selection that can be macro recorded will already work as you describe. Any operation that does not take into account the active selection is not likely to be able to work in the way you describe.
As a first level of improvement, you could automate the copy/new/paste/actions/copy/paste sequence into one macro, rather than doing the preliminary and cleanup copy/pastes outside the macro.
Then, depending on what the actions are, you might be able to limit them to only be in the selection, rather than the whole document. But since you’ve given us no hints as to what it might be doing, we cannot comment on whether that’s feasible for your particular macro.
Finally, there are actions that are too complicated to turn into macros. For such actions, we often suggest switching to one of the scripting plugins for Notepad++, like PythonScript; those plugins allow you to use a programming language to automate Notepad++ to your heart’s content: they have full access to the contents of the open files as well as being able to trigger any of the actions you can take from the GUI.