• Find All Occurrences Macro

    4
    1 Votes
    4 Posts
    785 Views
    Michael VincentM

    @guy038 said in Find All Occurrences Macro:

    Why don’t you use your macro, via its shortcut ( search of TODO:|BUG:|FIX:|REFACTOR:|DONE:|INFO: ) to get one instance of the title, presently needed, and then, simply use the Ctrl + F3 or Ctrl + Shift + F3 shortcuts to move around to the next or previous similar title ?

    Thanks, and not to be rude, but that kind of defeats the purpose. Maybe I should have explained a little better. When I mean “Find all Occurrences” I want the search results window to pop up with all occurrences the same as when I:

    highlight a word press CTRL-F press “Find All in Current Document”

    By making this a macro, I can then add it to the context menu and then a right-click on any word will have a click away, “Find All Occurrences” which will open the clickable search results window.

    Hope that better explains, seems it may not be possible though. Shame the $(CURRENT_WORD) variable can be used in the shortcuts.xml file for the <UserDefinedCommands> commands section, but not the <macros> section.

    Cheers.,

  • Add number in each word by Notepad++

    23
    1 Votes
    23 Posts
    2k Views
    CohenmichaelC

    @Ekopalypse

    Thank you so much. The script works very well !
    Thanks again for your precious help :)

  • Change "@" to a number, 1,2,3,4,5...

    9
    0 Votes
    9 Posts
    519 Views
    PeterJonesP

    @Ekopalypse said in Change "@" to a number, 1,2,3,4,5...:

    don’t expect text

    I’d phrase that as “don’t expect words”; it still decodes to ASCII characters which have meaning in the order in which they are presented, which by most definitions is “text”.

  • Replace second occurrence of a tag in multiple files

    8
    0 Votes
    8 Posts
    976 Views
    Anonymous GuyA

    @PeterJones @dinkumoil @dinkumoil
    <big>Thank you!</big>
    I’ve tested all three methods you provided and all of them worked. I’ll surely save this offline and come back to it in the future and try to understand it even better. Thank you for taking the time and effort to reply in such detail to my topic, appreciate it a lot. Always amazed at how a few simple lines can make your life much easier, I’ve optimized my workflow in many ways using portable software, renamers and many other things and can edit solutions from others but sadly I’m not yet able to come up with solutions like yours from scratch. Now that I think about it maybe I can give something in return. Search for “everything” by voidtools on Google, in case you don’t know about it… it’s great for personal use or much more. It scans all your drives (or mapped network locations) relatively fast (minute or two for say single 1TB drive), creates database and than you are able to find files with search terms like part of name, or for example search “june .doc” and it will find salaryjune2019.doc from parts of file name. I use it at work to search files on over 70 TB of data. It’s free, hope you find it useful, thanks again for your help and have a great day!

  • How to replace content in many files with content from one..

    3
    0 Votes
    3 Posts
    270 Views
    EkopalypseE

    If I read correctly, what about using something like this?

  • vector <T> too long

    2
    0 Votes
    2 Posts
    261 Views
  • How to fix newline and quotation mark

    8
    1 Votes
    8 Posts
    2k Views
    Prahlad-Makwana4145P

    Hello, @Andy-Light

    Please follow below steps :

    Step 1:- Find (in regular expression mode) (.+)
    Step 2:- Replace with: "/1"
    Step 3:- This adds the quotes :

    "word1" "word2" "word3" "word4"

    Step 4:- Find (in extended mode): /r/n
    Step 5:- Replace with (with a space after the comma, not shown): ,
    Step 6:- This converts the lines into a comma-separated list:
    "word1", "word2", "word3", "word4"

    I hope above information will be useful for you.
    Thank you.

  • Remarks Bug?

    2
    0 Votes
    2 Posts
    244 Views
    PeterJonesP

    @Zaidy036,

    The batch-file lexer is part of the scintilla-component library, which is a separate project whose source code gets embedded
    in the projects that include that library. Per the Sctintilla source code included in Notepad++, LexBatch.cxx line 92,
    “// Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
    According to the wayback
    for that linked article,

    What’s a “fake label?” Commonly, it’s two (or more) colons at the start of a line. The first colon makes it a label, but DOS doesn’t know what to do with the second colon, so it simply abandons the line and moves on, at high speed.

    ? So, you can, if you wish, substitute “::” for REM in your batch files

    Thus, using :: as a pseudo-REM comment is making use of the fact that any invalid label-line is ignored and processed quickly

    The official GOTO docs are very specific:

    The label within the batch program must begin with a colon (:). If a line begins with a colon, it is treated as a label and any commands on that line are ignored.

    Note, both those docs specific “start of a line” or “line begins”. After some other command and the & command separator is not the beginning of a line.

    It’s not a comment (or event a “fake label”) after another command. Technically, it’s not even a comment at the beginning of a line. The fact that the lexer treats :: as a comment-start in any situation is just a concession to how abuses of a language can become considered “features” with enough people abusing it.

    Whether you think that it’s a bug, or whether you think the compromise that the Scintilla authors used is reasonable (my camp), or whether you think that the Scintilla authors should have never allowed for the abuse of the technical batch-file definition is, however, irrelevant. The Notepad++ project takes the source code for the Scintilla component wholesale from Scintilla. If you want a change in the built-in batch-file parser, you will have to check the Scintilla bug list and feature tracker; then, if you can convince the Scintilla team to incorporate your bug-fix or improvement, and an updated Scintilla version is released, you can then create a Notepad++ issue to request that Notepad++ update its Scintilla version. That process may take a while, especially if you have to try to convince the Scintilla side that your use of “fake label after ampersand is still a comment” should be implemented.

    In the mean time, since your batch files are obviously using that syntax successfully, regardless of the Sctinilla-team’s opinion, you can add extra highlighting to a builtin lexer (like the batch-file lexer) using regexes, via the script EnhanceAnyBuiltinLexer.py that @Ekopalypse shares in this linked post. That would allow you to define a regex like (?-s)\&\h*\K::.*$ that could be used to add highlighting for that circumstance (the regex might need to be tweaked to handle all your variations for ampersands and spacing; I haven’t tested it in the script; might need to check if the match-reset \K works in the python regex (I forget), or whether you’ll have to use some other lookbehind mechanism for that).

  • Run As Administrator.

    4
    0 Votes
    4 Posts
    566 Views
    EkopalypseE

    You would, for example, use runas.

    In run menu, you would call cmd /k runas /user:YOUR_NAME@YOUR_HOST PROGRAM_TO_EXECUTE

    Once everything works as expected, you can substitute /k with /c and
    the cmd shell gets closed automatically.

  • UDL: A folding problem.

    12
    1 Votes
    12 Posts
    1k Views
    UltiMaxKomU

    @Alan-Kilborn I’m sorry to inform you, but your new dick-evaluation (For the LOL) result came in just an hour ago, and it’s was marked as “Not dick-enough”. Along with that, the carcinogenic tube test of yours proved to be even more downgraded from the tier of “Lethal”, to just “Toxic”. You might want to improve them by trying the upgraded insult technique that you can learn from your skill tree.
    ⠀⠀⠀So try it, use the [Super Insult] move, and overcharge it beyond the eleven. The Dickindex says that it’s very effective against the type of new membermon like the one you’re facing right now.
    ⠀⠀⠀I really recommend you to increase your stats by leveling up through the dickin’ route. Many speedrunners used this specific strat.

    ⠀⠀⠀By the way, you haven’t responded to my apology. I would really like to be forgiven for all my sins that I’ve done to you. I hope you would accept it. Anywise, thank you in advance.



    Best regards,
    Professor Fool.

  • Disconnect on save with latest NppFTP

    2
    0 Votes
    2 Posts
    626 Views
    CrêpoC

    I’ve solved my own problem. It looks like a weird bug. I had the hostname set to username@hostname, so somehow I was connected to username@username@hostname which apparently works fine but something goes wrong when you save.

    Please don’t ask how I managed this.

  • Mark line in all files

    4
    0 Votes
    4 Posts
    1k Views
    Gary SmithG

    @Alan-Kilborn

    Tanks Alan, that was a great suggestion.

    With each line being a hyperlink it got a bit messy in the end but managed to comment out each line so it no longer appeared :)

    Thanks again

  • "no to all" for dialog box that opens dozens of times

    2
    2 Votes
    2 Posts
    342 Views
    Alan KilbornA

    @meiskam

    There has been a recent effort to add No to All to certain sections of the UI (N++ 7.8 and above I believe).
    Perhaps this is one area where it hasn’t been applied.
    In this case you can probably result to the trick of holding down the n key to close all the popups.
    If you hold down too long (likely) and get a bunch of nnnnnnn in your document that gets focus when all the non-existent files have gone away, a simple Undo (ctrl+z) should clean those n up.

  • Number line style

    5
    1 Votes
    5 Posts
    345 Views
    montserrat civitM

    @Ekopalypse
    oh, yes!
    I’ve just removed it! Now it’s ok
    Thank you

  • Very difficult find and replace in glossary

    7
    0 Votes
    7 Posts
    480 Views
    guy038G

    Hello, @scott-smith-0, @peterjones and All,

    Just a clarification about greedy and lazy quantifiers :

    Imagine the following regex, using the free-spacing mode for a better readability :

    (?x) \w+? ABC test ABC

    You may think that we must use the lazy quantifier +?, in order to get the first occurrence of the string ABC. But, it’s a common mistake of reasoning !

    Indeed, in fact, the regex are looking for the shortest range of word characters, followed with the string ABCtestABC

    Easy to prove :

    Against the text XYZ 12345ABCtestABCdefghiABCtestABCjklmn the regex \w+?ABCtestABC does match the string 12345ABCtestABC, whereas the regex \w+ABCtestABC matches the string 12345ABCtestABCdefghiABCtestABC. Given this subject text, the difference between the two kinds of quantifiers is obvious !

    Now, against the shorter text XYZ 12345ABCtestABCdefghi, as there is only 1 occurrence of the string ABCtestABC, you don’t have to bother about lazy vs greedy quantifiers ! Both, the regexes \w+?ABCtestABC and \w+ABCtestABC will match the same string 12345ABCtestABC

    Of course, had we used the simple regexes \w+?ABC and \w+?ABC, the matched strings would have been quite distinct !

    Now, let’s imagine :

    The subject text XYZ 12345" display="defghi, where I replaced the two strings ABC with a double-quote " and the word test with <sp>display=

    The regex \w+?" display="

    In this specific case, there an additional reason why the lazy quantifier is useless ;-))

    Indeed, if you think, wrongly, at first sight, that this quantifier is needed in order to get the first " symbol, it could not match a further bunch of chars as, both, the double-quote and the following space character are not word characters, anyway !

    Just try the two regexes \w+?" display=" and \w+" display=", against the following text :

    XYZ 12345" display=“defghi” display="jklmn

    In both cases, the matched string is just 12345" display="

    Best Regards,

    guy038

    Reminder : for correct tests, replace any and quoting characters with a classic double-quote char " ( \x{0022} )

  • Search result export

    3
    0 Votes
    3 Posts
    2k Views
    Alan KilbornA

    It isn’t directly possible.

    You might be best off using the marking feature of Notepad++ (Search > Mark…) and then supplementing that with a Pythonscript to copy that text to the clipboard; see here. But that only handles a single file at a time; some people want that extended to multiple files, see here.

    In theory you could do some of the things discussed here…or rather, currently just hinted at…because some of those ideas are currently evolving. ;-)

    Sadly, no solution for you, just pointers to possible workarounds. :-(

  • Function list

    1
    1 Votes
    1 Posts
    199 Views
    No one has replied
  • Save found files?

    26
    0 Votes
    26 Posts
    4k Views
    EkopalypseE

    @Alan-Kilborn

    Not a big burden, only the “print” line for that…

    and the encode is not needed as py2 returns bytes
    as well as the b before the “%p”.

    But…What’s your magic behind f_editor?

    Nothing, this is just my object which represents the editor in the find in files window.
    As you said, what you would have expected must be done on your side.

  • Prefix folding keywords

    2
    0 Votes
    2 Posts
    238 Views
    EkopalypseE

    @Hein-Mulder

    if you use it in folding in code 2 style (separators needed) then it shouldn’t happen.

  • Viewing Find/Search results...

    9
    0 Votes
    9 Posts
    5k Views
    PeterJonesP

    @Vasile-Caraus,

    See my PS in your thread about your issue.