• Searching youtube

    6
    0 Votes
    6 Posts
    314 Views
    Marc HoppinsM

    @PeterJones said in Searching youtube:

    Thanks. I feel sure I did that variation yesterday. Anyway, it now works (again).

  • Is there a magic word combination for 100% accurate file auto-encoding?

    3
    0 Votes
    3 Posts
    205 Views
    notdodgeballN

    You can create a macro and assign it a shortcut. If going for the script path, using PythonScript would be:

    notepad.menuCommand( MENUCOMMAND.FORMAT_DOS_866 )

    But then it will be executed for every opened file, unless you code some conditionals, that’s why I would prefer the macro.

  • 1 Votes
    7 Posts
    1k Views
    guy038G

    Hello, @asapRepsnp, @coises, @terry-r and All,

    I think that an elegant solution would be to use the generic regex, exposed in this post :

    https://community.notepad-plus-plus.org/topic/22690/generic-regex-replacing-in-a-specific-zone-of-text/1?lang=fr

    Note that, to take in account the two types of your INPUT text, I used this leading regex part :

    (?-is:^Message-ID:(?:|\R)\x20<.{4}

    With the non-capturing alternative (?:|\R) which means : nothing or a line-break, between the colon char after Message-ID and the space char before the < character !

    So :

    Open your file in Notpead++

    Move the caret ( cursor ) :

    At the very beginning of your file ( Ctrl + Home )

    On a line, or the first line, beginning with Message-ID

    Open the Replace dialog ( Ctrl + H )

    Uncheck the Wrap around box option

    Then, with this complete regex S/R, below :

    SEARCH (?-is:^Message-ID:(?:|\R)\x20<.{4}|(?!\A)\G).*?\K.(?=.*.{4}@)

    REPLACE _

    The INPUT example text, below :

    Message-ID: <S3HC1075.C9B9D2W4@...> Message-ID: <F2CA98A6AWK-LDLL2WQVUFZWSA-8N4-O2WAX-DHGJ2@x> Message-ID: <20230112021536.D44C04F585AAECBA@...> Message-ID: <CAAGbbBVLx-B8sc2ifvzrHEUHTYEvSxkK5=OcDWxk=UKM3eMo2g@...> Message-ID: <347545688.95523.1695404577920.JavySail.boot@...> Message-ID: <S3HC1075.C9B9D2W4@...> Message-ID: <F2CA98A6AWK-LDLL2WQVUFZWSA-8N4-O2WAX-DHGJ2@x> Message-ID: <20230112021536.D44C04F585AAECBA@...> Message-ID: <CAAGbbBVLx-B8sc2ifvzrHEUHTYEvSxkK5=OcDWxk=UKM3eMo2g@...> Message-ID: <347545688.95523.1695404577920.JavySail.boot@...> Message-ID: <B7B207D39A1D4104860D8073A027CCD51DACD65B146E@...> Message-ID: <286f14f5-bb9d-4c26-ae24-2d4ae7484bb3@...>

    Is automatically changed as the following OUTPUT text :

    Message-ID: <S3HC_________D2W4@...> Message-ID: <F2CA__________________________________HGJ2@x> Message-ID: <2023_______________________ECBA@...> Message-ID: <CAAG___________________________________________Mo2g@...> Message-ID: <3475___________________________________boot@...> Message-ID: <S3HC_________D2W4@...> Message-ID: <F2CA__________________________________HGJ2@x> Message-ID: <2023_______________________ECBA@...> Message-ID: <CAAG___________________________________________Mo2g@...> Message-ID: <3475___________________________________boot@...> Message-ID: <B7B2____________________________________146E@...> Message-ID: <286f____________________________4bb3@...>

    Using the free-spacing mode, with the leading (?x) modifier, your search regex would become :

    SEARCH (?x) (?-is: ^ Message-ID : (?: | \R) \x20 < .{4} | (?! \A) \G) .*? \K . (?= .* .{4} @)

    For identical replacements, of course !

    Best Regards,

    guy038

  • Adding a plugin command to the toolbar

    2
    0 Votes
    2 Posts
    349 Views
    PeterJonesP

    @Нело-Анджело ,

    I guess I’m not sure what you’re asking for. In Lua Script v0.12, which is the active version, and has been for quite some time, the Plugins > LuaScript menu already has an Execute Current File command that works.

    79604b8f-d295-4aed-9b5d-8d0f41946501-image.png

    You can even use the Settings > Preferences > Shortcut Mapper > Plugins to assign a keyboard shortcut to that command, so that you can run it while you are editing the .lua script without using a menu.

    Since you brought up the “console”, are you saying you want a button in the console panel, which also runs the current command? As far as I know, there isn’t a way to do that. If you would like to make a feature request for that, that plugin has an issue tracker where you can make feature requests.

  • associate highlighting with the "copy" command

    6
    0 Votes
    6 Posts
    677 Views
    michel MICHELM

    @PeterJones
    Hi peterjones,
    you understood me perfectly. I saw that there is also AutoclipX but haven’t tested it yet. and it’s general to Windows not specific to Notepad++.
    anyway,
    thanks again peterjones.

  • .yaml files are turning into .yml files when using "Save (a Copy) As..."

    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP

    @L1N3R1D3R said in .yaml files are turning into .yml files when using "Save (a Copy) As...":

    You instead have to untick “Append extension” and then manually add the .yaml extension,

    … or you can just type the .yaml extension without unchecking that box. If there is an extension typed, “append extension” does not append a second extension.

    I’m confused why Notepad++ would automatically change the file extension of the copy

    It doesn’t change the extension; when you do a Save As (or Save A Copy As), it’s creating a new file, and you aren’t “changing” the name (so it’s not “changing” the extension) – it’s giving it a brand new, first time name. For all new files of a given filetype, Notepad++ assumes that the first extension in the list – in this case .yml, is the one for automatic extension. The same is true for any language that has multiple extensions.

    0f0641aa-0da0-4000-8f85-13abd08c248d-image.png

    But, as I said, all you have to do to override that default is to type your own extension, and Notepad++ will use it.

    And if you want to change things so that your copy of Notepad++ always uses .yaml as the default for YAML files, instead of .yml, you can close all instances of Notepad++, edit %AppData%\Notepad++\langs.xml, change <Language name="yaml" ext="yml yaml" ... to <Language name="yaml" ext="yaml ymml" ..., save and exit, then restart Notepad++ – from then on, .yaml will come before .yml in the Save/SaveAs dialog for YAML files, and that will be the default extension for you.

  • Insert multiple lines of code before or after a specific place in code

    5
    0 Votes
    5 Posts
    598 Views
    Rowlfi_the_dogR

    Hello,

    thank you for both answers !!

    But in the meantime I could solve my little problem myself …

    In case someone is interested, I will give a little description of how I did it:

    1.) Identify the location by a unique character (or series of those)
    2.) replace tab: “unique character as above” \n \n xyz
    3.) highlight the “xyz” with a bookmark
    4.) replace the bookmarked “xyz” with the clipboard

    Regards,
    Rowlfi

  • Copying content from allmusic

    2
    1 Votes
    2 Posts
    214 Views
    PeterJonesP

    @jacobacci said in Copying content from allmusic:

    I cannot post links yet. If you do a google search for ‘allmusic brahms symphony 1’ the correct page will be the first search result.

    I assume you mean https://www.allmusic.com/composition/symphony-no-1-in-c-minor-op-68-mc0002366601#partsMovements – it took me a bit to find that the text you were quoting was in a hidden section of the page.

    Then I would like to add sequential number, hyphens and spaces to the beginning of the lines:

    - 1. Un poco sostenuto - Allegro - 2. Andante sostenuto - 3. Un poco allegretto e grazioso - 4. Finale. Adagio - Più andante - Allegro non troppo, ma con brio

    Notepad++'s search/replace doesn’t have a counter. For something as short as the movements in a piece of music, you could just use a Column Mode selection and then Edit > Column Editor (Alt+C) to insert the numbering. (Column Mode selection could either be activated by clicking before the U of the first line and then Alt+Shift+Clicking before the F on the last line; or you could put the typing caret/cursor before the U, then Edit > Begin/End Select in Column Mode (Alt+Shift+B), then move caret/cursor before the F and use the same menu command or shortcut to end it. Actually, I’d probably suggest doing that Column Mode selection, type - . to get the punctuation inserted; then do another Column Mode selection between the space and the . and then use Column Editor to insert the numbers.

    Alternatively, use either the Columns++ or MultiReplace plugins, which have their own extended regex syntax which allows mathematical replacement

    The Columns++ Plugin-based idea is described in the Columns++ “REPLACE WITH A SIMPLE COUNTER” example – so you could use something like:
    FIND = ^
    REPLACE = - (?=match).
    in the Columns++ Search/Replace feature The MultiReplace plugin-based idea is to use the CNT special-variable described in the Variables Overview , so it would be something like
    FIND = ^
    REPLACE = set("- "..CNT..".")
    in the Columns++ Search/Replace feature

    (Note: I have neither plugin, so I haven’t tried those exact replacements, but it should be something similar to what I’ve shown. Since the owners of both those plugins are often here, they will probably chime in to correct me if I’ve mis-described their replacement syntax)

    Finally I would like to paste the work name to the beginning of each line

    Do another column selection before the - on the lines above, then when you paste in Symphony No. 1 in C minor, Op. 68 , it will put that same text before all the lines.

    Actually, this could be done at the same time as the column-mode - . above, so the simplified sequence would be

    Paste the list of movements Column Mode selection Paste the “work name” Type - . Second Column Mode Use Column Editor for numbering.

    Or, if you are using one of the two plugins

    Paste the list of movements Use plugin search/replace, where you paste the title when defining your REPLACE WITH string, use something like: Columns++ = PASTEDTITLE - (?=match). MultiReplace = set("PASTEDTITLE - "..CNT..".")

    Could this process be automated, so I can simply do two copy / pastes ?

    “simply” – maybe not by your definition of the word. But that’s about as simple as I could do it

  • Modify autocomplete options

    5
    1 Votes
    5 Posts
    352 Views
    Hiker GuyH

    @Mark-Olson
    Wasn’t aware of the plugin. Thanks for letting me know. Got it installed and configured now.

    Thanks!

  • Search and replace with increasing interger

    5
    1 Votes
    5 Posts
    275 Views
    PeterJonesP

    @Coises ,

    Fixed. In the future, you could just chat-message the FAQ author (in this case, me).

  • Creating two columns from two files via copy-paste?

    9
    0 Votes
    9 Posts
    2k Views
    Mark OlsonM

    @YutMarma
    I bet that syntax error comes from you using PythonScript 2, which very out-of-date version that’s still on the plugin list. I recommend upgrading to PythonScript 3, but in case you don’t have time for that, it’s pretty easy to make this script compatible with Python 2:

    ''' Uses PythonScript v3.0.16 or higher: https://github.com/bruderstein/PythonScript/releases First referenced in this Notepad++ community discussion: https://community.notepad-plus-plus.org/topic/25950/creating-two-columns-from-two-files-via-copy-paste == SUMMARY == This script can paste together any number of files line-by-line. == EXAMPLE == For example, if you have the following files: ---------------- ---------------- file A line 1 of file A line 2 of file A line 3 of file A ---------------- file B line 1 of file B line 2 of file B ---------------- file C line 1 of file C line 2 of file C line 3 of file C ---------------- ---------------- and you entered this into the first dialog: [ 3] file A [2 ] file B [1 ] file C and you clicked Yes for the second prompt and you entered FOOBAR into the third dialog and you clicked Yes for the fourth prompt you would get a new buffer opened with the following text: line 1 of file CFOOBARline 1 of file BFOOBARline 1 of file A line 2 of file CFOOBARline 2 of file BFOOBARline 2 of file A == NOTES == This script does basic data validation. Specifically, if the files you wanted to paste together have different numbers of lines, final file will have as many lines as the file with the fewest lines, assuming you click Yes on the dialog that notifies you of this. I intentionally did not provide an option for the final file to include lines from files that are longer than the shortest file, because the result could be confusing or ambiguous. ''' from Npp import editor, notepad import re def pl1of2al1of1(): all_filenames = [x[0] for x in notepad.getFiles()] if len(all_filenames) < 2: notepad.messageBox("only one file is open, so this script can't work") return # find the user's preferences print(all_filenames) selected_files = [] while True: txt = notepad.prompt(("Put a whole number in the box for each file you want to combine, or hit Cancel to exit.\r\n" "The numbers determine the order in which the lines of each file are pasted."), 'Select files to combine', '\r\n'.join('[ ] ' + fname for fname in all_filenames)) if txt is None: return selected_file_text = re.findall(r'^ *\[ *([+-]?\d+) *\] *(\S[^\r\n]*?) *\r?$', txt, re.MULTILINE) print(selected_file_text) if len(selected_file_text) < 2: notepad.messageBox('You must put whole numbers in the boxes for at least two files') continue selected_nums = set(int(x[0]) for x in selected_file_text) if len(selected_nums) < len(selected_file_text): notepad.messageBox('Each chosen file must have a distinct number') continue selected_files = [x[1].strip() for x in sorted(selected_file_text, key=lambda x: int(x[0]))] if not all(file in all_filenames for file in selected_files): notepad.messageBox('You accidentally changed the name of a file you selected. Make sure not to enter any text, other than putting numbers in the boxes.') continue if notepad.messageBox(('The n^th line of the combined file will have the n^th lines of each of the chosen files in the order shown:\r\n' + '\r\n'.join(selected_files) + '\r\n---------------\r\n' + 'Is that what you want?'), 'confirm files and order', MESSAGEBOXFLAGS.YESNO ) == MESSAGEBOXFLAGS.RESULTYES: break sep_str = notepad.prompt('Enter some buffer text to put between the n^th line of file N and the n^th line of file N+1', 'Enter buffer text', '') if sep_str is None: return # get the text lines_by_file = [] eol = '\r\n' previously_opened_file = notepad.getCurrentFilename() for file in selected_files: notepad.open(file) eol = ['\r\n', '\r', '\n'][editor.getEOLMode()] lines_by_file.append(editor.getText().splitlines()) notepad.open(previously_opened_file) # combine the text all_nlines = [len(x) for x in lines_by_file] min_nlines = min(all_nlines) if len(set(all_nlines)) != 1: if notepad.messageBox(('Not all files have the same number of lines.\r\n' + 'As a result, all lines past line {0} will be cut off.\r\n' + 'Yes: Trim off all the extra lines.\r\n' + 'No: Cancel the operation.').format(min_nlines + 1), 'Choose what to do with extra lines', MESSAGEBOXFLAGS.YESNO ) == MESSAGEBOXFLAGS.RESULTNO: return combined_text = eol.join( sep_str.join(lines[ii] for lines in lines_by_file) for ii in range(min_nlines) ) notepad.new() editor.setText(combined_text) if __name__ == '__main__': pl1of2al1of1()
  • Any way to display the color represented by its code (like #CC90A0)

    7
    0 Votes
    7 Posts
    380 Views
    Terry WysockiT

    @PeterJones Perfect! I didn’t initially see that the underlines were colored appropriately. This double-click gives me exactly what I wanted. Thanks!

  • npp v8.6 reverses the order of lines on column copy/paste

    21
    1 Votes
    21 Posts
    3k Views
    CoisesC

    @Theo-Pavloudis said in npp v8.6 reverses the order of lines on column copy/paste:

    @Alan-Kilborn @mkupper it’s still there in 8.6.8 either with Column Selection to Multi-Editing on or off.

    This was fixed in 8.6.9 (item 13 in the announcement).

  • String search functionality

    3
    0 Votes
    3 Posts
    218 Views
    D

    @PeterJones many thanks, this particular task involves 400,000 rows of data so the search results window is helpful to group the results, but is not used by the incremental search. My use of npp++ for this task is a bit off-piste as it more a database task, Excel would be my normal choice but it is slow when the range is this large.
    Will continue using the existing facilities.
    Thanks again
    Duncan

  • Auto/silent updating worked yesterday, but not today

    5
    0 Votes
    5 Posts
    591 Views
    T

    @PeterJones Thank you for clarifying the differences. I was not aware. In this case, I am just watching to logs. I solved the issue by going to View, Monitoring (tail-f).

  • Match consecutive lines that start with the same word

    5
    2 Votes
    5 Posts
    779 Views
    Ross BrownR

    @PeterJones Thanks Peter
    Noted and thanks for the helpful links.

  • 0 Votes
    5 Posts
    239 Views
    D

    @PeterJones
    Thanks for suggestion.
    However, I use an unusual windows version that only remain a ADMINISTRATOR account, many functions was striked out, like switching accounts.
    Thus, NP++ just can only run as a super administrator.
    My old Laptop just can’t carry newer windows’ softwares

  • Search&Replace certain string text, and replace/remove it

    4
    0 Votes
    4 Posts
    295 Views
    PeterJonesP

    @Joc-Bedenčič ,

    FIND WHAT = ABC.*DEFGH
    REPLACE WITH = ABCDEFGH
    SEARCH MODE = Regular Expression
    uncheck “dot matches newline”

    … and you really need to read and understand at least the Template for Search/Replace Questions from my list of useful references.

  • Notepad++ minimal (7.9.5 64bit) just can't remember plugins' settings

    4
    0 Votes
    4 Posts
    320 Views
    D

    @Mark-Olson I just create a dir called config under the plugins folder, and then it remembers the settings, thank you again

  • Importing a picture file in Notepad++

    2
    0 Votes
    2 Posts
    208 Views