Highlight lines when there are if winactive on notepad++?

Scripting and setups with Notepad++ and AutoHotkey.
User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Highlight lines when there are if winactive on notepad++?

Post by milkygirl90 » 23 Jan 2021, 00:48

My script is getting long and I'm trying to find a way for better readability. Is there a way to highlight a line when it finds:

Code: Select all

 #If WinActive(

User avatar
Spawnova
Posts: 555
Joined: 08 Jul 2015, 00:12
Contact:

Re: Highlight lines when there are if winactive on notepad++?

Post by Spawnova » 23 Jan 2021, 01:37

Hmm, this is a good question, I've never thought about it, but after some research I've found a solution for the most part.. I couldn't figure out a way to match spaces so it either highlights a line with #if or with WinActive.

From the menu bar > Language > User Defined Language > Define your language...

This will open a new window, from here select AutoHotKey as your User Language, click Operators & Delimiters tab and in any available Delimiter style put this information in:

Open: #if
Escape: leave this blank
Close: ((EOL))

Click the styler button as well to change the background/foreground color

Here's an image with visuals - https://imgur.com/a/XVWAW6Z

sofista
Posts: 650
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Highlight lines when there are if winactive on notepad++?

Post by sofista » 23 Jan 2021, 14:05

I haven't used myself, but there is an Enhance UDL lexer, described here https://community.notepad-plus-plus.org/topic/17134/enhance-udl-lexer/32, which could be of help.

User avatar
milkygirl90
Posts: 565
Joined: 10 Nov 2020, 21:22

Re: Highlight lines when there are if winactive on notepad++?

Post by milkygirl90 » 06 Mar 2021, 20:37

Spawnova wrote:
23 Jan 2021, 01:37
Hmm, this is a good question, I've never thought about it, but after some research I've found a solution for the most part.. I couldn't figure out a way to match spaces so it either highlights a line with #if or with WinActive.

From the menu bar > Language > User Defined Language > Define your language...

This will open a new window, from here select AutoHotKey as your User Language, click Operators & Delimiters tab and in any available Delimiter style put this information in:

Open: #if
Escape: leave this blank
Close: ((EOL))

Click the styler button as well to change the background/foreground color

Here's an image with visuals - https://imgur.com/a/XVWAW6Z
this is odd. I already loaded the language and used your delimiter settings but no styling was applied to my script at all. any idea why?
https://i.imgur.com/6O19LtZ.png

https://i.imgur.com/YZ10t34.png

Post Reply

Return to “Notepad++”