2

Question is in title: I have many opened files in Npp, and want to compile only the leftmost one by Alt+F6 (NppExec-Plugin), I am compiling tex-files with ConTeXt.

At the moment my commands are:

cd $(CURRENT_DIRECTORY)
taskkill /im SumatraPDF.exe
context.exe "filename.tex" --synctex=1
C:...\sumatra.bat "$(CURRENT_DIRECTORY)\filename.pdf"

How to change them, such that not a filename stand there, but only some enviromental variable, s.t. only the file in the leftmost tab is executed?

Thanks!

Mustafa
  • 133
  • 3
  • 9

1 Answers1

8

Here's the list of all environment variables that NppExec supports, as described in the docs:

 *   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...)
 *        $(OUTPUT)             : this value can be set by the child process, see npe_console v+
 *        $(OUTPUT1)            : first line in $(OUTPUT)
 *        $(OUTPUTL)            : last line in $(OUTPUT)
 *        $(EXITCODE)           : exit code of the last executed child process
 *        $(MSG_RESULT)         : result of 'npp_sendmsg[ex]' or 'sci_sendmsg'
 *        $(MSG_WPARAM)         : wParam (output) of 'npp_sendmsg[ex]' or 'sci_sendmsg'
 *        $(MSG_LPARAM)         : lParam (output) of 'npp_sendmsg[ex]' or 'sci_sendmsg'
 *        $(SYS.<var>)          : system's environment variable, e.g. $(SYS.PATH)

Thus, it doesn't seem possible to select the leftmost file. What you could do though, is to change the 2 occurrences of filename in your commands with the $(NAME_PART) variable, and select the leftmost file before executing, so $(NAME_PART) will be set to filename.

psxls
  • 6,807
  • 6
  • 30
  • 50
  • Thank you. Additionaly to your solution: Is there a way to automatically select the leftmost file before executing, by any macro or somewhat, best if it could be included in ALT+F6, too. – Mustafa Oct 28 '13 at 20:22
  • You can't do that using a macro. I'm not aware of any other way. Have you considered moving this `filename.tex` (I assume it's your leftmost file) in the Other View for easy access? You can do that by right-clicking the tab name and select `Move to Other View`. Or you can quickly switch tabs using CTRL+Tab or CTRL+PgUp/PgDn. – psxls Oct 29 '13 at 00:07
  • Thanks, it is not that easy, how I wanted it, but it is a step in the right way :) – Mustafa Oct 29 '13 at 06:25
  • wow... can u please have a look at my question here http://superuser.com/questions/707212/in-notepad-how-can-i-launch-the-current-html-file-as-browsing-mode ? – Royi Namir Jan 27 '14 at 07:42