Wednesday, February 4, 2015

keyboard - Combine custom run command and macro in Notepad++ 6.8



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.


Answer




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.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...