• XML Split

    11
    0 Votes
    11 Posts
    7k Views
    Craig McFarlaneC

    @guy038 said in XML Split:

    gawk -F\x22 “/game name/ { n= $2 } ; { print > n”.xml" }"

    Mate. Just wanted to say. Top man. Thank you so much for A) taking the time to reply with a constructive and very helpful reply. and B) you learn something new every day and C) what you suggested worked like a dream. Had one issue as one of the name had a / in it. No dram worked around it.

    Thank you so much

  • Add line of text to beginning of multiple files

    24
    0 Votes
    24 Posts
    28k Views
    Alan KilbornA

    @PeterJones said in Add line of text to beginning of multiple files:

    inserting 6 lines at the beginning of 300 files has started down the slippery slope out of the realm of pure text-editor

    Agreed. Maybe that’s why I said it’s an “OK” task for Notepad++ and not “a great” task. :-)

    why create an object with the init, rather than just have a T11987() function instead?

    It’s just my new framework for scripts (I copy from some boilerplate when I make a new script). Obviously in this case it is fairly trivial, but in scripts that use callbacks a object-based approach has bigger benefits. I picked up on this by observing how @Ekopalypse does some of the more complicated scripts he’s presented. BTW, I picked up on using the topic/posting id in the name of a script/function/class from YOU. :-)

  • How can I get around NppExec's limitations?

    7
    0 Votes
    7 Posts
    514 Views
    dinkumoilD

    @Michael-Vincent

    Thank you for chiming in and providing a more detailed guidance for using my script!

    @Lowell-Justice

    As an addition to what @Michael-Vincent already said: To compile and execute C code you need a C compiler, of course. For simple and quick C test programs I use the Tiny C Compiler (TCC). Its homepage provides a link to the available downloads.

    For C++ you could use for example MinGW, the GCC port for Windows, you can download it from here. To get the latest version take the files mingw-w32-bin-i686-YYYYMMDD.7z for compiling 32 bit programs and mingw-w64-bin-x86_64-YYYYMMDD.7z for compiling 64 bit programs where YYYYMMDD is a placeholder for the release date of the version.

    To get documentation for GCC visit this site. There you will also find a link to the documentation of the GCC v9.3 command line options.

  • nppexec - sleep command causes printf output to cease

    4
    1 Votes
    4 Posts
    635 Views
    Lowell JusticeL

    @dinkumoil how could I make a script like this for c++?

  • working use-case for SCI_REPLACETARGETRE

    19
    1 Votes
    19 Posts
    4k Views
    dailD

    Disclaimer: I did not fully read every single line of this thread…but hopefully I can contribute a bit of helpful info.

    Accessing Scintilla on a background thread can be very problematic. There are Scintilla calls that have temporal coupling and since you cannot guarantee any two calls made from PythonScript (or outside of Notepad++) are executed without being interrupted by another thread, then weird things can happen. Even doing something simple like:

    editor.setTargetRange(0, 100) x = editor.getTargetText()

    could potentially give unexpected results. Notepad++ does its own work (search/replace, function list, auto completion, smart highlighting, URL highlighting, etc) which changes the target quite frequently.

  • 0 Votes
    5 Posts
    817 Views
    Alan KilbornA

    @sgtsixpack said in Select/mark all lines which contain a certain pattern and add the line above:

    I don’t know about “craft an expression”
    I also have no clue about your last reply.

    Sorry, I should have been more explicit.
    My comments were in regard to “Regular Expression” Search mode, which is typically what one is inferring when they ask “how can I manipulate data that is relative to some other data”.

    As you’ve probably discovered, you can, in Normal Search mode, bookmark the “line above” by making a selection that covers both lines, perhaps partially, and then pressing ctrl+f go get your text in the Find what box. You can then switch the Find window to the Mark tab and proceed with bookmarking.

    But if you do it that way, you aren’t truly doing “line above”, you’re doing “line of” and “line below”. :-)

  • Disable Undocumented Keyboard Shortcut

    3
    0 Votes
    3 Posts
    289 Views
    Alan KilbornA

    @Retro-80s-Guy

    I have looked under keyboard shortcuts and this combination ( F11 + Backspace ) isn’t listed.

    That’s because it isn’t possible to press these keys together. One will always happen before the other. It is really amazing that such a circumstance would close Notepad++ bypassing any save prompts.

  • How do I make a seconds to YY:DD:HH:MM:SS converter in Notepad++?

    2
    0 Votes
    2 Posts
    260 Views
    Alan KilbornA

    @Oscar-Söderström-TE3A

    I think you’ll want to CLICK HERE.

  • 0 Votes
    2 Posts
    297 Views
    herb munsonH

    @herb-munson it’s highlighting the content of a <script>tag in the html file. Seems to have something to do with ‘themes’. Now I’d like to know how to kill it.

  • Automatic file extension

    8
    0 Votes
    8 Posts
    512 Views
    Götz M. RitterG

    Thanks to all, you’re so kind!

  • 0 Votes
    10 Posts
    434 Views
    Götz M. RitterG

    @Ekopalypse Thank you so much! Stay healthy, :-).

  • 0 Votes
    5 Posts
    351 Views
    John SleeJ

    @guy038 Thank you so much, Guy. In order to achieve what I want, I adjusted the search regex slightly, so that the whole block, the label line (^@X[/d]+@ F./R) and date are all captured:

    (?-s)((^@X.+\R)(?:(?s:[^@]*?)(\d\d\x20\w\w\w\x20\d\d\d\d)\.(?s:.*?)|(?s:.*?)))(?=^@X|^==|\Z)

    Best Regards. Stay safe!
    John

  • FIND IN FILES, THEN REPLACE: need confirm before replacing checkbox

    3
    0 Votes
    3 Posts
    853 Views
    PeterJonesP

    Addendum:

    That said, the actual content of your post is obviously a feature request. As explained in this FAQ, you need to submit feature requests in the issues section of the official github repository.

    Requests made only in this forum (where you posted) will not be tracked, and have a virtually 0% chance of being implemented; requests made in the official issues section will be tracked, and at least make the developers aware of your requests (though it does not guarantee implementation).

    If you do make an official feature request as a result of this topic, please paste a link to that request as a reply here, so that future readers can find it. Thank you.

  • Searching for, marking and replace in one Line

    7
    0 Votes
    7 Posts
    367 Views
    Alan KilbornA

    @Ekopalypse said in Searching for, marking and replace in one Line:

    \Q…\E is much easier

    and it is even easier if the regex string is intended to be all literal after a certain point. Just use \Q at that point an no “closing” \E is needed!

    Example, find a minimal run of any characters followed by 3 literal *:

    .*?\Q***

  • Bookmarks must be manually removed

    2
    0 Votes
    2 Posts
    166 Views
    EkopalypseE

    @Alan-Kilborn

    I agree with you but it looks like this was done on purpose.

    When a line is deleted, its markers are combined, by an OR operation, with the markers of the next line

  • Solving the problem of: “Save as Administrator”

    2
    0 Votes
    2 Posts
    362 Views
    EkopalypseE

    @Olu-Abimbola said in Solving the problem of: “Save as Administrator”:

    How do I stop this request from interrupting my work?

    Depends, either make sure you have proper access to the files beforehand or run npp in admin mode. I would go for the first choice.

  • unable to open notepad++ after latest update

    1
    0 Votes
    1 Posts
    157 Views
    No one has replied
  • Building Notepad++ with Visual Studio 2015/2017

    21
    0 Votes
    21 Posts
    19k Views
    Alan KilbornA

    @Ekopalypse

    Ah, never knew that. Presume one could also use 19.10.25017.0 in this case.

  • Find a URL that is unique

    7
    0 Votes
    7 Posts
    1k Views
    Adam YikA

    @Alan-Kilborn
    It worked! Thanks! Also, in case if anyone reading this don’t know what this means:
    “make sure the last line of your file has a line-ending at its end”,
    that means you make a line break after the last character so that the last line is blank:
    345c7c0c-017d-4b46-b6f8-b7f4314dea3c-image.png

    I’ve also find that twitter also redirects to this:
    [https://twitter.com/i/js_inst?c_name=ui_metrics]

  • Conditional replacing

    3
    0 Votes
    3 Posts
    485 Views
    astrosofistaA

    Hi @William-Baldwin, @PeterJones

    This regex could do the job, but lacking of actual data, as @PeterJones noted, may make it fail. Take it as a proof of concept:

    1234567 bla bla bla bla bla PRM 1234567 bla bla bla bla bla SEL

    Search: (?-s)^(\d{7})(?s).*?(?:(PRM)|(SEL))
    Replace: (?2${1}89)(?3${1}00)

    Output:

    123456789 123456700

    Hope this helps.