• Login
Community
  • Login

Macro Language

Scheduled Pinned Locked Moved General Discussion
5 Posts 5 Posters 4.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D
    Dario de Judicibus
    last edited by Sep 11, 2019, 1:23 PM

    It looks like NPP is missing a very important feature for a code editor, that is, a macro language. I found no way to create a macro by coding, and the macros created by recording are pretty cryptic, and in any case it is not possible to edit them directly but it is necessary to modify an .xlm file. Is there a plugin that allows me to extend NPP by macros that can be edited. For example, I want to create a macro that insert a special Unicode character called “Long S” ( ſ ) in the text. I cannot use a recorded macro because even if I place in clipboard that character and use ctrl-V to insert it, the corresponding recorded macro will not insert THAT character but anything is in clipboard in that moment. Any hints? Thank you in advance.

    1 Reply Last reply Reply Quote 0
    • M
      Michael Vincent
      last edited by Michael Vincent Sep 11, 2019, 1:36 PM Sep 11, 2019, 1:34 PM

      NppExec
      LuaScript
      PythonScript

      Someone is even working on a Perl Scripting solution (YAY!)

      I’ll let the various experts of each provide more color detail as to “how-to” or maybe you can pick it up yourself if you’re familiar with one of those languages.

      I prefer NppExec myself and use it to extend functionality like an IDE-lite (compile, run, debug for various language types based on extension) but it’s limited compared to the other two - I’m just not that familiar with Lua or Python.

      Cheers.

      1 Reply Last reply Reply Quote 4
      • P
        PeterJones
        last edited by PeterJones Sep 12, 2019, 2:34 AM Sep 12, 2019, 2:33 AM

        @Dario-de-Judicibus said:

        Any hints

        in addition to the scripting language plugins @Michael-Vincent mentioned, there’s also the builtin macros functionality. Unfortunately, the macros doc hasn’t been updated to include all the old macro-config-file details, which would help you understand the format of the file, to be able to craft your own.

        Fortunately, there’s a workaround: record a macro of you typing a letter (say, A), and save the macro under a given name. Restart notepad++ (might be necessary to save the macro into the file), then open %appdata%\notepad++\shortcuts.xml. In the macros section, you’ll find the macro name. Then you’ll notice in one of the macro parameters there’s a "A". Paste your fancy character over that A. Save the file. Exit/reload Notepad++ again. Now your macro should insert the fancy character, rather than A.

        Good luck.

        1 Reply Last reply Reply Quote 2
        • A
          Alan Kilborn
          last edited by Sep 12, 2019, 11:01 AM

          The downside of a fully functional macro language is likely that it would be very specific to Notepad++, and then people would argue that it is cryptic and hard to learn. It is better to put one’s efforts into learning Python or Lua for this purpose, then, not only can you use that skill for Notepad++ usages, but also for other tasks.

          1 Reply Last reply Reply Quote 5
          • J
            Jack Mallord 0
            last edited by Jun 27, 2021, 6:51 PM

            the action type in the recorded message seems to be either 0 or 1, then the message ids follow:
            2170 putchar
            2180 delchar
            2300 down
            2306 getchar
            2326 backspace
            2451 end
            2452 shift-end
            2453 home
            I found that i could combine 2170 type messages with string values, shortening the macro somewhat, making it more readable; it seemed that i could also replace 10 delchars (2180) with " " but that was not consistent.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors