Setup Notepad++ for AutoHotkey

Scripting and setups with Notepad++ and AutoHotkey.
don_dolarson
Posts: 21
Joined: 29 Oct 2019, 12:56

Re: Setup Notepad++ for AutoHotkey

09 Mar 2021, 10:12

YaY, it worked just like expected this time. I've previously downloaded them from GitHub. It may be that. Someone needs to verify this.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Setup Notepad++ for AutoHotkey

16 Apr 2021, 04:47

Added v2 Commands and Functions to userDefineLang.xml
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Setup Notepad++ for AutoHotkey

21 Apr 2021, 06:42

We had a great AutoHotkey webinar yesterday on how to setup Notepad++ for AutoHotkey.
You can get the files we created for Notepad++ here (not to mention our tool for pulling up help by hitting F1)

Here's the first hour where we walk through how to install and configure Notepad++. There is a second hour but we didn't discuss Notepad++ much in that hour.
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
Darxide23
Posts: 14
Joined: 02 Dec 2017, 16:08

Re: Setup Notepad++ for AutoHotkey

14 Jun 2021, 09:55

sofista wrote:
09 Mar 2021, 08:56
@don_dolarson , @jNizM

If problems persist, this worked for me for the current portable version (7.9.3) and Windows 7 (it should be the same for Windows 10):

quit Notepad++, copy the userDefineLang_AHK.xml file and paste into the userDefineLangs directory. Restart Notepad++. AutoHotkey should be listed under the Language menu.
I'm having this problem (bad highlights, bad "fold" groupings, etc) and I've already got userDefineLang_AHK.xml in the directory. The above mentioned "trick" of clicking on Languages->AutoHotKey to temporarily fix the problem does not work for me. I have tried on 7.9.5 as well as 8.0. I've made a post on Npp's forums about this, but so far no fix has presented itself.
sofista
Posts: 645
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Setup Notepad++ for AutoHotkey

14 Jun 2021, 11:42

Darxide23 wrote:
14 Jun 2021, 09:55
sofista wrote:
09 Mar 2021, 08:56
@don_dolarson , @jNizM

If problems persist, this worked for me for the current portable version (7.9.3) and Windows 7 (it should be the same for Windows 10):

quit Notepad++, copy the userDefineLang_AHK.xml file and paste into the userDefineLangs directory. Restart Notepad++. AutoHotkey should be listed under the Language menu.
I'm having this problem (bad highlights, bad "fold" groupings, etc) and I've already got userDefineLang_AHK.xml in the directory. The above mentioned "trick" of clicking on Languages->AutoHotKey to temporarily fix the problem does not work for me. I have tried on 7.9.5 as well as 8.0. I've made a post on Npp's forums about this, but so far no fix has presented itself.
In the quoted post I was referring to the installation process, which had recently changed. Regarding the Folding feature, I hardly use it but I have noticed that it has problems. I use the Function List instead and it works fine.

I also noticed that sometimes there are problems with highlighting -nothing surprising, since I use quite a lot of plugins and enhancements-, but anyway they are solved by selecting Normal language and then going back to AutoHotkey -of course, I do it with a script :)

Finally, I would suggest you to install the portable version of Notepad++ 7.9.5 -version 8 is very new and has issues- and see what happens. If it works fine or at least better, then the problem may be due to an interference from a plugin of the installed version.
Darxide23
Posts: 14
Joined: 02 Dec 2017, 16:08

Re: Setup Notepad++ for AutoHotkey

14 Jun 2021, 13:15

sofista wrote:
14 Jun 2021, 11:42
Finally, I would suggest you to install the portable version of Notepad++ 7.9.5
Darxide23 wrote:
14 Jun 2021, 09:55
I have tried on 7.9.5 as well as 8.0.
I also have no plugins. It's a vanilla install of Npp. I've gone back several versions of Npp and this issue persists. The first mention of this issue I see in this post is from over a year ago and the guy from the NPP forums was surprised the issue has gone on so long without coming to his attention or someone here making a lexer plugin instead of a UDL. I did some searching and someone did attempt a lexer plugin in 2013, but abandoned it before completion.

I made a bug report of this on Npp's github at the request of the guy from their forums since he wasn't aware of this problem and searching open issues couldn't dig up anything quite like this.
sofista
Posts: 645
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Setup Notepad++ for AutoHotkey

14 Jun 2021, 14:28

