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.
    • Alan KilbornA
      Alan Kilborn @Dario de Judicibus 0
      last edited by

      @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)
      Dario de Judicibus 0D 1 Reply Last reply Reply Quote 2
      • ArkadiuszMichalskiA
        ArkadiuszMichalski
        last edited by

        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.

        Alan KilbornA 1 Reply Last reply Reply Quote 1
        • Alan KilbornA
          Alan Kilborn @ArkadiuszMichalski
          last edited by

          @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
          • EkopalypseE
            Ekopalypse @Dario de Judicibus 0
            last edited by

            @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.

            Dario de Judicibus 0D 2 Replies Last reply Reply Quote 5
            • Dario de Judicibus 0D
              Dario de Judicibus 0 @Alan Kilborn
              last edited by

              @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
              • Dario de Judicibus 0D
                Dario de Judicibus 0 @Ekopalypse
                last edited by

                @Ekopalypse Great! Thank you.

                1 Reply Last reply Reply Quote 0
                • Dario de Judicibus 0D
                  Dario de Judicibus 0 @Ekopalypse
                  last edited by

                  @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
                  • ArkadiuszMichalskiA
                    ArkadiuszMichalski
                    last edited by

                    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
                    • Dario de Judicibus 0D
                      Dario de Judicibus 0
                      last edited by

                      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
                      • EkopalypseE
                        Ekopalypse
                        last edited by

                        @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
                        • ArkadiuszMichalskiA
                          ArkadiuszMichalski
                          last edited by

                          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++.

                          Dario de Judicibus 0D 1 Reply Last reply Reply Quote 2
                          • Dario de Judicibus 0D
                            Dario de Judicibus 0 @ArkadiuszMichalski
                            last edited by

                            @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.

                            Alan KilbornA TroshinDVT 2 Replies Last reply Reply Quote 0
                            • Alan KilbornA
                              Alan Kilborn @Dario de Judicibus 0
                              last edited by

                              @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
                              • TroshinDVT
                                TroshinDV @Dario de Judicibus 0
                                last edited by TroshinDV

                                @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
                                • First post
                                  Last post
                                The Community of users of the Notepad++ text editor.
                                Powered by NodeBB | Contributors