Run macro from Windows context menu
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?
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.
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… :)
:-) 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?
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!