Community
    • Login

    Apply macro to a selected characters in a file

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    2 Posts 2 Posters 352 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Rom Ortiz-ToroR
      Rom Ortiz-Toro
      last edited by

      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 :

      1. select line2 and line3
      2. 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

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Rom Ortiz-Toro
        last edited by PeterJones

        @Rom-Ortiz-Toro ,

        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.

        1 Reply Last reply Reply Quote 2
        • First post
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors