Setup Notepad++ for AutoHotkey

Helpful script writing tricks and HowTo's
User avatar
jNizM
Posts: 1821
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Location: Germany

Setup Notepad++ for AutoHotkey

01 Oct 2013, 04:15

Setup Notepad++ for AutoHotkey

(tested up to Notepad++ v6.9.1)



[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 (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 ( Download | Preview )
- Lazy Theme ( Download | 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 (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 ( Download | Preview )



[Plugins]
If the Plug-In is not available throw the Plugin Manager (Menu Plugins --> Plugin Manager) use following steps to install a Plugin:
1. Download PlugIns
2. Save it to the right location (C:\Program Files (x86)\Notepad++\plugins\)
Notepad++ loads plugins at startup.
To load a new plugin, you can either close and restart Notepad++, or use the Settings --> Import --> Import plugin command.


Useful Plug-in's
* (AutoSave) allows to automatically save the currently open files based on a timer schedule (default is 1 min) and/or upon the application losing focus.
* (RunMe) allows to execute the currently open file, based on its shell association.
* (TextFX) brings a number of useful features

* (Compare Plugin) A very useful diff plugin to show the difference between 2 files (side by side).
* (DBGP plugin) This is a php debugger (XDebug) which talks DBGP protocol. Use this plugin to transform your Notepad++ to a php IDE.
* (Function List) offers a list of functions (or sections) according of the language of current document, in order to access to the function or section you need quickly.
* (LanguageHelp) allows to run a language specific help file (CHM, HLP, PDF) and search for the keyword under the cursor.

More Plugins available here and here



[Set Notepad++ as default Editor for AutoHotkey Scripts] (Right Click => Edit Script)

Code: [Select all] [Download] (ahk_npp.reg)GeSHi © Codebox Plus

Windows Registry Editor Version 5.00

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

Code: [Select all] [Download] (ahk_npp.ahk)GeSHi © Codebox Plus

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




Downloads:
- AutoHotkey (Current Version)
- Notepad++ (Current Version)


Last edited by jNizM on 22 Oct 2014, 05:28, edited 7 times in total.
[AHK] 1.1.24.04 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.693) x64
My GitHub Profile | Donations are appreciated if I could help you
User avatar
empardopo
Posts: 335
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Setup Notepad++ for AutoHotkey

25 Oct 2013, 11:45

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!
Everything is possible!
vahju
Posts: 23
Joined: 30 Sep 2013, 16:09

Re: Setup Notepad++ for AutoHotkey

27 Oct 2013, 22:35

Looks like the links are missing for the Download and preview buttons under Syntax highlighting in the first post.
User avatar
jNizM
Posts: 1821
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Location: Germany

Re: Setup Notepad++ for AutoHotkey

28 Oct 2013, 01:33

All links in the first post work!
[AHK] 1.1.24.04 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.693) x64
My GitHub Profile | Donations are appreciated if I could help you
User avatar
empardopo
Posts: 335
Joined: 06 Oct 2013, 12:50
Location: Spain
Contact:

Re: Setup Notepad++ for AutoHotkey

28 Oct 2013, 08:21

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!
Everything is possible!
vahju
Posts: 23
Joined: 30 Sep 2013, 16:09

Re: Setup Notepad++ for AutoHotkey

28 Oct 2013, 22:29

jNizm sorry for the false alarm. After seeing your response I finally figured it out. Chalk this up to user error.
User avatar
wernerml
Posts: 3
Joined: 27 Nov 2013, 13:40
Facebook: wernerml@gmail.com
Location: Brazil

Re: Setup Notepad++ for AutoHotkey

27 Nov 2013, 13:58

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...
User avatar
jNizM
Posts: 1821
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Location: Germany

Re: Setup Notepad++ for AutoHotkey

28 Nov 2013, 09:35

try to change the bgColor="FFFFFF" to this ruby blue in userDefineLang_AHK.xml
bgColor = BackgroundColor

eg

Code: [Select all] [Download] GeSHi © Codebox Plus

<WordsStyle name="KEYWORDS1" styleID="4" fgColor="0060FF" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0"/>
[AHK] 1.1.24.04 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.693) x64
My GitHub Profile | Donations are appreciated if I could help you
User avatar
wernerml
Posts: 3
Joined: 27 Nov 2013, 13:40
Facebook: wernerml@gmail.com
Location: Brazil

Re: Setup Notepad++ for AutoHotkey

28 Nov 2013, 16:09

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...
User avatar
wernerml
Posts: 3
Joined: 27 Nov 2013, 13:40
Facebook: wernerml@gmail.com
Location: Brazil

Re: Setup Notepad++ for AutoHotkey

28 Nov 2013, 22:32

Ok, I've found an explanation, but I didn't understand if this is possible or not...
here: http://stackoverflow.com/questions/11574590/in-notepad-set-background-color-for-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/discussion/331754/thread/0f0d47af
(on the last post)

:oops:
AHKxx
Posts: 52
Joined: 26 Feb 2014, 01:37

Re: Setup Notepad++ for AutoHotkey

26 Feb 2014, 02:47

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!
RiseUp
Posts: 7
Joined: 01 Oct 2013, 21:27

Re: Setup Notepad++ for AutoHotkey

03 Mar 2014, 21:31

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] [Download] GeSHi © Codebox Plus

^':: 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!
AHKxx
Posts: 52
Joined: 26 Feb 2014, 01:37

Re: Setup Notepad++ for AutoHotkey

07 Mar 2014, 00:30

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] [Download] GeSHi © Codebox Plus

^':: 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.
RiseUp
Posts: 7
Joined: 01 Oct 2013, 21:27

Re: Setup Notepad++ for AutoHotkey

19 Mar 2014, 18:25

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. :)
vangogh
Posts: 3
Joined: 16 May 2014, 06:05

Re: Setup Notepad++ for AutoHotkey

16 May 2014, 06:09

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.!
alllala
Posts: 13
Joined: 03 Apr 2014, 05:04

Re: Setup Notepad++ for AutoHotkey

07 Aug 2014, 10:10

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
User avatar
jNizM
Posts: 1821
Joined: 30 Sep 2013, 01:33
GitHub: jNizM
Location: Germany

Re: Setup Notepad++ for AutoHotkey

08 Aug 2014, 00:33

I use Notepad++ v6.6.8 and it works
Image
[AHK] 1.1.24.04 x64 Unicode
[WIN] 10 Pro (Version 1607 | Build 14393.693) x64
My GitHub Profile | Donations are appreciated if I could help you
raron
Posts: 19
Joined: 11 Aug 2014, 00:50

Re: Setup Notepad++ for AutoHotkey

12 Aug 2014, 22:41

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).
Attachments
Notepad++ rarons AutoHotKey syntax highlighting.rar
WIP - my current AutoHotkey syntax highlight colors.
(3.19 KiB) Downloaded 971 times
User avatar
Congsinh
Posts: 3
Joined: 02 Sep 2014, 03:58

Re: Setup Notepad++ for AutoHotkey

02 Sep 2014, 12:15

It work, thank you!
@}-;-- Close your eyes and your will find ... The passage out of the dark
~~~: Ahk e.g | Cheat Age 3 | Cheat Plants vs Zombies 2
User avatar
berban
Posts: 33
Joined: 14 Apr 2014, 03:20

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

18 Oct 2014, 22:40

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] [Download] GeSHi © Codebox Plus

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

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 5 guests