 
 ****************************************************************************
 * NppExec plugin ver. 0.3 RC1 for Notepad++ 5.1 (and above)
 * by DV, December 2006 - January 2009
 * Co-developers: Nicolas Babled & Geert Vancompernolle (since July 2007)
 ****************************************************************************
 *
 * 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>
 *        env_set <var> - shows the value of environment variable <var>
 *        env_set <var> = <value> - sets the value of environment variable <var>
 *        env_unset <var> - removes/restores the environment variable <var>
 *        inputbox "message" - shows InputBox, sets $(INPUT)
 *        inputbox "message" : initial_value - InputBox, sets $(INPUT)
 *        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"
 *        sel_saveto <file> - save the selected text to a file
 *        sel_saveto <file> : <encoding> - save the selected text to a file
 *        sel_save <file> : <encoding> - see "sel_saveto"
 *        npp_exec <script> - execute commands from specified script
 *        npp_exec <file> - execute commands from specified file         (*)
 *        npp_close - close current file in Notepad++
 *        npp_close <file> - close specified file opened in Notepad++    (*)
 *        npp_console <on/off/keep> - show/hide the Console window
 *        npp_console <1/0/?> - show/hide the Console window
 *        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++
 *        $(CURRENT_LINE)       : current line number
 *        $(CURRENT_COLUMN)     : current column number
 *   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
 *        $(PLUGINS_CONFIG_DIR) : full path of the plugins configuration directory
 *        $(CWD)                : current working directory of NppExec (use "cd" to change it)
 *        $(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...)
 *        $(INPUT)              : this value is set by the 'inputbox' command
 *        $(INPUT[N])           : Nth field of the $(INPUT) value (N=1,2,3...)
 *        $(SYS.<var>)          : system's environment variable, e.g. $(SYS.PATH)
 *
 ****************************************************************************

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


 v0.3 RC1 - January 2009
 -----------------------
 * thanks to John LaCasse for useful suggestions
 + new environment variable: $(CWD)
 + new commands: ENV_SET/ENV_UNSET
 + new menu item: Toggle Console Dialog (Ctrl+~)
 + now NPE_DEBUGLOG reports on Console double-clicked line's Highlight Filter
 + NppExecPluginMsgTester has been re-designed and updated
 + both Unicode and ANSI builds are supported
 + now the "Execute..." dialog is resizable
 + now NppExec supports remapped shortcut keys (requires Notepad++ >= 5.1.4)
 + other improvements
 + now NppExec has the manual (yes!)

 
 v0.3 beta1 - November 2008
 --------------------------
 + full Unicode compatibility (for Unicode version of Notepad++)
 + additional functionality
 + improvements in the script engine (architecture re-design)
 + improvements in the warning analyzer (spaces/tabs can be omitted)
 + other improvements and fixes
 + now NppExec gets its configuration directory from Notepad++
 + now you can exit a console process or interrupt current script at any time
 + now both Console Output and Input can be ANSI, OEM or UTF-8
 + now each copy of NppExec.dll has its own Console History
 + new option: Follow $(CURRENT_DIRECTORY)
 + new command: NPP_CONSOLE
 + new environment variable: $(PLUGINS_CONFIG_DIR)

 
 v0.2.5 release 2 - September 2008
 ---------------------------------
 - fixed: (potential) bug in CNppExec::DoExecScript()
 - fixed: several (potential) bugs, thanks to Patrick Corwin
 
 
 v0.2.5 - August 2008
 ------------------
 + added: word wrap in the Console dialog (Ctrl+W)
 * changed: Advanced Options dialog - SaveCmdHistory added, 
   RichEdit_MaxTextLength removed
 - fixed: script with spaces in its name was not started using
   associated menu item
 + some improvements
 + new command: NPP_CLOSE
 + new command: INPUTBOX
 * now NppExec uses Rich Edit 2.0 (instead of 1.0) in its Console window
 + added Notepad++'s variables: $(CURRENT_LINE), $(CURRENT_COLUMN)
 + external plugin interface messages:
   NPEM_GETVERDWORD [returns version as DWORD]
   NPEM_GETVERSTR [returns version as string]
   NPEM_GETSTATE [returns state: ready/busy]
   NPEM_PRINT [prints text which can be highlighted by the Highlight Filters]
   NPEM_EXECUTE [executes given commands]
   NPEM_NPPEXEC [executes script/file]
   NPEN_RESULT [as a result of NPEM_EXECUTE or NPEM_NPPEXEC]

 
 v0.2.4 - June 2008
 ------------------
 + added: "Replace" tab in the Console Filters dialog
 * improved: the code of the DlgConsoleOutputFilter has been rewritten
 + added: Console text and background colours can be changed
 + new command: SEL_SAVETO - saves the selected text to a file
 - fixed: CON_SAVETO did not work under Windows 9x
 + added: ability to execute specified script when Notepad++ starts/exits
 + added: ability to assign a menu item to specified script
   (then you can assign a shortcut key to this menu item in Notepad++)
 + added: Advanced Options dialog
 + other improvements
 
 
 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
 
 