3.9. Command-line arguments: pluginMessage

1. Notepad++'s pluginMessage

NppExec supports Notepad++'s -pluginMessage command-line arguments in the form of:

notepad++.exe -pluginMessage="NppExecScript=ScriptName"

and

notepad++.exe -pluginMessage="NppExecScript=ScriptName;NppExecArg1=Arg1;NppExecArg2=Arg2;...;NppExecArg9=Arg9"

where

To pass a semicolon character as an argument's value, just specify the first semicolon character as the value and then the second semicolon character as the separator. For example:

notepad++.exe -pluginMessage="NppExecScript=ScriptName;NppExecArg1=;;NppExecArg2=Arg2"

While this works with a single semicolon ';' as the value, as well as with consequent semicolons ";;;" as the value, you can't pass a semicolon in the middle of a value, such as "a;b". The last case is not supported currently.

 

2. Example

Let's assume we have the following NppExec's script named "test":

// test
echo $(argv[1])
echo $(argv[2])

And we specify the following command-line arguments to run Notepad++:

notepad++.exe -pluginMessage="NppExecScript=test;NppExecArg1=;;NppExecArg2=a b c"

As the result, Notepad++ starts with the following lines shown in NppExec's Console:

;
a b c

Note:
In case a start-up script is specified in NppExec's Advanced Options, NppExec will first run the start-up script and then run the script specified as the NppExecScript value.