0

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:

  1. 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

  2. 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.

1

To select and run the current line:

  1. Install NppExec in Notepad++ Menu: Plugins -> Plugin Manager -> Show Plugin Manager -> Find NppExec and install.

  2. 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 of rundolines.exe. Save it to a new script and give it a name.

  3. 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.

  4. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.