Menu

What is the Nppexec Command Format?

JCP
2007-05-17
2012-11-13
  • JCP

    JCP - 2007-05-17

    In nppexec, what is the command format? -- Simply msdos command line style ?
    Should multiple commands be placed in a batch file, then execute the batch file ?
    Or should multiple commands simply be placed on multiple lines in the Command(s) box ?

    A thorough example would be great.

    Thanks much,

    jpepe3

     
    • DV

      DV - 2007-05-17

      It seems we need FAQ or short help for this plugin... Can anyone create such help files instead of me? :-)
      I already have a little collection of several questions and answers which can be a fundament for the FAQ, but I am not sure that my explanation will be understood for end-user :-)
      Anyway, here is a hint: when plugin's Console dialog is open, type "help" inside of it and press Enter. You will see a list of available commands and environment variables.
      NppExec by itself understands only specified commands and environment variables. When you type different command, such as "copy", "cmd" or "calc", the plugin tries to run it as a child process - i.e. it performs CreateProcess( ... ) and waits until this process ends. When you type something like "npp_run cmd" or "npp_run calc", the plugin tries to run specified command (the argument of npp_run) as an external process - i.e. it performs WinExec( ... ) and does not care about this process.

      For example, type in the Console dialog:

      calc

      and press Enter. NppExec will wait until you close calc.
      Now type this:

      npp_exec calc

      and press Enter. NppExec just starts calc and does not wait until you close it.

      Of course, if "cmd" or "calc" does not exist, the plugin says it can't run the process. For example, the plugin DOES NOT KNOW what is "copy" or "move", because these commands a performed by "cmd.exe" or "command.com". Therefore, if you want a complete support of DOS commands, you must start "cmd.exe" (or "command.com") and only then you will be able to use DOS commands. Also don't forget to exit cmd.exe by typing "exit" when you will need it to be run no more.
      For example, type this in the Console dialog:

      cmd

      and press Enter. Now cmd is started as a child process. You can perform any DOS command here while cmd is running. But NppExec's commands will not work because cmd.exe does not know anything about NppExec's commands (the same way as NppExec does not know anything about cmd.exe's commands).
      When you do not need cmd.exe to perform commands no more, don't forget to type:

      exit

      and press Enter. Now cmd is finished and the control focus is returned to NppExec (i.e. the plugin's commands are available again, but cmd's commands are unavialable).

      Finally, NppExec allows you to enter multiple lines in its Execute dialog because it does support multiple commands. Did you think it allows you to enter several commands but perform only first of them? ;-)
      Don't forget to use npp_run if you don't want NppExec to wait until previous command returns before running next command.

       
      • Don HO

        Don HO - 2007-05-17

        Vitaliy,

        Create your FAQ in this Wiki Entry if you want :
        http://notepad-plus.wiki.sourceforge.net/pluginsFAQ

        (or create this entry in your project page)

        Don

         
        • DV

          DV - 2007-05-17

          I'll think about it... The FAQ does not exist yet :-)

           
    • DV

      DV - 2007-05-17

      Damn, there was a misprint!

      The last line in

      "
      For example, type in the Console dialog:

      calc

      and press Enter. NppExec will wait until you close calc.
      Now type this:

      npp_exec calc
      "

      must be

      npp_run calc

      (not npp_exec).

       
MongoDB Logo MongoDB