4

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
  • 2
    I know you can have NP++ execute a NPPExec script/command at start up. For that you need to go to 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/…
    – Stat-R
    Apr 13, 2012 at 16:56
  • Stat-R's comment should be accepted as correct answer.
    – GriGrim
    Jan 18, 2017 at 9:12

2 Answers 2

2

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:

  1. Download AutoIt
  2. Write a script to send keystrokes through autoit file (SendToNppExec.au3).
  3. Write a NPPExec Script to run SendToNppExec.au3 using AutoIt3_x64 (or whatever windows version you are using).
  4. 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.

enter image description here

EDIT You can also convert the au3 script to exe and then call directly from NPPExec script without having to invoke AutoIt3 application.

0

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!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .