Page 1 of 6

Setup Notepad++ for AutoHotkey

Posted: 01 Oct 2013, 04:15
by jNizM
Setup Notepad++ for AutoHotkey

(tested up to Notepad++ v7.3.3 - x64)



Syntax-Highlighting
1. Download userDefineLang_AHK.xml as raw (Right-click and choosing save as target...)
2. Save it to the right location C:\Program Files\Notepad++\userDefineLang_AHK.xml (on 32-Bit: C:\Program Files (x86)\Notepad++\userDefineLang_AHK.xml)
3. Start Notepad++ and click on Menu Language -> Define your language
4. Import your userDefineLang
5. Restart Notepad++

* Default Theme (Preview)
* Lazy Theme (Preview)



Auto-Completion
1. Download AutoHotkey.xml as raw (Right-click and choosing save as target...)
2. Save it to the right location C:\Program Files\Notepad++\plugins\APIs\ (on 32-Bit: C:\Program Files (x86)\Notepad++\plugins\APIs\)
3. Start Notepad++ and click on Menu Settings -> Preferences
4. Click on Auto-Completion and activate Enable auto-completion on each input
5. (recommendation: From 2th character, Function completion, Function parameters hint on input)

* AutoComplete (Preview)



Plugins
For 32-Bit Notepad++
If the Plug-In is not available throw the Plugin Manager Menu Plugins -> Plugin Manager use the following steps to install a Plugin:
1. Download your Plugin
2. Save it to the right location C:\Program Files (x86)\Notepad++\plugins\
3. Restart Notepad++

For 64-Bit Notepad++
Since there is no Plugin Manager for 64-Bit Notepad++ atm you need to install all Plugins manually:
1. Download your Plugin
2. Save it to the right location C:\Program Files\Notepad++\plugins\
3. Restart Notepad++

Useful Plugins
* AutoSave (x86 / x64) allows to automatically save the currently open files based on a timer schedule.
* RunMe (x86 / x64) allows to execute the currently open file, based on its shell association.
* TextFX (x86) brings a number of useful features.

More Plugins available here and here



Default Editor
Set Notepad++ as default Editor for AutoHotkey Scripts (right click -> edit script)

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command]
@="C:\\Program Files (x86)\\Notepad++\\notepad++.exe %1"

Code: Select all

RegWrite REG_SZ, HKCR, AutoHotkeyScript\Shell\Edit\Command,, C:\Program Files (x86)\Notepad++\notepad++.exe `%1

Others
* Hotstrings (by Helgef) expand parameters for AHK's functions, commands and directives.
* FunctionList - Enable function list in Notepad++ for AHK scripts
* MsgBox Creator (by boiler) integrated into the editor like it is in SciTE4AutoHotkey
* Run (by boiler) run a script directly from Notepad++ whether or not it has ever been saved to a file


Downloads
* AutoHotkey (current version)
* Notepad++ (current version)

Re: Setup Notepad++ for AutoHotkey

Posted: 25 Oct 2013, 11:45
by empardopo
I have two questions...

1.- Is it possible to define Autohotkey as Default Language in New Document. It's not possible to me.

Image

2.- Is it possible when I select Autohotkey language, notepad++ save a file ahk?

3.- How can I change the default theme?
In Style configurator It doesn't appear Autohotkey language...

Thanks in advance!

Re: Setup Notepad++ for AutoHotkey

Posted: 27 Oct 2013, 22:35
by vahju
Looks like the links are missing for the Download and preview buttons under Syntax highlighting in the first post.

Re: Setup Notepad++ for AutoHotkey

Posted: 28 Oct 2013, 01:33
by jNizM
All links in the first post work!

Re: Setup Notepad++ for AutoHotkey

Posted: 28 Oct 2013, 08:21
by empardopo
The links are OK.
Download it. Installed but I have problems I mention above.

I think that I'm going to check with Sublime. Thanks!

Re: Setup Notepad++ for AutoHotkey

Posted: 28 Oct 2013, 22:29
by vahju
jNizm sorry for the false alarm. After seeing your response I finally figured it out. Chalk this up to user error.

Re: Setup Notepad++ for AutoHotkey

Posted: 27 Nov 2013, 13:58
by wernerml
first of all: really nice, thanks man!

but i'm having a little problem here... I use a theme (that came with NPP by default), it's: "Ruby Blue"

and it's merged with this AutoHotkey style...
http://img812.imageshack.us/img812/143/rq8x.png

I want to continue using this theme for all files, except .ahk files

maybe there's a way to do it.. but I don't know Notepad++ very much...

Re: Setup Notepad++ for AutoHotkey

Posted: 28 Nov 2013, 09:35
by jNizM
try to change the bgColor="FFFFFF" to this ruby blue in userDefineLang_AHK.xml
bgColor = BackgroundColor

eg

Code: Select all

<WordsStyle name="KEYWORDS1" styleID="4" fgColor="0060FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0"/>

Re: Setup Notepad++ for AutoHotkey

Posted: 28 Nov 2013, 16:09
by wernerml
jNizM wrote:try to change the bgColor="FFFFFF" to this ruby blue
it stayed the same... I guess I've not explained myself too well:

the backgroud is "ruby blue" in autohotkey scripts... I want it to be "white??", I want your full style working...

but this "Ruby Blue Style" is overriding your style....

I guess it's more complicated...

Re: Setup Notepad++ for AutoHotkey

Posted: 28 Nov 2013, 22:32
by wernerml
Ok, I've found an explanation, but I didn't understand if this is possible or not...
here: http://stackoverflow.com/questions/1157 ... -file-type

EDIT: Here: https://sourceforge.net/p/notepad-plus/ ... /bd2bc405/
but, again, didn't understand if they implemented this yet...

EDIT 2: OK, this is not possible after all...
explained here: https://sourceforge.net/p/notepad-plus/ ... d/0f0d47af
(on the last post)

:oops:

Re: Setup Notepad++ for AutoHotkey

Posted: 26 Feb 2014, 02:47
by AHKxx
Hey thanks. This is what I was hoping to find here. I've been using SciTE but would prefer to use NPP.

But I'm finding something odd. an ahk script that appears fine in SciTE, and that AHK loads without complaint, is showing up as an error in AHK. And it's a very simple thing too.

This...

^':: Send {LEFT 1}"{RIGHT 1}

...is causing everything to the right of the quote mark to display in red. If I put a semicolon immediately in front of the quote, everything is good.

Any idea why that might be? It's just a plain text quote mark, and again, AHK loads and runs it just fine: for example, here: "

Any insights would be appreciated.

Thanks!

Re: Setup Notepad++ for AutoHotkey

Posted: 03 Mar 2014, 21:31
by RiseUp
AHKxx wrote:This...

^':: Send {LEFT 1}"{RIGHT 1}

...is causing everything to the right of the quote mark to display in red. If I put a semicolon immediately in front of the quote, everything is good.

Any idea why that might be? It's just a plain text quote mark, and again, AHK loads and runs it just fine: for example, here: "

Any insights would be appreciated.

Thanks!
AHKxx,

Notepad++ is coloring everything after the double quotation mark (") red because it thinks that's all a string in your code. It only stops the red coloring after it encounters another double quotation mark which would normally signify the end of a string. For your particular case where the quotes are not there to mark a string, it's a bug in NP's AHK language setup, and unfortunately I do not know how to fix it.

However, I have a workaround that I use and maybe it will work for you. Change that line of code to:

Code: Select all

^':: Send {LEFT 1}"{RIGHT 1}  ;"
The second quotation mark will tell NP++ to stop coloring things red after it, and AHK will ignore it because it's commented out.

Hope that helps!

Re: Setup Notepad++ for AutoHotkey

Posted: 07 Mar 2014, 00:30
by AHKxx
RiseUp wrote:However, I have a workaround that I use and maybe it will work for you. Change that line of code to:

Code: Select all

^':: Send {LEFT 1}"{RIGHT 1}  ;"
The second quotation mark will tell NP++ to stop coloring things red after it, and AHK will ignore it because it's commented out.

Hope that helps!
Hey RiseUp.

Thanks much for your reply and the explanation... and the workaround! It worked like a charm! I will watch out for that in the future.

Re: Setup Notepad++ for AutoHotkey

Posted: 19 Mar 2014, 18:25
by RiseUp
AHKxx wrote: Hey RiseUp.

Thanks much for your reply and the explanation... and the workaround! It worked like a charm! I will watch out for that in the future.
You're welcome. :)

Re: Setup Notepad++ for AutoHotkey

Posted: 16 May 2014, 06:09
by vangogh
hi there,

Thanks for the scripts!

on a related note, i'd like to check if there's a black/dark theme that can be adapted directly for use? currently, the styling is pretty illegible under a dark background as seen below:

Image

i'm hoping for styling that's similar to SciTe4AHK:

Image

Thank you.!

Re: Setup Notepad++ for AutoHotkey

Posted: 07 Aug 2014, 10:10
by alllala
Does this work with NP++ 6.6.2?
Could not get it to work.

I´m still using NP++ 6.1.4 because I´m so used to the syntax Highlighting

Re: Setup Notepad++ for AutoHotkey

Posted: 08 Aug 2014, 00:33
by jNizM
I use Notepad++ v6.6.8 and it works
Image

Re: Setup Notepad++ for AutoHotkey

Posted: 12 Aug 2014, 22:41
by raron
Using Notepad++ 6.6.7. Nice links from OP, but the "Function List" plugin don't seem to work, unfortunately.

Btw, attached is my dark themed AutoHotkey syntax highlighting atm. Bit of a mix from here and there and (tried to) fixed it up a bit now - OK, I might have gone a bit overboard with the colors maybe... (I like colors :) ) And it's not perfect, trouble with lines with a single percent sign in them for one.

Image

Also, using the font Consolas, obtainable from here: http://www.microsoft.com/en-us/download ... x?id=17879
I'm also liking the "Lucida Console", which I think I just had on my system (Win 7). Both monospaced.

I didn't set the font in the AHK syntax coloring file. Just set it in the menu Settings - Style configurator - Global styles - Default style - Font style (And no global overrides).


EDIT: Switched from Photobucket to imgur host for image.

Re: Setup Notepad++ for AutoHotkey

Posted: 02 Sep 2014, 12:15
by Congsinh
It work, thank you!

Make default ahk editor (via "edit" context menu in explorer

Posted: 18 Oct 2014, 22:40
by berban
When SciTE4AutoHotkey installs, there's a prompt to ask if you want to set it as the default ahk editor. This means ahk files will open in SciTE instead of notepad when you right click > edit in windows explorer, or when you use the "Edit" command in ahk.

I changed the following keys in the registry to mimic this behavior. I'm not sure what the difference between the two is but I changed both for good measure.

Code: Select all

Computer\HKEY_CLASSES_ROOT\AutoHotkeyScript\Shell\Edit\Command
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Edit\Command
But do you know of any more user friendly way to accomplish this?

Also... I have been unable to get the autocomplete to work. It only completes words that have been previously entered. I followed the steps in the first post - AutoHotkey.xml is in the right dir, the autocomplete setting is checked. Any ideas? :S