<

How to add custom Run command to Notepad++ for AutoHotkey and other programming/scripting languages

Posted on
7,983 Points
283 Views
2 Endorsements
Last Modified:
Experience Level: Beginner
5:16
Joe Winograd, EE MVE 2015&2016
50+ yrs in computer industry. Everything from programming to sales. OS kernel dev on mainframes. CIO. Document imaging. EE MVE 2015 & 2016.
In a recent question here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video Micro Tutorial shows how to do it by adding a custom Run command to NPP. The method may easily be extended to any programming/scripting language that is callable via the command line with a parameter for the source code file name. A second example of this technique is included in the video for running a batch file (.BAT) in NPP.

Video Steps

1. Click the Run menu, then click the first item — Run...


After running NPP and performing the actions above, you will have this dialog:

Step1

2. Browse to the AutoHotkey executable


Click the ... button and navigate to AutoHotkey.exe, which is in C:\Program Files\AutoHotkey\ in a standard installation (but may, of course, be in a different folder on your system).

Step2

3. Add a parameter for the full path of the file in the current tab


You will now have this dialog box:

Step3a
Go to the end of the AutoHotkey.exe file name in the box and add this (including the quote marks):

"$(FULL_CURRENT_PATH)"

Be sure to make it all upper case.

Step3b

4. Save the new Run command


Click the Save... button, which gives you this dialog:

Step4
Give the new, custom Run command a name (I chose AHK in the video) and assign it to a hotkey (if you wish) by ticking CTRL and/or ALT and/or SHIFT, then one of the keys in the drop-down. When you have an OK button that is not grayed out, click it, then click Cancel to close the dialog.

5. Repeat Steps 1-4 for other programming/scripting languages


The video shows how to do it for batch (BAT) files, namely:

cmd /c "$(FULL_CURRENT_PATH)"

You may, of course, do it for other programming/scripting languages.

Step5

6. Click the Run menu and view your new custom Run commands


After adding Run commands for AHK and BAT, the Run menu looks like this:

Step6

7. Load scripts and use your new custom Run commands


Now that you have the new custom Run commands, create, open, and/or edit scripts in tabs, then click the Run menu and select the appropriate Run command for the script, such as AHK or BAT. Alternatively, you may use the hotkey that you set for each one.

Step7

8. Getting started with AutoHotkey


If you ran across this Micro Tutorial and are not familiar with AutoHotkey, but would like to learn about it, this EE article is a good place to start:
AutoHotkey - Getting Started

That's it! If you find this video to be helpful, please click the thumbs-up icon below. Thank you for watching!
2
Comment
2 Comments
 
LVL 17

Expert Comment

by:Kyle Santos
Nice.  I use AutoHotKeys and NotePad++ and they're great programs for what I do at my job.  Good video, Joe!
0
 
LVL 57

Author Comment

by:Joe Winograd, EE MVE 2015&2016
Hi Kyle,
Thanks for the compliment and the endorsement — both very much appreciated! Regards, Joe
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Join & Write a Comment

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Suggested Courses
Course of the Month17 days, 13 hours left to enroll

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month