Community
    • Login

    how to run a NPPExec script with autohotkey

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 4 Posters 531 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.
    • nadal zkzN
      nadal zkz
      last edited by

      Hello
      I know how to write an autohotkey script, but i dont know how to run a NPPExec script (which script is written in NPPExec plugin of Notepad++)
      by a command line (cmd) or by external script program like autohotkey
      if you know any of this, please tell me
      Thanks alot

      Terry RT PeterJonesP 2 Replies Last reply Reply Quote 0
      • Terry RT
        Terry R @nadal zkz
        last edited by

        @nadal-zkz

        I’ve been on this forum a number of years and hardly ever has a question related to AHK come up. You can search on this forum, so maybe do that but as I said there’s unlikely to be much to work with.

        However I do see a subforum for Notepad++ on the AutoHotkey forum here. You might have better luck there.

        Terry

        nadal zkzN 1 Reply Last reply Reply Quote 2
        • nadal zkzN
          nadal zkz @Terry R
          last edited by

          @Terry-R Thank you very much for the help.

          1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @nadal zkz
            last edited by

            @nadal-zkz ,

            I have no experience with AHK, though there have been some mentions in the forum.

            However, for many years, Notepad++ had no real way to pass a command-line argument to a plugin like NppExec, so there didn’t used to be a way to do it. However, starting in v8.4.2, Notepad++ added the -pluginMessage="text for plugin(s)" command line argument, which does allow passing a message so that plugins can see it. However, I don’t know if NppExec has ever been taught to look for such messages. I could imagine that it could be implemented something like: run Notepad++ with -pluginMessage="NppExec::npp_exec(Script Name)" – but the NppExec plugin would have to be built with a feature to read that NPPN_CMDLINEPLUGINMSG message, and I don’t know if @Vitalii-Dovgan has added that to NppExec or not. (The message will get sent to active plugins, even if Notepad++ was already running.)

            However, I don’t think that’s actually necessary. From the way I understood AHK, it sends keystrokes or menu commands to applications, so I would think, even without a change to NppExec, that it could launch Notepad++ (if it’s not already running), and then go to Plugins > NppExec > Execute NppExec Script and then type in the desired name of the script and tell it to run – because all of that can be done with keystrokes and/or menu-commands. And if you’ve used NppExec’s Advanced Options to put the scripts into the NppExec menu or Macros menu, then AHK could do it solely with driving the N++ menus, rather than also having to type in the name of the script into a dialog. I don’t know which solution is easier, but those are things you could explore.

            nadal zkzN 1 Reply Last reply Reply Quote 3
            • nadal zkzN
              nadal zkz @PeterJones
              last edited by

              @PeterJones thank you very much for the info
              i’m already using your method keystroke to do that , and it 's an easier method
              but i wondered if there is a more advance method instead of using keyboard shortcut
              to send the command directly, then we wont have to create shortcut in notepad++ each time we want to create a command
              i will try the plugin you said
              Thanks again.

              1 Reply Last reply Reply Quote 0
              • CoisesC
                Coises
                last edited by

                It looks like NppExec can process a message, NPEM_NPPEXEC, instructing it to run a script:

                https://github.com/d0vgan/nppexec/blob/66e6ad1a238588c92652a0d14230c2ed8cdb44a1/NppExec/src/PluginCommunication/NppExecPluginInterface.cpp#L168

                and as far as I can make out, that’s in a section of code that would be executed when you send NPPM_MSGTOPLUGIN to Notepad++ identifying the source module name as NppExec. I couldn’t find documentation on NPEM_NPPEXEC, though.

                I don’t use either NppExec or AutoHotKey; but my memory is that AutoHotKey can send a message to a window. If it can construct the necessary message — and if NppExec does what I think it must do when it receives such a message — then that should be a way to trigger an NppExec script directly from AutoHotKey.

                Beyond that, you’ll have to ask people more familiar with NppExec and AutoHotKey.

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