Darxide23 wrote:
14 Jun 2021, 13:15
I also have no plugins. It's a vanilla install of Npp. I've gone back several versions of Npp and this issue persists. The first mention of this issue I see in this post is from over a year ago and the guy from the NPP forums was surprised the issue has gone on so long without coming to his attention or someone here making a lexer plugin instead of a UDL. I did some searching and someone did attempt a lexer plugin in 2013, but abandoned it before completion.

I made a bug report of this on Npp's github at the request of the guy from their forums since he wasn't aware of this problem and searching open issues couldn't dig up anything quite like this.
I see. The purpose of using the portable version is not only to rule out incompatibilities with a plugin but also to rule out a corrupted configuration file.

These are standard procedures. At least for now I can't think of any other idea worth suggesting, sorry :(
Darxide23
Posts: 14
Joined: 02 Dec 2017, 16:08

Re: Setup Notepad++ for AutoHotkey

14 Jun 2021, 16:00

sofista wrote:
14 Jun 2021, 14:28
I see. The purpose of using the portable version is not only to rule out incompatibilities with a plugin but also to rule out a corrupted configuration file.
Yea, I get it. But I already did because I thought I was on 8.0 because doing the update check said there were no updates, so I downloaded the 7.9.5 portable. Turns out I was on 7.9.5 the whole time, so I updated to 8.0 on the off chance it would change anything. So neither worked. I then tried a couple of other portable versions going back and all were still a no go.

EDIT: And I also get that this isn't the problem of this UDL, either. It's a Npp problem. Was just hoping someone had solved it, but it seems like it's actually a problem deeper within Npp than can't be fixed by the end user.
User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: Setup Notepad++ for AutoHotkey

22 Jun 2021, 08:45

Updated for N++ v8.1
Please test and report bugs or submit a change request.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
D4ng_kun
Posts: 11
Joined: 06 Jun 2021, 23:32

Re: Setup Notepad++ for AutoHotkey

02 Sep 2021, 22:29

Sorry guys, i have a problems with Text color with the ahk_Userdefine language (xml file)
On my laptop, it worked perfectly fine with, dark theme (notepad++ Obsidian theme), with Default Text and Number turn into white color, so it's very easy to read with dark background. The problem is in my desktop, i use the same xml file but the Default text and number which supposed to be white, turn into black, that make it very hard to read with dark background. The other syntax hightlights were OK
Both my laptop and desktop use Window 10 64bit.
I already tried both Notepad++ 32 and 64bit version but the problem still there. (v8.1.4)
In this thread, i found a guy posting bout same problem with me but had no answear
Can anybody help me solve this! Thanks in advance
image.png
image.png (38.51 KiB) Viewed 11824 times
User avatar
raron
Posts: 37
Joined: 11 Aug 2014, 00:50

Re: Setup Notepad++ for AutoHotkey

04 Sep 2021, 10:33

@D4ng_kun

Hi. If it's a userdefined language it should be in Notepad++ menu: Language -> User Defined Language -> "Define your language...". From there select Autohotkey in the drop-down "User Language". Then you should be able to change the Default style colors. Choose a foreground and background color, or just right-click in the background color preview square thing to make it transparent.

And / or, you could also look at the menu: Settings -> Style Configurator...
In the Language list-box, look at "Global Styles", then see in the right-side Style listbox if there are any Global overrides, or a Default style defined.
notyou12345
Posts: 1
Joined: 04 Dec 2021, 20:32

Re: Setup Notepad++ for AutoHotkey

04 Dec 2021, 20:55

For anyone looking for a Dark Mode Version of the Language Style, it's really easy to do your self.

First, ensure the global Sylte Configurator isn't overridding the font color
Settings>Style Configurator
Select Language:"Global Styles", and Style:"Global Override". Ensure "Enable Global Font Colour" is unchecked, else it will force all text to be that color.
-------
After successfully installing the Syntax-Highlighting file as instructed, in the menu go to Language>User Defined Language>Define your language...

A new window will appear -
In the top left, select AutoHotkey in the User language Drop down menu. Then Click Save-As in the top row of buttons, and give it a logical name like AHK_DarkMode.

