3.6. Execute NppExec Script...

The "Execute NppExec Script..." dialog can be shown using its hotkey (F6 by default) or the menu item "Execute NppExec Script..." in NppExec's submenu (Plugins -> NppExec -> Execute NppExec Script...).

The "Execute NppExec Script..." dialog allows to specify several NppExec's commands (one command per one line) which will be executed one after another. Such set of commands forms so-called NppExec's script. The script can be saved using the "Save..." button of the "Execute NppExec Script..." dialog. For example, you can create NppExec's script which makes a reserve copy of current file:

1) open the "Execute NppExec Script..." dialog and type the following

// save current file
NPP_SAVE
// copy current file to C:\Backup
cmd /c copy "$(FULL_CURRENT_PATH)" "C:\Backup\$(FILE_NAME)" /Y

2) press the "Save..." button, type "Reserve Copy" and press the "Save" button.

This example allows you to create and save NppExec's script named "Reserve Copy". You can call this script later from the "Execute NppExec Script..." dialog. Also you can create a menu item for this script using NppExec's Advanced Options (Plugins -> NppExec -> Advanced Options...).

It is not necessary to save a new script each time you want to execute several commands. You can use the "<temporary script>" for commands you don't need to save. The temporary script is saved automatically when you close Notepad++. Also, if you modify commands of some saved script (e.g. if you modify the "Reserve Copy" script), it will be saved automatically when you close Notepad++. Or you can press the "Save" button to save it immediately.

You can delete previously saved scripts using the "Execute NppExec Script..." dialog. Press the "Save..." button (yes, the irony :)), select a script name and press the "Delete" button.

See also: NppExec's script [3.7].