Macro editing and lock Find to a specific document



  • Two features which I would like to see in N++ which would save time for me:

    1. Feature to edit recorded and saved macros.
      So I create a long macro, but it has a typo. What option does N++ give me? Record a new macro…
      If I could simply just edit the macro, that would save a lot of my time. Why doesn’t N++ still have this feature?

    2. Give Find function a feature to lock to searching in 1 specific document.
      I have multiple documents open for editing as in Other View. I want to quickly search for something in main document: oops, forgot to highlight the tab of the document I wanted to search in: no results… ofc. Ugh, highlight the document, search again…
      It would be awesome if Find had a drop-down list of documents to lock onto. Or some better solution.



  • @Y3Kv-Bv

    Point 1: Although it is not to the level that I can tell you want, and apologies if you already know this, but you can edit existing macros via editing the shortcuts.xml file. What I usually do is get a basic version of my macro going by recording and saving it, then tweak it if needed later via the shortcuts.xml (manual) method. Sure, it takes a little bit of extra work to look up the command IDs if you are adding a new one; but even for that case it is pretty easy to make a second/throwaway macro for just that one command (or short series of commands), and by that method let Notepad++ figure out the command IDs that you can then cut and paste into the larger/keeper macro. Again, not an ideal situation, but you probably won’t see a real macro editor anytime soon, if at all (not that I follow what is currently being worked on…so I could be wrong). You are certainly free to make a feature request for this though; best done here: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/ (please check to see if this has already been requested, first).

    Point 2: This is best probably best implemented by fixing the problem within yourself that makes you initiate a search on the wrong document. :-D



  • @Scott-Sumner

    1. Not going to waste time on manual XML editing.
    2. It’s gets confusing when multiple documents are open in same instance, plus I want to save time by not having to highlight the desired tab every time, if I use Find only in 1 document.

    I checked the issues page: saving time is out of question: critical issues get fixed fast, small suggestions get implemented within 2 years, big features take several years if they aren’t forgotten first that is.

    Alright, free software is free, gotta settle with what you get for free labor.



  • A quick & dirty workaround for point 2 might be to set a hot key to launch Find in Files instead of normal Find, then put the required “locked” filename into Filters box and it’s folder into Folder box.
    Then each time you press the hotkey it will remember the last filter/folder… just enter your search term and click “Find All”. You will however have to click on the desired line in the “Find Results” window to switch to the “locked” file, but there after you can F3 or Ctrl-F as usual. (I actually use Find in Files as much as Find).

    An alternative for point 1. might be to write your more complex macros in LuaScript or Python Script (both available in Plugin manager).
    I don’t believe these have recording ability, but they do offer very powerful ways to automate almost anything in npp far above what you can do with the built in macros.
    There are other scripting plugins as well such as C# but I have not used these.

    Point 2 is actually an ideal example of something that could be implemented quickly in Python Script:
    One script to choose which file to “lock for finding” (or just type this in the Python console)…
    globals()[“mnFixedFindFilename”] = notepad.getCurrentFilename()

    and the main script (bound to a hotkey of your choice):
    notepad.activateFile(mnFixedFindFilename)
    notepad.runMenuCommand(“Search”, “Find…”)

    Trivial to modify above to hardcode the filename or even support multiple hotkeys pointing to different files!


Log in to reply