Increase/Decrease All Highlighted x or y Coordinates

  • I need to shift a lot of buttons at a the same time without having to increase/decrease the x or y coordinates manually one at a time.
    I can use Alt to select a column, just need some way to +/- the value.
    Like pressing + or - key, x=x+1 x=x-1

    Gui, Add, Button, x22 y150 w90 h20 , Button 1
    Gui, Add, Button, x22 y170 w90 h20 , Button 2
    Gui, Add, Button, x22 y190 w90 h20 , Button 3
    Gui, Add, Button, x22 y210 w90 h20 , Button 4
    Gui, Add, Button, x22 y230 w90 h20 , Button 5
    Gui, Add, Button, x22 y250 w90 h20 , Button 6
    Gui, Add, Button, x22 y270 w90 h20 , Button 7
    Gui, Add, Button, x22 y290 w90 h20 , Button 8
    Gui, Add, Button, x22 y310 w90 h20 , Button 9
    Gui, Add, Button, x22 y330 w90 h20 , Button 10
    Gui, Add, Button, x22 y350 w90 h20 , Button 11
    Gui, Add, Button, x22 y370 w90 h20 , Button 12
    Gui, Add, Button, x22 y390 w90 h20 , Button 13
    Gui, Add, Button, x22 y410 w90 h20 , Button 14
    Gui, Add, Button, x22 y430 w90 h20 , Button 15
    Gui, Add, Button, x22 y450 w90 h20 , Button

  • If that were my task, and it was going to be a one-time thing, I would column-select (click on upper left of the box, alt+drag to lower right), copy, and paste into a spreadsheet; add +n using spreadsheet; copy the column from spreadsheet. Unfortunately, when you copy a column from Excel, it includes the EOL characters, so if you try to column-paste back into NPP, it doesn’t do what you want. Instead, open a new tab in NPP, paste, column-select that new data, and column-paste (column-highlight the same column you originally copied, and paste over it).

    If it were something I was going to do a lot, the back-and-forth from Notepad++ to spreadsheet would start annoying me, so I’d figure out how to do it in a scripting language. I would use code based on this pseudo-code outline:

    prompt user: "which column (x, y, w, h)?" => col
    prompt user: "+1 or -1" => delta
    for each line of FILE
        search the line for "{col}###"
        var = value(###) + delta
        replace "{col}###" with "{col}{var}"
    next line

    In general, I would use a convenient standalone language (probably Perl). But if I was also going to be doing other edits/experiments, so I wanted to keep the file “live” in NPP, I would fire up my PythonScript plugin and hack the script there (making copious use of Python help sites for looking up the syntax, since I’m not fluent in Python). If I had more time this morning, I’d probably provide you with the script-writing service. Maybe @Claudia-Frank has more time today than I do (hmm, maybe not… she hasn’t logged on in almost a week! If I find time later, and no one else has stepped up, maybe I’ll give it a go.

  • @PeterJones

    sorry, currently not - still working on the python script x64 port
    and want to get this finished first ;-)


  • Sorry, it took me a while to find the time to work on this

    You need PythonScript and 32bit Notepad++ for this to work. You can download PythonScript here

    # Will prompt for which column (allows x, y, w, h) and how much to add or subtract (requires a number)
    # Will then do the search/replace over the whole file
    DEBUG = False
    def delt_1(m):
        global addend
        this =
        if DEBUG:
            console.write("matched '")
        r = str(addend + int(this))
        if DEBUG:
            console.write("return: '" + r + "'")
        return r
    if DEBUG:
    if DEBUG: console.clear()
    column = None
    while column != "x" and column != "y" and column != "w" and column != "h":
        column = notepad.prompt("Which column [x y w h]?", "Choose column", "y")
    addend = None
    while addend == None:
        direction = notepad.prompt("Number to add (negative for subtraction)", "Choose delta", "1")
            addend = int( direction )
            addend = None
    if DEBUG:
        console.write("column: " + column + "\n")
        console.write("addend: " + str(addend) + "\n")
    pattern = "((?<=\s{0})\\d+)".format( column )
    if DEBUG: console.writeError(pattern + "\n")
    editor.rereplace(pattern , delt_1)

Log in to reply