home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2009 May / maximum-cd-2009-05.iso / DiscContents / npp.5.2.Installer.exe / plugins / doc / NppExec_TechInfo.txt < prev    next >
Encoding:
Text File  |  2008-12-22  |  12.7 KB  |  350 lines

  1.  ****************************************************************************
  2.  * NppExec plugin ver. 0.3 for Notepad++ 5.1 (and above)
  3.  * by DV, December 2006 - January 2009
  4.  ****************************************************************************
  5.  
  6.  
  7.  ***************************
  8.  *  Technical Information  *
  9.  ***************************
  10.  
  11.  NppExec has advanced "hidden" settings which can be set manually.
  12.  You need to edit NppExec's ini-file: "\Plugins\Config\NppExec.ini".
  13.  
  14.   --------------------------------------------------------------
  15.  |  KEY                             |  DEFAULT VALUE   |  TYPE  |
  16.  |--------------------------------------------------------------|
  17.  |                                  |                  |        |
  18.  |  [Console]                       |                  |        |
  19.  |  ChildProcess_StartupTimeout_ms  |  240             |  int   |
  20.  |  ChildProcess_CycleTimeout_ms    |  120             |  int   |
  21.  |  ChildProcess_ExitTimeout_ms     |  4000            |  int   |
  22.  |  Path_AutoDblQuotes              |  0      (FALSE)  |  BOOL  |
  23.  |  CmdHistory_MaxItems             |  256             |  int   |
  24.  |  Exec_MaxCount                   |  100             |  int   |
  25.  |  RichEdit_MaxTextLength          |  4194304 (4 MB)  |  int   |
  26.  |  CommentDelimiter                |  //              | string |
  27.  |  Visible                         |  0      (FALSE)  |  BOOL  |
  28.  |  ShowHelp                        |  0      (FALSE)  |  BOOL  |
  29.  |  NoEmptyVars                     |  1      (TRUE)   |  BOOL  |
  30.  |  SaveCmdHistory                  |  1      (TRUE)   |  BOOL  |
  31.  |  TextColorNormal                 |  00 00 00        |  HEX   |
  32.  |  TextColorError                  |  A0 10 10        |  HEX   |
  33.  |  TextColorMessage                |  20 80 20        |  HEX   |
  34.  |  BackgroundColor                 |  0               |  HEX   |
  35.  |  Alias_Cmd_NppExec               |  \               | string |
  36.  |                                  |                  |        |
  37.  |  [Options]                       |                  |        |
  38.  |  HotKey                          |  F6              | string |
  39.  |  ToolbarBtn                      |  1               |  int   |
  40.  |  WatchScriptFile                 |  1      (TRUE)   |  BOOL  |
  41.  |  ScriptNppStart                  |         (empty)  | string |
  42.  |  ScriptNppExit                   |         (empty)  | string |
  43.  |                                  |                  |        |
  44.   --------------------------------------------------------------
  45.  
  46.  The purpose of each key is described below.
  47.  You can add specified keys to [Console] or [Options] section of 
  48.  this ini-file.
  49.  For example, you can modify it in the following way:
  50.  
  51.    [Options]
  52.    HotKey=F6
  53.    ToolbarBtn=1
  54.    WatchScriptFile=1
  55.    ScriptNppStart=
  56.    ScriptNppExit=
  57.    
  58.    [Console]
  59.    Visible=0
  60.    ShowHelp=0
  61.    OEM=1
  62.    CmdHistory=1
  63.    ChildProcess_StartupTimeout_ms=240
  64.    ChildProcess_CycleTimeout_ms=120
  65.    ChildProcess_ExitTimeout_ms=4000
  66.    Path_AutoDblQuotes=0
  67.    CmdHistory_MaxItems=256
  68.    Exec_MaxCount=100
  69.    RichEdit_MaxTextLength=4194304
  70.    CommentDelimiter=//
  71.    NoEmptyVars=1
  72.    SaveCmdHistory=1
  73.    TextColorNormal=00 00 00
  74.    TextColorError=A0 10 10
  75.    TextColorMessage=20 80 20
  76.    BackgroundColor=0
  77.    Alias_Cmd_NppExec=\
  78.  
  79.  
  80.  ChildProcess_StartupTimeout_ms
  81.  ------------------------------
  82.    This parameter is important when a child console process is created.
  83.    The child process usually can't be created immediately, therefore
  84.    we must give some time to this process to be started.
  85.    Here is a general implementation of this part of code:
  86.    
  87.        if ( CreateProcess( ... , &ProcInfo ) )
  88.        {
  89.            CloseHandle( ProcInfo.hThread );
  90.            WaitForSingleObject( ProcInfo.hProcess, STARTUP_TIMEOUT );
  91.            ...
  92.        }
  93.  
  94.    When the process is started, WaitForSingleObject returns.
  95.    But, if the value of STARTUP_TIMEOUT is too low, WaitForSingleObject 
  96.    may return before the process is started.
  97.    If default value of ChildProcess_StartupTimeout_ms is not enough for
  98.    your PC, you can increase it. IMHO, it can not exceed 400 ms.
  99.    
  100.  
  101.  ChildProcess_CycleTimeout_ms
  102.  ----------------------------
  103.    The only purpose of this parameter is to decrease the CPU usage.
  104.    The bigger value you set, the less CPU usage you get :-)
  105.    Here is an implementation of this part of code in outline:
  106.    
  107.        do {
  108.            // reading from the process'es pipe
  109.            ...
  110.        } while ( WaitForSingleObject( ProcInfo.hProcess, 
  111.                      CYCLE_TIMEOUT ) == WAIT_TIMEOUT );
  112.    
  113.    Don't forget that actually the value of ChildProcess_CycleTimeout_ms
  114.    is a pause between requests to the child console process'es output, 
  115.    so values > 500 ms are not recommened.
  116.  
  117.  
  118.  ChildProcess_ExitTimeout_ms
  119.  ---------------------------
  120.    This parameter is needed when you are about to exit (quit) a running
  121.    child console process by sending the exit message to it.
  122.    For example, cmd.exe is running, but you want to close the Console
  123.    window or start another NppExec's script. So, you send the exit 
  124.    message - and NppExec waits for the cmd.exe process to be finished. 
  125.    If the child process has been finished before the timeout of
  126.    ChildProcess_ExitTimeout_ms elapsed, NppExec performs the action 
  127.    requested previously - closes its Console window or starts another 
  128.    script.
  129.    Otherwise, if the child process has not been finished during 
  130.    ChildProcess_ExitTimeout_ms (for example, if "dir" has been sent 
  131.    instead of "exit"), then NppExec does not close its Console window
  132.    or does not start another script after the child process will be
  133.    finished at last.
  134.  
  135.  
  136.  
  137.  Path_AutoDblQuotes
  138.  ------------------
  139.    If you enable this option (set it to 1), then path to executable 
  140.    which contains spaces (for example, "my program 1.exe") will be 
  141.    automatically enclosed in quotes "".
  142.    It is disabled by default because of a bug with executables w/o
  143.    extension. For example, this line
  144.    
  145.      cmd /c calc.exe
  146.    
  147.    will be modified (if this option is enabled) to this one:
  148.    
  149.      "cmd /c calc.exe"
  150.      
  151.    because "cmd" is given without extension ".exe".
  152.    Therefore don't forget to enclose paths with spaces in quotes
  153.    manually, when this option is disabled.
  154.    
  155.  
  156.  CmdHistory_MaxItems
  157.  -------------------
  158.    Specifies maximum number of items in the console commands history.
  159.    
  160.  
  161.  Exec_MaxCount
  162.  -------------
  163.    Specifies maximum number of NPP_EXEC calls within one script.
  164.    This value is needed to prevent the infinite loop of several scripts
  165.    which call each other, e.g.
  166.    
  167.      ::script1
  168.      npp_exec script2
  169.      
  170.      ::script2
  171.      npp_exec script1
  172.    
  173.  
  174.  RichEdit_MaxTextLength  
  175.  ----------------------
  176.    Specifies maximum number of characters which can be stored or 
  177.    pasted into the Console dialog's rich edit control.
  178.  
  179.  
  180.  CommentDelimiter
  181.  ----------------
  182.    Specifies a comment delimiter  :-)  I.e. all characters after
  183.    this delimiter are understood as a comment, and the text line
  184.    (command) is truncated at the position of this delimiter.
  185.    Exception: 
  186.    - when the comment delimiter is // then :// is not truncated 
  187.    at the position of // (because :// can be a part of http://).
  188.    Note:
  189.    - if you specify empty comment delimiter i.e.
  190.  
  191.      CommentDelimiter=
  192.  
  193.    then you can not use comments in your commands/scripts because
  194.    there is no comment delimiter in this case.
  195.  
  196.  
  197.  Visible
  198.  -------
  199.    If you enable this option (set it to 1), then the Console window
  200.    will be visible when Notepad++ starts. Otherwise, when this option
  201.    is set to 0 (default value), there will be no Console window opened
  202.    when Notepad++ starts.
  203.  
  204.  
  205.  ShowHelp
  206.  --------
  207.    When this option is enabled (set to 1), the Console window shows
  208.    the Help Info each time Notepad++ starts.
  209.    If this option is disabled (set to 0), the Console window does not
  210.    show the Help Info when Notepad++ starts.
  211.    
  212.  
  213.  NoEmptyVars
  214.  -----------
  215.    When this option is enabled (set to 1), then all unset variables
  216.    such as "$(var)" will be replaced with "" (empty string).
  217.    If this option is disabled (set to 0), then unset variable "$(var)" 
  218.    will not be replaced with empty string i.e. it will remain "$(var)".
  219.  
  220.  
  221.  SaveCmdHistory
  222.  --------------
  223.    When this option is enabled (set to 1) and "Console Commands History"
  224.    is checked, then the console commands history is saved to file
  225.    "npec_cmdhistory.txt" when Notepad++ exits. And the commands history
  226.    is restored from this file when Notepad++ starts.
  227.    If this option is disabled (set to 0), then the console commands
  228.    history is not saved and restored.
  229.  
  230.  
  231.  TextColorNormal
  232.  ---------------
  233.    This option can specify the Console's normal text colour in a form of
  234.    RR GG BB, where RR, GG and BB are HEX values of red, green and blue
  235.    colours.
  236.    Value of "00 00 00" or "000000" means RR = 00, GG = 00 and BB = 00 
  237.    i.e. black colour (because values of red, green and blue = 0x00).
  238.    Value of "FF 00 00" or "FF0000" means RR = FF, GG = 00 and BB = 00 
  239.    i.e. red colour (red = 0xFF, green and blue = 0x00).
  240.    Value of "0" or any other value which does not contain three values of
  241.    relative intensities of red, green and blue colours means "don't use
  242.    this value, use default colour". I.e. you can specify
  243.    
  244.      TextColorNormal=0
  245.      
  246.    or just
  247.    
  248.      TextColorNormal=
  249.      
  250.    to use the default (internal) colour.
  251.    The same approach is used for TextColorError, TextColorMessage and
  252.    BackgroundColor values.
  253.    If you want to have a "console-style" look (i.e. white text on the
  254.    black background), specify the values similar to:
  255.    
  256.      TextColorNormal=C0 C0 C0
  257.      TextColorError=C0 10 10
  258.      TextColorMessage=20 A0 20
  259.      BackgroundColor=00 00 00
  260.  
  261.  
  262.  TextColorError
  263.  --------------
  264.    This option can specify the colour of Console's error messages.
  265.    See TextColorNormal for details.
  266.    
  267.  
  268.  TextColorMessage
  269.  ----------------
  270.    This option can specify the colour of Console's internal messages
  271.    (such as  "Process started >>>",  "======== READY ========"  etc.)
  272.    See TextColorNormal for details.
  273.    
  274.  
  275.  BackgroundColor
  276.  ---------------
  277.    Background color of the Console's output window.
  278.    See TextColorNormal for details.
  279.  
  280.  
  281.  Alias_Cmd_NppExec
  282.  -----------------
  283.    This alias can be used instead of the "NPP_EXEC " command when you 
  284.    want to execute some NppExec's script. The alias consists of one 
  285.    character; only the first character from specified string value is 
  286.    taken. For example,
  287.  
  288.      Alias_Cmd_NppExec=\!?
  289.  
  290.    sets the first character '\' as the alias, other characters are
  291.    ignored. With this example, you can type
  292.  
  293.      \"my script" "param 1" "param 2"
  294.  
  295.    instead of
  296.  
  297.      NPP_EXEC "my script" "param 1" "param 2"
  298.  
  299.    and the script named "my script" will be executed.
  300.    You can also specify an empty value of Alias_Cmd_NppExec:
  301.  
  302.      Alias_Cmd_NppExec=
  303.  
  304.    The empty value of Alias_Cmd_NppExec disables the alias i.e. no
  305.    character can be used instead of "NPP_EXEC ".
  306.  
  307.  
  308.  HotKey
  309.  ------
  310.    Specifies the plugin hotkey which calls the "Execute..." dialog.
  311.    Available values are: F1, F2, F3 ... F12.
  312.  
  313.  
  314.  ToolbarBtn
  315.  ----------
  316.    ToolbarBtn = 0  -  no toolbar button;
  317.    ToolbarBtn = 1  -  the toolbar button shows the Console window;
  318.    ToolbarBtn = 2  -  the toolbar button calls the "Execute..." dialog.
  319.    ToolbarBtn = 3  -  the toolbar button directly executes last script.
  320.    
  321.    
  322.  WatchScriptFile
  323.  ---------------
  324.    When this option is enabled (set to 1), the plugin rereads the file
  325.    with saved scripts if its time stamp has been changed. The plugin
  326.    checks the file time stamp when you call the "Execute..." dialog.
  327.    If this option is disabled (set to 0), the plugin does not check
  328.    the file time stamp and does not reread this file.
  329.  
  330.  
  331.  ScriptNppStart
  332.  --------------
  333.    You can specify here a name of existing script which you want to be
  334.    executed each time when Notepad++ starts.
  335.    For example, this script can contain declarations of your own variables
  336.    (using SET command), some welcome messages (using ECHO command) or
  337.    whatever command(s) you want.
  338.    Note: if you specify an empty value or non-existent script name for
  339.    this option, no script will be executed when Notepad++ starts.
  340.    See also: ScriptNppExit.
  341.    
  342.  
  343.  ScriptNppExit
  344.  -------------
  345.    You can specify here a name of existing script which you want to be
  346.    executed each time when Notepad++ exits.
  347.    Note: if you specify an empty value or non-existent script name for
  348.    this option, no script will be executed when Notepad++ exits.
  349.    See also: ScriptNppStart.
  350.