• Login
Community
  • Login

Macro language

Scheduled Pinned Locked Moved General Discussion
15 Posts 5 Posters 1.4k 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 0
    last edited by Oct 3, 2020, 11:53 AM

    Notepad++ is great but I really miss a macro language. I understand it would be a major change but it would have several advantages:

    1. the possibility for everybody to develop rich scripts with conditional logic and prompts
    2. a potentially higher backward compatibility with respect plugins
    3. the need not to depend on plugins for simple logic, that is, to reserve plugins for complicated stuff

    A lot of editors have script languages. A JavaScript-like language would be great (ECMAscript standard). To make simple to create an API to Notepad++ commands, we could define a single API function to access them, for example NotepadCommand(), whose parameters would be based on a set of constants as follows:

    NotepadCommand(cmd, parm1, …, parmN);

    For example:

    NotepadCommand(“Npp_InsertText”, “Npp_CursorPosition”, “Text to be inserted” );

    to insert a text at cursor position. Any comment?

    A E 2 Replies Last reply Oct 3, 2020, 11:59 AM Reply Quote 1
    • A
      Alan Kilborn @Dario de Judicibus 0
      last edited by Oct 3, 2020, 11:59 AM

      @Dario-de-Judicibus-0 said in Macro language:

      A lot of editors have script languages

      And so does Notepad++.
      The one I am most familiar with is Pythonscript (it’s a plugin), but there are others.

      we could define a single API function to access them
      NotepadCommand(“Npp_InsertText”, “Npp_CursorPosition”, “Text to be inserted” );

      So Pythonscript uses some objects to define an API, examples:

      • notepad.save(filename)
      • editor.insertText(position, text_to_insert)
      D 1 Reply Last reply Oct 7, 2020, 8:13 AM Reply Quote 2
      • A
        ArkadiuszMichalski
        last edited by Oct 3, 2020, 3:45 PM

        https://github.com/notepad-plus-plus/notepad-plus-plus/issues/4028 << built-in would be perfect, but … right now you have to deal with plugins.

        A 1 Reply Last reply Oct 3, 2020, 6:06 PM Reply Quote 1
        • A
          Alan Kilborn @ArkadiuszMichalski
          last edited by Oct 3, 2020, 6:06 PM

          @ArkadiuszMichalski said in Macro language:

          built-in would be perfect, but … right now you have to deal with plugins

          Notepad++ developers aren’t going to spend their time making something inside Notepad++ that is supported (and very well supported) outside (plugin).

          1 Reply Last reply Reply Quote 0
          • E
            Ekopalypse @Dario de Judicibus 0
            last edited by Oct 3, 2020, 7:53 PM

            @Dario-de-Judicibus-0 said in Macro language:

            A JavaScript-like language would be great (E

            Checkout jN Notepad++ plugin. Can be installed from plugin admin.

            D 2 Replies Last reply Oct 7, 2020, 8:15 AM Reply Quote 5
            • D
              Dario de Judicibus 0 @Alan Kilborn
              last edited by Oct 7, 2020, 8:13 AM

              @Alan-Kilborn I did not know of Phytonscript. It is not part of the basic package, isn’t it? Any other script language can be used with Notepad++? Where can I fond docs?

              1 Reply Last reply Reply Quote 0
              • D
                Dario de Judicibus 0 @Ekopalypse
                last edited by Oct 7, 2020, 8:15 AM

                @Ekopalypse Great! Thank you.

                1 Reply Last reply Reply Quote 0
                • D
                  Dario de Judicibus 0 @Ekopalypse
                  last edited by Oct 7, 2020, 8:34 AM

                  @Ekopalypse I installed JN and I got a lot of new menu which looks like quite cryptic. I cannot find a clear documentation of available API or a User Manual. Can you give me a link to any document could help me to develop JS for Notepad++? Of course, I already know JS but I need a reference of NPP API’s. Thank you in adavnce.

                  1 Reply Last reply Reply Quote 0
                  • A
                    ArkadiuszMichalski
                    last edited by Oct 7, 2020, 9:13 AM

                    https://github.com/sieukrem/jn-npp-plugin/wiki << just press (Pages 10) button in right site. And for API you see description:

                    API documentation you find in plugins/jn/API/api.xml

                    But I’m not sure if this api.xml still exist in actual JN version. I have old copy but can’t upload here.

                    jN is “specific” because add entries in Menu bar (not in Plugin menu), they cannot be accessed from other plugins, etc. By default, it adds a lot of scripts, if you do not need them, create another folder in the NPP\plugins\jN\jN\includes directory (e.g. _off) and put unnecessary scripts in it (or remove them).

                    1 Reply Last reply Reply Quote 2
                    • D
                      Dario de Judicibus 0
                      last edited by Oct 7, 2020, 9:24 AM

                      I got api.xml but I found really few info, just related to menus. What I am looking for are NPP API’s. For example, I want to duplicate current file, so I want to know which are the methods equivalent to

                      Ctrl-A
                      Ctrl-C
                      Get current name to define a new one -> newName = myOwnFuncToGenerate(currName)
                      Get current folder in case “follow current document” is NOT set --> currFolder
                      Get current language to use the same ->currLang
                      Ctrl-N
                      Ctrl-V
                      Set language to currLang
                      Save as newName in currFolder

                      What I cannot find is a REFERENCE to Editor methods and similar.

                      1 Reply Last reply Reply Quote 0
                      • E
                        Ekopalypse
                        last edited by Oct 10, 2020, 10:55 AM

                        @Dario-de-Judicibus-0

                        I have no experience with this plugin, I only mentioned it because you were looking for a js alternative.
                        A quick search at github revelead this and the documentation about these functions can be found here .

                        1 Reply Last reply Reply Quote 1
                        • A
                          ArkadiuszMichalski
                          last edited by Oct 10, 2020, 11:03 AM

                          In api.xml you have some commands for IEditor, you can also check existing scripts have they use this obj.
                          runMenuCmd(cmd) - runs a specified build-in menu command of Notepad++.

                          D 1 Reply Last reply Oct 15, 2020, 11:56 AM Reply Quote 2
                          • D
                            Dario de Judicibus 0 @ArkadiuszMichalski
                            last edited by Oct 15, 2020, 11:56 AM

                            @ArkadiuszMichalski It looks like there is no way to get current file language and set new file to same langua. So gain, what is really missing in Notepad++ is a specific macro language. This plugin is quite cumbersome to use and badly documented.

                            A T 2 Replies Last reply Oct 15, 2020, 12:01 PM Reply Quote 0
                            • A
                              Alan Kilborn @Dario de Judicibus 0
                              last edited by Oct 15, 2020, 12:01 PM

                              @Dario-de-Judicibus-0 said in Macro language:

                              This plugin is quite cumbersome to use and badly documented.

                              Not all plugins are created equal.
                              You do know that plugins are not created/maintained by the same team that does Notepad++, right?

                              So (a)gain, what is really missing in Notepad++ is a specific macro language.

                              I think if you try a scripting plugin that is well-done (Pythonscript, LuaScript), you’ll find that your “again” statement is “not strong”.

                              1 Reply Last reply Reply Quote 2
                              • T
                                TroshinDV @Dario de Judicibus 0
                                last edited by TroshinDV Oct 15, 2020, 12:59 PM Oct 15, 2020, 12:56 PM

                                @Dario-de-Judicibus-0 said in Macro language:

                                It looks like there is no way to get current file language and set new file to same langua.

                                Editor.currentView.lang;
                                Screenshot_242.png

                                see, …\Notepad++\plugins\jN\jN\Doc\API\api.xml
                                Screenshot_243.png

                                • есть множество примеров использования плагина и вики на гитхабе.
                                1 Reply Last reply Reply Quote 1
                                6 out of 15
                                • First post
                                  6/15
                                  Last post
                                The Community of users of the Notepad++ text editor.
                                Powered by NodeBB | Contributors