• Pasting copied text in a search window in a macro

    9
    0 Votes
    9 Posts
    3k Views
    PeterJonesP
    @Raúl-ALR , The instructions for installing and running this script are in the FAQ: How to install and run a script in PythonScript The script-specific instructions are found in the script’s code itself. # encoding=utf-8 """in response to https://community.notepad-plus-plus.org/topic/23339/pasting-copied-text-in-a-search-window-in-a-macro This searches in the "objects" file for every line: <ObjectRef ref="..."/> It grabs the ref ID, and searches for that ID in the "hosts" file <Host id="id4843X9273" name="object_name" comment="" ro="False"> It grabs the name field from the matching line in the "hosts" file It then replaces the whole <ObjectRef.../> with that name field In the lines below, change the paths to the two files: - The first path is the "objects" file, - The second is the "hosts" file. - Both must be opened in Notepad++, but it doesn't matter which view they are in. - Full paths are required. It makes it a single undo action, so if you don't like the results, you can just hit UNDO """ from Npp import editor,notepad,console class Class23339(object): def go(self, object_fname, host_fname): self.object_fname = object_fname self.host_fname = host_fname notepad.activateFile(object_fname) editor.rereplace(r'<ObjectRef ref="([^"]*)"/>', lambda m: self.repl_in_objects(m)) def repl_in_objects(self, m): notepad.activateFile(self.host_fname) editor.research(r'<Host id="{}" name="(.*?)"'.format(m.group(1)), lambda ms: self.find_in_hosts(ms)) notepad.activateFile(self.object_fname) return self.found_in_hosts def find_in_hosts(self, m): self.found_in_hosts = m.group(1) editor.beginUndoAction() Class23339().go( r"c:\users\peter.jones\downloads\tempdata\nppCommunity\objects.xml", r"c:\users\peter.jones\downloads\tempdata\nppCommunity\hosts.xml" ) editor.endUndoAction() If you want to ever customize these, the editor.rereplace(...) line starts with the regex that will match lines in the “objects” file and put the ref-ID value in group(1); the editor.research(...) line starts with the regex that will find the specific ref-ID in the “hosts” file, and grab the value of the host name out of there.
  • UDL - parser for journal file "' 0:<" delimeters

    4
    0 Votes
    4 Posts
    806 Views
    naumanmyN
    Hi Ron Were you able to fix the issues and use the UDL? Can you please share the current copy of the Journal file highlighting? Thanks
  • How do I recongnize slightly different coding characters?

    8
    0 Votes
    8 Posts
    3k Views
    M
    @guy038 it looks good, however I don’t have an ANSI file so I can’t practice it
  • To add the button "Save as..." in the toolbar

    3
    0 Votes
    3 Posts
    3k Views
    Jacques PrestreauJ
    @PeterJones Hello Peter, Thanks a lot for your help. Great ! Your procedure works ! I had troubles to reproduce it. I didn’t understand why it didn’t work the first times until I thought “Gosh ! The semicolons at the beginning of the lines are probably there to transform these lines to comments !” Then I removed the semicolon which was the first character on the newly created line, and… Ha ha ! Won ! The button appeared ! And with its tooltip. And it works. :) Now it will be a piece of cake to modify the icon and put a small bitmap in its place using the last step of your explanation. Thanks a lot again, Peter ! Cheers ! Jacques (from France)
  • 0 Votes
    13 Posts
    3k Views
    Alan KilbornA
    @guy038 said in what are list Regex available "named capture group" for find and replace in current version: Refer to this link for further explanations : https://www.boost.org/doc/libs/1_78_0/libs/regex/doc/html/boost_regex/syntax/perl_syntax.html#boost_regex.syntax.perl_syntax.branch_reset Why not this LINK as well?:
  • How to enable syntax error

    3
    0 Votes
    3 Posts
    4k Views
    Metro CityM
    @Ekopalypse Great ^^
  • Ctrl+down to jump to the beginning of the next paragraph

    3
    0 Votes
    3 Posts
    974 Views
    Alan KilbornA
    This can be seen/changed in the “Shortcut Mapper”, the area of the Notepad++ software that allows customization of keycombos. Invoke it: [image: 1659364847417-e70ecd40-0823-4b2c-9f47-9813225047dd-image.png] And change to the “Scintilla commands” tab and do some downscrolling: [image: 1659364891513-6c679e17-4457-4a11-b6f7-28b8480625b7-image.png] So, as a user you probably don’t care about “Scintilla” or even know what it is – it is an editing component that Notepad++ embeds to get its real work (editing text!) accomplished. Thus, you’d have to have some intuition about what “SCI_PARADOWN” means, but for the most part this isn’t too difficult. BTW, you could remap this command to Ctrl+down if you wanted, but that keycombo is tied by default to a different command, so you’d have to remap the other command as well so as to not have a conflict.
  • Export Hex view in Txt format

    3
    0 Votes
    3 Posts
    5k Views
    Cyril Di ValentinC
    Tanks a lot for your answer. I will try to use xxd as you mentonned. I can also use hexedit but the size of the file (dump file .bin) is too big for hexedit so that i don"t have the whole file… Therefore if you already used a similar application, I would be very interested in that. Thanks and have a good week. Cyril
  • Changing the default save as type to all types (*.*)

    4
    0 Votes
    4 Posts
    720 Views
    MaximillianMM
    @Alan-Kilborn Thanks so much! Cheers
  • Clear read only flag

    2
    1 Votes
    2 Posts
    377 Views
    Alan KilbornA
    @Arnab-Mitra See HERE.
  • Add a character to the beginning of each bookmarked line

    2
    1
    0 Votes
    2 Posts
    792 Views
    guy038G
    Hello, @zean-yauh and All, Do you mean something like that ? SEARCH (?-s)\R(?!.+:) REPLACE \x20 Tick the Wrap around option Select the Regular expression search mode Click on the Replace All button Best Regards, guy038
  • the np++ is displaying gibberish, not words

    3
    2
    0 Votes
    3 Posts
    3k Views
    Alan KilbornA
    @Christopher-Johns-0 The two bytes that start the file on line 1, PK are a dead giveaway that this is a zipped archive file, as Peter indicated. Long ago, zip files were created with a program called pkzip.exe and their contents extracted with a program called pkunzip.exe. I think P was for the name of someone named “Phil”. I’ll really press my memory and say the K was for “Katz”. (I could cheat and google it, but it is often more fun to just try to pull stuff from memory – googling it is left as an exercise for interested readers)
  • Theme settings for better dark mode

    7
    1
    0 Votes
    7 Posts
    9k Views
    deleeleeD
    @PeterJones I have found an issue logged with the Snippets project on GitHUb where other users are having the same problem so hopefully it will be resolved soon. https://github.com/ffes/nppsnippets/issues/45
  • A few questions about integration with Windows.

    8
    2
    0 Votes
    8 Posts
    1k Views
    omegaglmO
    @PeterJones Alright, thank you for all your help. Have a great day!
  • Search for a string which ends with a Right parenthesis

    2
    0 Votes
    2 Posts
    322 Views
    EkopalypseE
    @Özgür-Ulusoy Using a regular expression search like this ^Installing.+\)$ should do the job. If you want to understand what this means, please read here.
  • rename not working

    4
    0 Votes
    4 Posts
    565 Views
    Evan Mark yang hebat dari 2020 MinecraftE
    @PeterJones i will try, thank you
  • Python Script help, stop execution

    3
    0 Votes
    3 Posts
    880 Views
    skimmer333S
    Thanks heaps. Makes sense to me now.
  • How do I enable up and down search?

    2
    0 Votes
    2 Posts
    1k Views
    PeterJonesP
    @Gary-Winey Do you mean [image: 1659033638868-761fc813-0d67-4690-9387-5d5e53141309-image.png] vs [image: 1659033648226-c69dcc71-32c7-4399-8041-cbbd69a7c1b8-image.png] If so, then the checkbox on the right controls that. It tells you this when you hover over that box: [image: 1659033683506-c4c1b4bf-9ec7-4476-ac7f-67c761911e0e-image.png] It’s also documented in the usermanual (I showed a screenshot on the Find tab of the dialog, but it’s the same on the Find and Replace tab as well)
  • Find in all open documents that match a given filename pattern?

    2
    0 Votes
    2 Posts
    742 Views
    PeterJonesP
    @Meatball-Football , If you want to filter which files are searched, the expectation was to use Find in Files rather than the Find feature’s Find in All Opened Documents command – and that Find in Files does have a filter syntax described in the hover text and in more detail at npp-user-manual.org in the section “Find in Files”
  • TOS/EULA and VDI?

    3
    0 Votes
    3 Posts
    831 Views
    Mo_Mon_Mo_ProbsM
    @PeterJones Thanks for taking the time to reply. I have the same understanding as you but still have to make the effort. Fortunately, I only have to log the attempt then push the matter further up the team ladder.