how to get notepad++ to ignore part of AutoHotkey syntax?

Scripting and setups with Notepad++ and AutoHotkey.
newcod3r
Posts: 505
Joined: 30 Sep 2021, 02:16

how to get notepad++ to ignore part of AutoHotkey syntax?

09 Jan 2022, 19:57

I have this issue. When writing code that resembles commenting out without closing it, the rest of my code becomes comments instead of being recognized properly.

E.g.

Code: Select all

myfunction("abc.com/xyz/*")
all other code below turns into 1 color because it recognizes /* as a comment out 
How do I prevent that from happening while still allowing notepad to recognize the other AutoHotkey syntax?
sofista
Posts: 650
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: how to get notepad++ to ignore part of AutoHotkey syntax?

09 Jan 2022, 20:08

Try this:

Code: Select all

myfunction("abc.com/xyz/*")
all other code below turns into 1 color because it recognizes /* as a comment out ; */
newcod3r
Posts: 505
Joined: 30 Sep 2021, 02:16

Re: how to get notepad++ to ignore part of AutoHotkey syntax?

09 Jan 2022, 20:23

thanks for the workaround! I was thinking if there's a more permanent solution, like modifying the style to take account of all these exceptions. Another common one I encounter is when the function ends with a )") as such:

Code: Select all

:X:;cm::myFunction("
(bla
1
2
3
4
5
)")
; everything below turns into 1 color again

it believes I did not have a valid open brace to match the close brace, but adding a comment with a fake open brace didn't help.
sofista
Posts: 650
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: how to get notepad++ to ignore part of AutoHotkey syntax?

09 Jan 2022, 22:47

This seems to work:

Code: Select all

 :X:;cm::myFunction("
(bla
1
2
3
4
5
)") ;"
; everything below turns into 1 color again
newcod3r
Posts: 505
Joined: 30 Sep 2021, 02:16

Re: how to get notepad++ to ignore part of AutoHotkey syntax?

09 Jan 2022, 23:46

this did the job, thanks!

just one last question - is there a proper way to migrate all style settings from 1 PC to another? I copied the entire themes/styles folder in notepad++ but my ahk syntax coloring is still off on my other PCs.
sofista
Posts: 650
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: how to get notepad++ to ignore part of AutoHotkey syntax?

10 Jan 2022, 08:53

You're welcome. From your words, I assume you have installed versions of Notepad++ —it would be easier to copy a portable version—.

Probably you forgot to copy this other file "C:\Users\xxxxxxx\AppData\Roaming\Notepad++\functionList\overrideMap.xml".

Now, to simplify things and without taking into account security or data confidentiality issues, the best thing to do would be to copy the entire folder "C:\Users\xxxxxxx\AppData\Roaming\Notepad++\" to the other PCs.
newcod3r
Posts: 505
Joined: 30 Sep 2021, 02:16

Re: how to get notepad++ to ignore part of AutoHotkey syntax?

10 Jan 2022, 20:02

sofista wrote:
10 Jan 2022, 08:53
You're welcome. From your words, I assume you have installed versions of Notepad++ —it would be easier to copy a portable version—.

Probably you forgot to copy this other file "C:\Users\xxxxxxx\AppData\Roaming\Notepad++\functionList\overrideMap.xml".

Now, to simplify things and without taking into account security or data confidentiality issues, the best thing to do would be to copy the entire folder "C:\Users\xxxxxxx\AppData\Roaming\Notepad++\" to the other PCs.
I see! Let me try this method, hopefully it works. Thank you. 🙏🏼

Return to “Notepad++”

Who is online

Users browsing this forum: No registered users and 60 guests