0

I regularly use notepad++ for editing my AutoHotkey scripts. I like to use the notepad++>Run feature to test them and validate them.

It works good but here's what would take it to the next level -- When I go Run > Run... > ... (to select file) > It opens the file picker window and by default it looks for exe's, .com, .cmd, .bat, etc. How can I also have it look for .ahk extensions? It's quite ridiculous to always have to select "all files." I would be extremely surprised if this isn't a hidden feature somewheres...

file picker example

0

Please forgive me if I go over anything you are already aware of in this answer.


How can I also have it look for .ahk extensions?

Offhand, I am not aware of a way to affect the file picker dialog in Notepad++ to add default executable extensions.

I regularly use Notepad++ for editing my AutoHotkey scripts. I like to use the Notepad++ Run feature to test them and validate them.

Assuming that:

  • You aren't selecting files other than the ones you are currently working on in Notepad++ (i.e. the ones you have open).

  • The files you are working on have an .ahk extension and have been saved at least once.

  • You have registered the .ahk extension with AutoHotkey in Windows.

There should be no need modify the file picker dialog. Notepad++ has the ability to save Run... commands, including some very generic ones.

In particular, Notepad++ has a variable called $(FULL_CURRENT_PATH) which is populated either once a file is saved or if a file is opened from a previously saved file. You can use this variable in conjunction with the Run... command to run the current file, including .ahk scripts (which should, again, be possible if the .ahk extension is registered with AutoHotkey in Windows).

Running AutoHotkey Scripts In Notepad++

  1. Open RunRun... in Notepad++ (F5).

  2. In the Run... dialog box, type "$(FULL_CURRENT_PATH)" and then click Save. Note that the double-quotes are to ensure that paths with spaces work correctly.

ex. Saving A Run... Command (Save)

Notepad++ Run... Dialog - Save - Screenshot

  1. A new dialog will open where you can give the saved command a name (required) and keyboard shortcut (optional). Click OK once you are done.

ex. Saving A Run... Command (Options)

Notepad++ Run... Dialog - Save Options - Screenshot

  1. You will be returned to the Run... dialog, which you can safely Cancel out of assuming you don't wish to run the current file at that moment.

ex. Saving A Run... Command (Finish)

Notepad++ Run... Dialog - Cancel - Screenshot

  1. You should now have a new option under Run which will allow you to run the current file open in Notepad++ (including .ahk files, with the caveats already noted.)

ex. Saved Run... Command

Notepad++ - Saved Run... Command - Screenshot

To be clear, functioning .ahk scripts should simply run in the Windows notification area as usual and non-functioning scripts should display the normal AutoHotkey error dialog detailing any issues encountered.

| improve this answer | |

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.