Community
    • Login

    Add the same amount to every selected value?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    23 Posts 5 Posters 3.6k 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.
    • Alan KilbornA
      Alan Kilborn @Diz Hydron
      last edited by

      @diz-hydron said in Add the same amount to every selected value?:

      Is my understanding of that part correct?

      Sounds right, although for sure don’t bother with the shortcut key thing right out of the box. That would only be useful if this whole thing actually works for you, and if you need to do it multiple times. Just run the script from the menus to start with.

      1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @Neil Schipper
        last edited by

        @neil-schipper said in Add the same amount to every selected value?:

        he is a rapper by night,

        I have never been accused of that particular moonlighting before…

        @Diz-Hydron ,

        Is my understanding of that part correct?

        That seems a reasonable summary of the process.

        If nothing happens, I would tell PythonScript to show the console, and you can look to see if there is an error message.

        1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by guy038

          Hello, @diz-hydron and All,

          Well, @diz-hydron, I suppose you could begin with this very simple script, named diz.py

          def player_1(m):
              return str(int(m.group(1)) + X1) + ', ' + str(int(m.group(2)) + Y1)
          
          def player_2(m):
              return str(int(m.group(1)) + X2) + ', ' + str(int(m.group(2)) + Y2)
          
          editor.rereplace('"player1": \\[\K(-?[0-9]+), (-?[0-9]+)', player_1);
          
          editor.rereplace('"player2": \\[\K(-?[0-9]+), (-?[0-9]+)', player_2);
          

          Before running the script, of course, change the X1, Y1, X2 and Y2 values for true positive or negative integers ( e.g. +7 or -3 )

          It should work nicely with your text posted here


          In a next step, it would be better to enter the different values with, for instance, the notepad.prompt python command and assign the 4 typed numbers to the X1, X1, X2 and Y2 variables…

          Best Regards,

          guy038

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