Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #29485
    Scott Daughtry
    Participant

    The autonumber (Alt-N) feature does not work against a selected block of text – a feature I use a lot with other text editors. I’ve tried various methods of “tricking” EmEditor to achieve this feat with no success, to include selecting a block of text, pressing the tab key, then enter CSV mode – which then selects every line of text within the file to then autonumber. A second part of this problem is intelligent padding of zeroes; for example, if there are 200 lines of text to select/autonumber, ideally the first 9 lines would have two preceding zeroes; lines 10-99 would have one leading zero, and lines 100-200 would have no leading zeros.

    I’m hopeful someone has figured out how to achieve this trick and can share with me their solution. I’d love to see these two options integrated into a future EmEditor build within the Autonumber dialogue window!

    #29486
    em-like
    Participant

    I assume that you are using the latest version. (Version 22.5.2 EmEditor Professional (64-bit)).
    Whereas I have been using the insert numbering function for several generations and I have not had any problems.

    First, for your second case, adding zeros.
    Insert the maximum number of zeros before the first number in the dialog “Insert Numbering – First Line”.
    In your example 001.

    The answer to your first question is a bit more comprehensive, as EmEditor offers a wide range of possibilities.
    In general, if the cursor is in more than one place, the “Number of Lines” field will be grayed out and the number of cursors will be inserted.

    scenario 1:
    A word is marked in the text (or the cursor is positioned on a word) and the function “Select All Occurrences” is selected, then the right arrow key is pressed once (the cursors are now positioned at the end of these words), the function “Insert Numbering” is applied. It is even possible to enter e.g. _01 at “First Line”. This way all these words will be numbered consecutively with _01. (Test_01,Test_02,Test_03 …).

    scenario 2:
    With the function “Vertical Selection” the cursor can be placed e.g. at the beginning or end of the lines. The numbers will now be inserted at these positions.

    Scenario 3:
    The cursor is placed e.g. with pressed Ctrl key and the left mouse button several times. As already mentioned several times, the numbers are now inserted in these places.

    scenario 4:
    If a text block is selected in “Vertical Mode” e.g. with Alt key and mouse and then the right or left arrow key is pressed (depending on where the numbers are to be inserted), the numbers can now be inserted.

    Important, if a text or text block is marked and the function “Insert Numbering” is selected, the marking is replaced with the consecutive number. However, if the number is to be inserted and the selection is not to be overwritten, the cursor must be displayed as a line. The easiest way to do this is to use the right or left arrow key (depending on whether the numbers should be at the beginning or the end).

    Please also check if you are in “Insert or overwrite mode”.

    EmEditor offers another possibility, which is even faster in some cases.
    Select a number (mark this), at the right lower corner of the marking a square appears, press Ctrl key and drag this square downwards with the mouse. Analogous to Excel, the numbers are inserted continuously.

    Please let me know if this answers your questions.

    #29487
    Scott Daughtry
    Participant

    Good afternoon,

    Thank you for the reply. Here are the results of my trying each of your scenarios against the following simple example:
    *————- start
    a
    b
    c

    leave me alone (i.e. don’t add prefixed numbers)
    *———— end
    with the end result should looking like this:
    *———– start
    01 – a
    02 – b
    03 – c

    leave me alone (i.e. don’t add prefixed numbers)
    *————– end
    note: in each instance I was in INSERT versus OVERWRITE mode when editing the document:

    (1) Must not understand the example, as I’ve tried multiple ways and it failed each time
    (2) Vertical Selection selects all lines in the file, which I cannot figure out how to override or just work on a few selected contiguous lines
    (3) I don’t understand what you’re trying to say
    (4) Always overwrites the entire block of selected text with numbers (i.e. destructive overwrite)
    (5) This repeated the selected number across multiple lines

    I’m at a loss.. I’ve never encountered this level of difficulty in something so simple. Either the entire line of text is overwritten or every line of the file is renumbered.

    #29488
    NedMaker
    Participant

    I once wrote to the author of the program asking him to implement this function, but for some reason he did not want to, he thought it was not necessary.
    You can use the macro to number the selected lines.
    https://disk.yandex.ru/d/Jm0KAeKOtYq8TQ

    #29494
    Yutaka Emura
    Keymaster

    You should be able to do the Numbering on selected block of text (also called “vertical selection”). To do that, first, select a block of text while pressing the ALT key. Alternatively, press CTRL + SHIFT + F8 to start selecting a block of text. While a block of text is selected, you can press ALT + N to insert the numbering.
    As em-like mentioned, you can use “001” to add 0-padding.

    #29495
    Scott Daughtry
    Participant

    Good morning Yutaka,

    It’s a pleasure to virtually meet you. I tried what you suggested – ensuring EmEditor is in INSERT mode I selected a block of text with the mouse while holding down the ALT key; press Alt-N to display the dialogue with Decimal selected (all other dialogue options left to their default), then press OK. The selected text is then overwritten with the numbers. The simple experiment used the following sample text:

    leave alone

    a
    b
    c
    d
    e
    f
    g

    leave alone

    #29496
    Scott Daughtry
    Participant

    NedMaker – your macro worked perfectly! Thank you SO much for your generosity in sharing it with me – I sincerely appreciate you!! If you have a repository of EmEditor macros I would love to explore them – I am new to EmEditor and its macro language is foreign to me.

    #29498
    em-like
    Participant

    If the macro fulfills all wishes, everything is ok. But since so many questions/comments have been written to my answer, I would like to add the answers here.
    For questions of this kind, it is usually very helpful to show your example of the initial data and what the expected result should be.

    1: EmEditor offers many ways to move multiple cursors to different places.
    – A manual way is for example to hold ctrl key and click with the left mouse button to different places.
    – With the function Find (Ctrl + F) there is the possibility with “Select All” to select all search terms, I then press “arrow right key” to put the cursors at the end of all results. Now you can choose the automatic numbering or just continue writing.
    The video examples on “https://www.emeditor.com/text-editor-features/coding/multiple-selection-editing/” show a small range of what is possible. As you can see, these examples were created several years ago (see version numbers), but in the meantime EmEditor has been extended by many functions, thanks to Mr. Yutaka Emura. A few more possibilities were already mentioned in the first answer.

    2: Please read the comment of Mr. Yutaka Emura. I mostly use the function “Line Down Extend (Vertical Mode)” “Alt+Ctrl+Down” Extends the vertical selection down one line. This is the fastest way for me when, for example, I don’t want to edit more than one screen at a time.
    3: Please look at point 1 the link to the videos.
    4. Simple example, the enumeration consists of numbers, but it should be letters. Select all numbers as vertical selection (see point 2 above) and use “automatic numbering”.

    01 Example …
    02 Example …
    03 Example …
    04 Example …
    05 Example …

    result:
    a Example …
    b Example …
    c Example …
    d Example …
    e Example …

    5. As I wrote, press Ctrl key (as long as the area is selected with the mouse. First release the mouse button and “then” the Ctrl key), as usual in spreadsheet programs, e.g. Excel. If the Ctrl key is released before the mouse button, the selection is only duplicated.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.