rlively
2011-11-10
Can I have either a macro or a run command that will launch an external exe with parameters including $(FULL_CURRENT_PATH) and then after it executes run a macro? I would want the macro to create a new NPP document and then paste into that blank document. After the external command is executed, the windows clipboard will contain text that I want in the new document.
I can't find any mention of whether this is possible or not in the forums or in the npp-community site.
Anonymous
2011-11-11
Check out nppexec :-
SET OUTFILE = C:\temp\dig.txt
NPE_CONSOLE v+
NPP_CONSOLE 0
cmd /c "C:\Windows\System32\dns\bin\dig" $(CURRENT_WORD) @208.67.222.222 >>$(OUTFILE)
NPP_OPEN $(OUTFILE)
NPE_CONSOLE v-
Something I did to do dns lookup of the selected test in one notepad++ tab and create a new tab with the output.
cchris
2011-11-11
There are several ways.
1/ Use an external macro manager, like AutoHotKey or similar, to send the various commands (N++: create new document ; launch external program ; N++: paste in current document.
2/ Minimise N++ in systray, run program and then use right click menu to create new file from clipboard
3/ Use the RunMe plugin to apply external program to (a copy of) your current document.
4/ I'd suspect Python Script can do something about it, but I hardly know Python.
I haven't used the Pork2Sausage plugin much, it might help too.
CChris
rlively
2011-11-12
Thanks - the NPP_EXEC plugin will do what I want - instead of creating a document with the output I just wanted the output to go directly to a new NPP document, so this example works:
http://sourceforge.net/projects/npp-plugins/forums/forum/672146/topic/3738779
// enable the $(OUTPUT) variable NPE_CONSOLE v+ // your command here... for example, let it be "cmd /?" cmd /? // open new tab NPP_SENDMSG WM_COMMAND IDM_FILE_NEW // set the text in the new tab SEL_SETTEXT $(OUTPUT) // finally, disable $(OUTPUT) variable NPE_CONSOLE v-
This actually lets me skip a step - I was calling a batch file that piped std out to the Cygwin utility putclip.exe in order to get the output into the clipboard for pasting, but using this method with NPP_EXEC the output goes directly into a new document without having to use the putclip utility.
I was looking for a way for a builtin NPP macro to call a run command or for the run command to call a macro but NPP_EXEC will let me combine it all into one. The only problem is the difficulty of finding documentation on all the available commands.