Introduction
Below are four scripts I have written in AutoIt to improve the integration between the text-editor that I use, Notepad++, and different programs that I want to run, such as Stata, Octave, LaTeX or C++. They are based on scripts by Friedrich Huebler and Keith Kranker, who both maintain detailed notes on integrating Notepad++ with Stata.
The basic idea behind the scripts below is that in order to perform a similar action to the current file, the same shortcut can be used for files with different extensions. E.g. instead of using different shortcuts for running Stata or Matlab files, ‹ctrl›-r can be used to run .m files in Matlab, .do files in Stata, and .html files in Firefox.
Installation
The usual disclaimer applies (downloading and installing this software is at your own risk, and no support or guarantee is provided, I don't take liability and so on), but please if you have any problems, suggestions, easier ways to accomplish the same thing, etc. These scripts can probably work with other text-editors as well.
Installation of the files is straightforward (a detailed readme and the AutoIt source code is included in the .zip files)
- Download and unzip the files to a convenient location
- Edit the .ini file as described in the readme
- Set up a shortcut in Notepad++
Downloads
-
HelpFromWeb - After pressing the specified shortcut in Notepad++, this script will open a webpage with help about the keyword at the cursor. E.g. when you're working on a Stata .do file, pressing the shortcut after typing the word reg will point a browser window to location http://www.stata.com/help.cgi?reg, the Stata help page for regress. Different websites can be specified in the .ini file for different file extensions.
-
RunScript - Runs the file currently open in Notepad++ in a program of choice. Included in the .ini file are methods to run .do files in Stata and .m files in Matlab or Octave, but more can be added.
-
RunLines - Runs lines of code (or the single line where the cursor is) that are currently selected in Notepad++ in a program of choice. Included in the .ini file are methods to run .do lines in Stata and .m files in Matlab or Octave, but more can be added. The script that you want to run selected lines from has to be saved first, because RunLines needs to know the extension of the script.
-
NppExecute - NppExecute is a Notepad++ plugin that let's you execute a list of commands. For instance, the list of commands below would compile a .tex file and open the resulting .pdf.
C:\...\bibtex.exe "$(CURRENT_DIRECTORY)\$(NAME_PART)"
C:\...\pdflatex.exe -interaction=nonstopmode "$(FULL_CURRENT_PATH)"
"C:\...\SumatraPDF.exe" "$(CURRENT_DIRECTORY)\$(NAME_PART).pdf"
These lists of commands can be saved and executed in Notepad++ using F6. Instead of manually selecting the correct script every time you press F6, this AutoIt script simplifies this, by executing the list of commands corresponding with the extension of the active file.