• Notepad settings are reset after an abnormal shutdown.

    3
    0 Votes
    3 Posts
    206 Views
    wonkawillyW

    I have similar problems sometimes, even if I use Npp portable versions. Probably some file that Npp is writing to the disk gets corrupted cause of the abnormal shutdown.
    Nevertheless I frequently do a complete backup to a compressed archive of the folder with plugins and my customization and so on. So, just in case, I can delete the corrupted folder and decompress the whole Npp folder having back al my main customization ready to restart working in seconds.

    It is also possible even to implement a little script to make the Npp folder backup automatically.

  • Double entry in pop-up. How to remove?

    3
    0 Votes
    3 Posts
    417 Views
    wonkawillyW

    @Mugsys-RapSheet said in Double entry in pop-up. How to remove?:

    . Is there a simple fix?

    You could edit the right click menu on your OS with the tools embed into your OS it self: there are different methods to do it and some of them are dependent on the OS version your computer has. For example you could modify the OS Register with regedit, but you really need to know how to, so you first need to get used to it and read some tutorials online to work with this solution.
    Online there are also some applications (even free) that you can use to make a bit easier modifing the contextual right click menu for the targeted file type. For example Nirsoft ShellMenuView or ShellExView Shell Extensions Manager are small utilities that display the list of static menu items that appeared in the context menu when you right-click a file/folder on Windows Explorer, and allows you to easily enable or disable unwanted menu items. Of course there are also others.

  • Map language to extension

    9
    0 Votes
    9 Posts
    514 Views
    Alan KilbornA

    @Mark-Olson said in Map language to extension:

    print(f’{ext_lang_dict = }‘)
    print(f’{lang_ext_dict = }')

    As long as PythonScript 2.x is what is installed via Plugins Admin, we probably shouldn’t publish PS3-only scripts.

    Suggest changing these two lines to:

    print('ext_lang_dict:', ext_lang_dict) print('lang_ext_dict:', lang_ext_dict)

    and, of course, adding this line at the very top of the script file:

    from __future__ import print_function
  • Homemade UDL location

    3
    0 Votes
    3 Posts
    855 Views
    Sayanel01S

    @PeterJones Clear and perfect explanation, thank you!

  • How to save 1000+ fills at once?

    8
    0 Votes
    8 Posts
    787 Views
    Alan KilbornA

    @Junuk-Seo said in How to save 1000+ fills at once?:

    I am getting the error “‘Please check whether this file is opened in another program’”.

    This doesn’t make sense as the assumption was that the files are all new 1, new 2, etc files (as otherwise all you need to do is a Save All), and thus these “files” could not be open in another program. Perhaps that was a bad assumption.

  • Notepad++ file format looks different when opened in Windows Notepad

    3
    0 Votes
    3 Posts
    1k Views
    miltonM

    @PeterJones

    Yes, you are correct.
    Thank you so much for the clarification and instruction.

    The issue is solved. Thank you

  • can i recover text from notepad?

    15
    0 Votes
    15 Posts
    3k Views
    PeterJonesP

    @fomoiks ,

    Either you are mistaken, or something else weird went wrong. Either way, I cannot tell you why or how it happened.

    In 99.9999% of the cases, if you hit save, Notepad++ saves the file in the current path, or it will tell you something went wrong.

    At this point, the “why” is irrelevant. The only way in which continued delving into what exactly happened on your end would be helpful is if you had a way that could 100% reliably reproduce the problem of “I hit SAVE. File did not save.” – if you had “Steps to Reproduce”, then you could create an official bug report in the Notepad++ Issues tracker on github.

    Good luck.

  • Using Replace function in PShell to modify Workspace file

    6
    0 Votes
    6 Posts
    244 Views
    mkupperM

    @Cariboudjan said in Using Replace function in PShell to modify Workspace file:

    Alright. Changing the encoding to UTF8 fixed the issue.

    I am glad it seems to be working for you now.

    A couple of points:

    The encoding shown on Notepad++'s status line is an estimate based on inspecting the file. The inspection process is not perfect and so I would not load a file into Notepad++ and 100% rely on what it says the encoding of that file seems to be. I have had Notepad++ say “ANSI” for example even when the file has 3 or 4 byte long UTF-8 encoded sequences near the beginning. Figuring out the encoding of a file can be a long topic in itself. In your code I’m bothered by your use of -NoNewline -Encoding OEM. It just seems weird and is the sort of thing that will lead to unexpected results down the road. However, this forum is about Notepad++ and so I’ll leave it at that rather than topic-drifting into encoding and PowerShell.
  • 0 Votes
    6 Posts
    302 Views
    Alan KilbornA

    @Justin-Zant said in Saving a file saves the first new file instead of the unsaved file in the active window:

    I guess I have to get used to that shortcut.

    Or change it.

  • multiple lines in one line

    11
    0 Votes
    11 Posts
    7k Views
    PeterJonesP

    @Michael ,

    I will briefly explain my regex: but really, you should look at the documentation I linked you to.

    FULL: (?s)^(\d+\.\d+.*?$).*(<status>.*?</status>).*?</x-cisco-remotecc-request>

    (?s) = turns on “. matches newline” ^ = starts the match at the beginning of a line (\d+\.\d+.*?$) = looks for one or more digit, then a decimal point, then one or more digit, followed by everything to the end of the line, and because of the parentheses, puts it all into group #1 (referenced later as $1) .* = matches 0 or more characters, including the newline – hence, this allows it to match multiple lines at once (<status>.*?</status>) matches <status> and </status> surrounding text, and puts that unit into group #2 (referenced later as $2) .*?</x-cisco-remotecc-request> = finds all the characters up to and including the next </x-cisco-remotecc-request> closing tag

    Replacement: $1 $2 = replace everything matched above (from the beginning of the first line in the match all the way to </x-cisco-remotecc-request>) with just the contents of group 1, followed by a space, followed by contents of group 2.

    i do not understand how you go down all rows, till you find the value mentioned by <status>. what is the key operator for this?

    The .* when . matches newline or (?s) is enabled will match 0 or more characters including newlines, hence it can capture multiple lines between

    Status could be even on

    My regular expression handled that, because it accepted anything between the <status> and </status>, and put that into a group; Guy’s regex ignored your actual status portion, and just always replaced it with <status>off</status> (because your example only showed one value, and he assumed that you always wanted to convert the status to off because of the way you phrased things)

  • "Other View" not honoring Global Style Preferences

    3
    0 Votes
    3 Posts
    178 Views
    Vince HaganV

    @Alan-Kilborn That was it! I thought I had defaulted all of that, but I guess didn’t. Thanks!

  • Character count display as you type

    9
    0 Votes
    9 Posts
    2k Views
    PeterJonesP

    @Shahar-F-un-monitored-mail said in Character count display as you type:

    welcome to send the file with exact instructions for w10 (which btw was previously upgraded from w7 which may be the reason

    The instructions are identical for w7, w8, w8.1, w10, and w11.

    why the startup.py doesn’t seem to appear, at least in the standard folders for the alignment saving)

    You need the PythonScript plugin. And you need to create your “startup.py (user)”. The instructions for installing the plugin, and for getting the user startup file if you don’t already have one, are found in our FAQ on PythonScript

    Btw do I have to first upgrade the current version from 2022 64b

    Probably not (though if you want to, that’s fine, too). Any recent version of Notepad++ should be able to handle this – I’d probably recommend v8 or newer, but other than that, it should all be compatible. And PythonScript v2.0.0 will work.

  • Find/copy specific line in all opened files

    4
    0 Votes
    4 Posts
    2k Views
    Selva TNS

    @guy038 Thank you

  • How to save file with new Encoding ??

    2
    0 Votes
    2 Posts
    9k Views
    PeterJonesP

    @Kamil-Dvoracek ,

    You probably have Settings > Preferences > New Document > Encoding > [UTF-8] Apply to opened ANSI files checkmarked.

    6fce41b1-08fb-4b59-a055-78e71ac9a739-image.png

    This says “if I open a file that appears to be an ANSI-encoding file, instead open it as UTF-8”. If that’s not what you want, then uncheck that option.

    Also, Settings > Preferences > MISC > Autodetect character encoding is not always right, so be warned that even when you do have a file in ANSI, it might guess the wrong ANSI encoding, because no heuristic is perfect. (Unfortunately, in the early days of DOS, they didn’t think that storing encoding information as metadata in the FAT would be worthwhile, though it would have saved decades of problems; and the FAT32 and NTFS never rectified that; so all that modern text editors have to go on is imperfect heuristics, rather than having metadata that saves the actual encoding with the rest of the file name and size and date information. We might even be able to throw the blame all the way back to CP/M rather than DOS; I don’t know how far back that particular backward-compatibility goes. That’s why some file types, like XML/HTML, allow embedding the encoding inside the file; and why some editors will honor the modeline commands inside your source files; using the EditorConfig plugin, Notepad++ honors some, but doesn’t yet honor the encoding from a modeline)

  • Update lost configuration, can't find a "fix" that sticks

    9
    0 Votes
    9 Posts
    1k Views
    Lycan ThropeL

    @K-M-Richards ,
    Glad that worked for you, I thought it might. Feel free to use the version that works for you, as I’m glad old versions are available to be downloaded, as not all software developers keep their old programs to be used after they’ve moved on to a newer version.

  • Another help: conditional replace.

    7
    0 Votes
    7 Posts
    296 Views
    João BorlothJ

    Thanks for all.

  • How to change default Powershell language so "$" is Green

    3
    0 Votes
    3 Posts
    232 Views
    guy038G

    Hello, @cooly0, @mark-olson and All,

    @mark-olson, from your picture, the first $ sign, in the part between quotes :

    del "$($vsTemplatepath)\nppplugin*.zip"

    Is not colored in green. This is quite normal as your regex is \$(?=\w). I suppose that the correct regex should be, in this case, \$(?=[\w(])

    So, it’s not a limitation of the @Ekopalypse’s plugin !!

    Best Regards,

    guy038

  • Conditional Replace Char

    3
    0 Votes
    3 Posts
    228 Views
    João BorlothJ

    @Coises , thanks.
    Worked perfectly.
    I did a test, using a letter and not the hyphen.
    In this case, it was exactly the opposite, replacing the isolated letter, not the letter in the middle of the word. So here we have a new trick: finding loose letters in the text.

  • running bat files

    5
    0 Votes
    5 Posts
    300 Views
    Alan KilbornA

    @zeta-orionis

    Example with spaces:

    e76fd26d-a003-4fa9-abe4-c5c32d85d815-image.png

  • 0 Votes
    4 Posts
    984 Views
    Mark OlsonM

    @Vasile-Caraus said in Regex: Delete all html tags inside 2 other tags, except <a href=.*?"> and </a>:

    And how did you convert the text ?

    I just used the find/replace form, with regular expressions on.

    thanks a lot. But how did you manage to find this solution?

    Since you’ve taken an interest, I’ll give a pretty detailed explanation of my regex.

    By the way, I have a slight update that should work just as well, but is simpler:
    Replace (?s-i)(?:<p[^>]*>|(?!\A)\G)(?:(?!</p>).)*?\K<(?!(?:/[ap]>|a\x20))[^>]*> with nothing.

    It’s modeled off of guy038’s now-famous replacing in a specific region of text regex. I won’t explain all the parts of this regex that are indebted to that; you can just read his excellent explanation in the linked post. Specifically, the BSR is <p[^>]*>, which is an opening p tag, and the ESR is </p>, the closing p tag. So far this accounts for the first part of the regex, (?s-i)(?:<p[^>]*>|(?!\A)\G)(?:(?!</p>).)*?\K. But the tricky part is matching only tags other than <a> and the closing </p> tag. We know that any tag we want to remove contains <[^>]*>, that is, an opening <, some stuff, and a closing >. To distinguish the tags we want to remove, we’ll do a negative lookahead right after the opening <, so we get <(?!{%distinguishing text%})[^>]*>. Let’s start by observing that the tag cannot be a closing a or p tag. This is the /[ap]> branch of the negative lookahead, where [ap] simply means “a or p”. Next we need to rule out opening a tags. This is the a\x20 branch of the negative lookahead. By the way, \x20 is just another way to say space, as in the space you make with your space bar. Regex aficionados like to use \x20, because it can’t be mistaken for any other character. So we arrive at the final regex, (?s-i)(?:<p[^>]*>|(?!\A)\G)(?:(?!</p>).)*?\K<(?!(?:/[ap]>|a\x20))[^>]*>