Write numbers from one to another one.



  • Hello
    I want to write for example from 1-1000 in notepad ++.
    Like this 1,2,3,4,5,6,…1000
    How can I do this?



  • Select a number of (blank) lines equal to how high you want to count. Edit > Column Editor (Alt+C) > ☑ Number to Insert > Initial: #, Increase: 1, and it will start at #.

    If it’s okay to be on separate lines, you’re done.

    If you want them comma-separated instead, then select the rows, Search > Replace (Ctrl+R), FindWhat=\R, ReplaceWith=, (that’s comma space), ☑ In Selection, Replace All.



  • @PeterJones said:

    If you want them comma-separated instead

    I would revise Peter’s Replace All action as follows:

    Find what zone: \x20*\R
    Search mode: Regular expression

    The reason for the tweak to the Find what is that this Column editor commnd will pad on the right with blank characters if you do more than 10 lines. The Search mode addition is simply because Peter forgot to mention it. :-)



  • One short Python Script should do the job:
    s=’’
    for i in range(1,1001):
    s += ‘{:},’.format(i)

    editor.appendText(s)

    inserting 1,2,3,4,5,6,…1000, at the current cursor position.

    Or with some help from mawk (3rd party free software and NppExec):
    mawk “BEGIN { for (i = 1; i <= 1000; i++) {if (i==1000) {printf i} else {printf i’,’}} }” | clip
    have 1,2,3,4,5,6,…1000 saved in the clipboard.



  • @PeterJones
    Hello again
    Thanks Peter Jones
    It works
    But i have a question.
    Is there any way to make a lot of blank lines by the app not by hand?



  • @dedsec24 said:

    make a lot of blank lines by the app not by hand?

    Yes, do the following:

    • Macro (menu) -> Start Recording
    • In a document tab, press the Enter key
    • Macro (menu) -> Stop Recording
    • Macro (menu) -> Run a Macro Multiple Times…


  • Hello @dedsec24, @scott-sumner,

    I don’t understand, exactly, the necessity to create a macro ?!

    Why not, either :

    • Hold down the Enter key, the necessary time ?

    • Create a pure blank line and hit on the Ctrl + D shortcut, several times ?

    Cheers,

    guy038



  • @guy038

    My assumption was that one knows how many blank lines one wants…a hard number. Then one puts this number into the Run a Macro Multiple Times… input box when prompted.

    Of course, if one just wants a “gob” of blank lines, then sure, just hold down the Enter key…

    We sure do get a lot of vague questions on here, though, don’t we? :-)



  • Thanks all of you
    I got my answer.


Log in to reply