Following very useful guidance by Friedrich Huebler on integrating Stata with Notepad++ I've added a set of run commands that are assigned to:
- F9 - run selected line
- F10 - run the whole file
I in addittion I have also created a macro that selects the current line, which is assigned to Ctrl + Shift + Enter. I usually run the commands in the following variants:
Running Current Line
1.1. Press Ctrl + Shift + Enter in order to select the current line.
1.2. Press F9 to send the current line to Stata
Running Current File
2.1 Press Ctrl + S to save file
2.2 Press F10 to send the whole file to Stata
Ideally, I would like to streamline that process. The ideal outcome would correspond to the following result:
- Shortcut Ctrl + Shift + Enter selects whole line and sends it to Stata
- Key F10 saves the current file and sends it to Stata
Ideally I would like to edit the existing macro files so I can the Stata run commands to them.
Answer
To select and run the current line:
Install NppExec in Notepad++ Menu: Plugins -> Plugin Manager -> Show Plugin Manager -> Find NppExec and install.
Put the following code into NppExec's console: Plugins -> NppExec -> Execute...
SCI_SENDMSG 2453
SCI_SENDMSG 2452
"C:\ado\rundolines.exe" "$(FULL_CURRENT_PATH)"And of course please change
C:\ado\rundolines.exe
to your path ofrundolines.exe
. Save it to a new script and give it a name.Put this new script into Notepad++'s menu: Plugins -> NppExec -> Advanced Options... -> Menu Item: choose your new script in "Associated script" and give it a name.
Give this new menu item a shortcut via Settings -> Shortcut Mapper...
For save and send the whole file:
Create a new script in NppExec using the command npp_save
:
npp_save
"C:\ado\rundo.exe" "$(FULL_CURRENT_PATH)"
After creating a new menu item and shortcut binding, you are done.
No comments:
Post a Comment