The rest of the window is made up of multiple sections, ignore 99% of it, you're only interested in the "Styler" button in each section, also note there are 4 tabs of sections "Folder & Default", "Keywords" and so on.
When you click on Styler, and stlye window will appear allowing you chose the foreground and Background color of each section. I just switched all the black color white, switched white to black and made all the colors more vibrant versions of them selves (With the exception of the section "Keywords>1st Group" - I made it yellow instead of green so it's not the same color as comments) (Also reds are bit more pink so they stand out better).

When you're happy, click Export and save that file somewhere safe so next time you reinstall Notepad++ you don't have to start again.
------
Of course if you're too lazy, here is the file I made - full credit and a thank you to jNizM for the original file
userDefineLang_AHK_DM.xml
(17.47 KiB) Downloaded 413 times
rbhall52
Posts: 3
Joined: 03 Feb 2016, 18:51

Re: Setup Notepad++ for AutoHotkey

03 Mar 2022, 14:28

Your syntax for the registry to make notepad++ the default editor for autohotkey has an error in it - REG ADD HKCR\AutoHotkeyScript\Shell\Edit\Command /ve /t REG_SZ /d ^%SystemRoot^%"\Program Files\Notepad++\notepad++.exe %1" /f should be REG ADD HKCR\AutoHotkeyScript\Shell\Edit\Command /ve /t REG_SZ /d ^%SystemRoot^%"\Program Files\Notepad++\notepad++.exe" "%1" /f with a double quote after ".exe" and a double quote before "%1" . Then the registry change will work :).
edj1963
Posts: 5
Joined: 17 May 2022, 02:16

Re: Setup Notepad++ for AutoHotkey

17 May 2022, 05:44

Hello;

First let me apologize if this question has been beaten to death. I have searched the forums, and did my due diligence on Google to the best of my ability, sadly the more I look the more confused I get.

I use NPP for doing ticket creation on the Job, (not a programmer) just like the functionality as it lends it self to long drawn out work logs. I'm attempting to learn AHK, still doing basic stuff using hot keys, etc. I can not for the life of me figure out why NPP completely ignores input from AHK. For example ::inie::Initial email and reply, fills this line or ::@bu:: fills a string of email address' everywhere except NPP, its as if it completely misses it. It works in plain old txt editors, etc. I'm at a loss here. I have tried and failed to install user defined lang, auto complete, changed the preferences, etc., pages are ANSI. I just am trying to understand what I'm missing here.

Eventually the goal is to learn enough AHK to have an automated work log with user input that will complete said work log and save it to a text file (for insertion into the TT) But at this point, NPP will not execute (is that the correct term?) anything from AHK. Right now I'm not even sure if I'm asking the correct question, if not my apologies.

Any pointer, help, guidance etc. would be greatly appreciated. Thank you.

NPP v8.3.3 (64)
AHK v1.1.33.11
Win 10x Enterprise v21H2
User avatar
boiler
Posts: 16768
Joined: 21 Dec 2014, 02:44

Re: Setup Notepad++ for AutoHotkey

17 May 2022, 06:32

If your scripts aren’t working with Notepad++ at all, it might be that it is running as an elevated process (running as administrator). Try running your script as administrator by right-clicking on the script file in File Explorer and selecting that option.

Another potential issue is if you have Notepad++ set to auto-complete. That can mess with the text that AHK is trying to send to it. Try disabling that feature if you have it enabled.
edj1963
Posts: 5
Joined: 17 May 2022, 02:16

Re: Setup Notepad++ for AutoHotkey

17 May 2022, 10:55

That makes perfect sense, thank you going to give it a shot!
edj1963
Posts: 5
Joined: 17 May 2022, 02:16

Re: Setup Notepad++ for AutoHotkey

17 May 2022, 23:35

@boiler That was it! I ran the script elevated and it works like a champ. Can't believe how overly complicated I made that (personality flaw) Brilliant, Thank you :!:
nt-_-ts
Posts: 12
Joined: 27 Apr 2022, 08:02

Re: Setup Notepad++ for AutoHotkey

23 Jun 2022, 08:05

Does anyone know how to bypass the admin rights needed to add the auto-complete xml?
HBinswanger
Posts: 17
Joined: 14 Feb 2016, 00:45

Re: Setup Notepad++ for AutoHotkey

22 Jul 2022, 09:04

boiler wrote:
17 May 2022, 06:32
If your scripts aren’t working with Notepad++ at all, it might be that it is running as an elevated process (running as administrator). Try running your script as administrator by right-clicking on the script file in File Explorer and selecting that option.
I've been using AHK heavily for about 20 years. Suddenly Notepad++ stopped responding at all. Your answer here did the trick :bravo: after I'd spent about 4 fruitless hours researching and testing.
Ben the Coder

Notepad++ Download

25 Aug 2022, 09:30

Don't forget to include the link to the Notepad++ website in a seperate forum thread! ;)
https://notepad-plus-plus.org/
Ben :D

Return to “Notepad++”

Who is online

Users browsing this forum: No registered users and 5 guests