Is there a way to auto start a Notepad++ macro? I have a macro created but I want it to be run automatically when Notepad++ starts.
2 Answers
This may not be the perfect and efficient solution but if you need something complicated it can be of great help.
I can do that if I use any other script besides NPPExec. This can be done via Send
command in AutoIt. @Jerph has suggested AutoHotkey which can also be used.
So here are the steps:
- Download AutoIt
- Write a script to send keystrokes through autoit file (SendToNppExec.au3).
- Write a NPPExec Script to run SendToNppExec.au3 using AutoIt3_x64 (or whatever windows version you are using).
- Enable the script to be executed when NPP starts
Suppose the keyboard shortcut for your macro is Ctrl + F12. Then you can write an autoit script (SendToNppExec.au3) as follows:
Send ( "^{F12}" )
Then use NPPExec to execute the following command at start up: You may include the following in your NPPExec Script which you have to choose to start when Np++ starts.
"C:\...path to...\AutoIt3_x64.exe" "C:\...path to...\SendToNppExec.au3"
I guess you understand the following image to enable NPPExec script on start up.
EDIT You can also convert the au3 script to exe and then call directly from NPPExec script without having to invoke AutoIt3 application.
I don't have time to look into the exact commands you need, but I wanted to point you to AutoHotKey, which can create inputs when a program starts (and much, much more). I'm not an expert, but to give you a possible direction, I've writen an AHK script that clicks on a certain menu item as soon as a dialog window appears. Just have a look at the documentation for some commands you can use.
Hope that helps!
Plugins>NPPExec>Advanced Options>Execute this script when Notepad++ starts
...So all you need is call a macro from NPPExec and this is tricky I guess. See this sourceforge.net/projects/notepad-plus/forums/forum/331753/topic/…