 ****************************************************************************
 * NppExec plugin ver. 0.2 RC3.2 for Notepad++ 4.3 (and above)
 * by DV, December 2006 - July 2007
 * by DV & Nicolas Babled & Geert Vancompernolle, July 2007 - February 2008
 ****************************************************************************
 *
 * Possibilities:
 *   1) Run multiple commands from the "Execute..." dialog
 *   2) Run stand-alone command from the Console Dlg
 *   3) Separate console for each NppExec.dll (e.g. NppExec1.dll, NppExec2.dll)
 *   4) Additional commands:
 *        cls - clear Console screen
 *        cd - shows current path
 *        cd <path> - changes current directory (absolute or relative)
 *        cd <drive:\path> - changes current drive and directory
 *        dir - lists subdirs and files
 *        dir <mask> - lists subdirs and files matched the mask
 *        dir <path\mask> - lists subdirs and files matched the mask
 *        echo <text> - prints a text in the Console 
 *        set - shows all user's variables
 *        set <var> - shows the value of user's variable <var>
 *        set <var> = <value> - sets the value of user's variable <var>
 *        unset <var> - removes user's variable <var>
 *        con_loadfrom <file> - loads a file's content to the Console
 *        con_load <file> - see "con_loadfrom"
 *        con_saveto <file> - saves the Console's content to a file
 *        con_save - see "con_saveto"
 *        npp_exec <script> - execute commands from specified script
 *        npp_exec <file> - execute commands from specified file         (*)
 *        npp_open <file> - open a file in Notepad++
 *        npp_open <mask> - open files matched the mask
 *        npp_open <path\mask> - open files matched the mask
 *        npp_run <command> - run external process/command
 *        npp_save - save current file in Notepad++
 *        npp_save <file> - save a file in Notepad++ (if it's opened)    (*)
 *        npp_saveall - save all modified files
 *        npp_switch <file> - switch to specified opened file            (*)
 *        (*) these commands work with a partial file path/name also
 *            i.e.  npp_save c:\dir\f.txt  is the same as  npp_save f.txt
 *   5) Additional console commands (Console Dlg only):
 *        help       - show available commands
 *        ver        - show plugin's version
 *        CTRL+C     - terminate current child process
 *        CTRL+BREAK - terminate current child process
 *   6) All Notepad++ environment variables are supported:
 *        $(FULL_CURRENT_PATH) : E:\my Web\main\welcome.html 
 *        $(CURRENT_DIRECTORY) : E:\my Web\main
 *        $(FILE_NAME)         : welcome.html 
 *        $(NAME_PART)         : welcome 
 *        $(EXT_PART)          : html
 *        $(NPP_DIRECTORY)     : the full path of notepad++'s directory
 *        $(CURRENT_WORD)      : word(s) you selected in Notepad++
 *   7) Additional environment variables:
 *        $(#0)                : C:\Program Files\Notepad++\notepad++.exe
 *        $(#N), N=1,2,3...    : full path of the Nth opened document
 *        $(LEFT_VIEW_FILE)    : current file path-name in primary (left) view
 *        $(RIGHT_VIEW_FILE)   : current file path-name in second (right) view
 *        $(ARGC)              : number of arguments passed to the NPP_EXEC command
 *        $(ARGV)              : all arguments passed to the NPP_EXEC command after the script name
 *        $(ARGV[0])           : script name - first parameter of the NPP_EXEC command
 *        $(ARGV[N])           : Nth argument (N=1,2,3...)
 *        $(RARGV)             : all arguments in reverse order (except the script name)
 *        $(RARGV[N])          : Nth argument in reverse order (N=1,2,3...)
 *        $(SYS.<var>)         : system's environment variable, e.g. $(SYS.PATH)
 *
 ****************************************************************************


 *************
 *  HISTORY  *
 *************


 v0.2 RC3.2 - February 2008
 --------------------------
 - fixed: NPP_RUN (ShellExecute) did not work with several arguments
 
 
 v0.2 RC3.1 - February 2008
 --------------------------
 - fixed: buffer overflow in the Warning Analyzer
 * changed: now NPP_RUN calls ShellExecute() instead of WinExec()
 
 
 v0.2 RC3 - January 2008
 -----------------------
 + search in the Console
 + history in the Console Filters dialog
 + several issues fixed
 + several cosmetic improvements

 
 v0.2 RC2 - December 2007
 ------------------------
 + speeding up the console output
 + watching for changes in "npes_saved.txt"
 + TAB-key in the console auto-completes current command
 + several cosmetic improvements
 
 
 v0.2 RC1 - December 2007
 ------------------------
 1. A lot of internal changes/improvements.
 In particular, now all plugin's options are stored, read and written by the
 Options Manager component.
 The Warning Analyzer component, developed by Nicolas Babled, allows to filter
 and recognize different compiler/interpretter error and warning messages - and
 extract useful information from these messages (such as file name and line 
 number).
 The Simple Logger component stores detailed information about last executed
 command (can be usefull for "debugging").
 * The console redirecting engine has been improved.
 * Now the plugin identifies itself by its dll-file name. Each copy of the 
 plugin (each dll-file) stores its options in corresponding ini-file.
 * Now plugin's environment variables (e.g. "$(FILE_NAME)") are available for
 child console process. For example, start "cmd.exe" and type "echo $(#1)".
 * Now system's environment variables are available in a form of "$(SYS.<var>)"
 e.g. "$(SYS.WINDIR)", "$(SYS.TEMP)" etc.
 * Now the NPP_EXEC command can pass arguments to the script. These arguments 
 can be accessed in the script through the following macro-variables:
 $(ARGC), $(ARGV), $(ARGV[n]).
 Example:  npp_exec "script name" param_1 "param 2".
 This example sets the following values for the script:
 $(ARGC) = 3;  $(ARGV) = param_1 "param 2";  $(ARGV[0]) = script name;
 $(ARGV[1]) = param_1;  $(ARGV[2]) = param 2.
 * Each command now have detailed help information. Type "help" or "help help" 
 in the NppExec's Console.
 * Now the console commands history is restored when you restart Notepad++.

 2. New menu items:
 Direct Execute Previous - directly executes previous script.
 No internal messages - do not show such messages as "Process started >>>", etc.
 Save all files on execute - saves all files before executing a script.
 Also NppExec's toolbar icon has been added.

 3. New dialog:  Console Output Filter -> Highlight.
 This dialog allows you to specify a string mask for compiler/interpretter error 
 and warning messages with such keywords as %FILE%, %ABSFILE% and %LINE%.
 These messages can be highlighted with different colours and allow you to go
 to certain line in certain file when double-clicked in the Console window.

 4. New messages:
 NPP_SAVEALL - saves all modified files.
 CON_LOADFROM - loads a file's content to the Console.
 CON_SAVETO - saves the Console's content to a file.
 ECHO - prints a text in the Console (supports internal env. variables)
 SET - sets the value of user's variable
 UNSET - removes user's variable
 
 
 v0.2 beta4 - July 2007
 ----------------------
 - fixed: buffer size was not checked before calling OemToChar() 
 - fixed/added: '\b' and '\r' handling
 + a lot of changes in plugin's internals (basic cpp-classes and NppExecEngine)
 + new command: cd, cd <path>, cd <drive:\path>
 + new command: dir, dir <mask>, dir <path\mask>
 + new feature: npp_open <mask>, npp_open <path\mask>
 + new environment variables: $(LEFT_VIEW_FILE) and $(RIGHT_VIEW_FILE)
 * thanks to all who wait for this version
 

 v0.2 beta3 - April 2007
 -----------------------
 - fixed: Delete button (Script name dialog) was not enabled sometimes
 + Menu: Show Console Dialog
 + Console Output Filter: Exclude all empty lines
 + Comment delimiter can be user-defined, // in :// is no more comment
 
 
 v0.2 beta2 - March 2007
 -----------------------
 + Menu: Console Commands History.
     When enabled, previous commands can be scrolled by pressing 
     arrow keys Up and Down.
 + Menu: Console Output Filter.
     When enabled, output messages from running console process
     can be filtered (i.e. particular lines can be excluded)
 - ConsoleDlg: Ctrl+A is unlocked
 - ConsoleDlg: Quotes "" are no more added automatically for paths
     with spaces (because of a bug with executables w/o extension
     such as "cmd /c calc.exe")
 - Several internal fixes
 - Several additional internal fixes :-)
 * Thanks to Jim Granville for his suggestions
      
 
 v0.1 - March 2007
 -----------------
 * initial version
 
 