• Login
Community
  • Login

Run macro from Windows context menu

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 2 Posters 1.9k 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.
  • Y
    Yomgui33
    last edited by May 5, 2018, 7:15 AM

    Sorry if the question have already been posted (I made a few searches but I might not have stuck the proper formulation).

    I’d like to add to Windows’ context menu the option to run a specific macro on a file that I right-click on (preferably files of a given extension only).

    Is it possible or do I have to go the open file/run macro route each time?

    Thanks!

    C 1 Reply Last reply May 5, 2018, 9:32 AM Reply Quote 1
    • C
      Claudia Frank @Yomgui33
      last edited by May 5, 2018, 9:32 AM

      @Yomgui33

      may I ask you to clarify what you mean by Windows context menu?
      The explorer context menu? Npp context menu? Desktop context menu? …

      As more info you provide the easier for us to see if there is a way to solve it.

      Cheers
      Claudia

      1 Reply Last reply Reply Quote 1
      • Y
        Yomgui33
        last edited by Yomgui33 May 5, 2018, 9:41 AM May 5, 2018, 9:41 AM

        Ah, sorry, yes I meant Windows’ explorer context menu. The one you get when you right-click on a file.

        The idea would be to right-click on a file and run a simple search/replace macro from there.

        I’m currently learning python and I’ll try to create my own script as soon as I get the hang of reading/writing files. But in the meantime, if there’s an easy way to do the same with Npp… :)

        C 1 Reply Last reply May 5, 2018, 10:01 AM Reply Quote 1
        • C
          Claudia Frank @Yomgui33
          last edited by May 5, 2018, 10:01 AM

          @Yomgui33

          :-) simple is relative in this case as there are
          different steps involved to get this working

          a) to run the macro npp needs to be started as well
          b) once npp started it needs to be informed that the macro should be called
          c) after calling the macro npp should, probably, be closed again

          Yes, can be done but not with native npp functionality and it is tricky
          about identifying when npp should just start and when it should run a macro
          after start as npp does not provide a macro command line argument as of version 7.5.6

          There is software like autoit which allows handling gui applications automatically,
          you could install scripting languages plugins like python script, lua script to do this
          or using NppExec and its run on startup feature.

          In the first post you said that you might want to do the search/replace preferable
          on file extension only.

          Are you aware of the find in files function of npp? You could specify a filter that
          search/replace would affect those files only or is this already some kind of logic decision
          like if you click on let’s say txt files I do want to execute search/replace automatically and if I click
          on bat files I want it to start npp but not to run any macro?

          Cheers
          Claudia

          1 Reply Last reply Reply Quote 2
          • Y
            Yomgui33
            last edited by May 5, 2018, 10:30 AM

            Ah, yes, forgot all about the Search/Replace on whole folders. I might be able to automate things a bit more through autohotkey.

            Thanks for the suggestions! I’ll fiddle with that until I can get where I want with Python (and come back if I manage something elegant enough to be shared).

            Have a nice week-end!

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