Find dialog with whole word and RegEx support

Post your working scripts, libraries and tools
User avatar
jeeswg
Posts: 4793
Joined: 19 Dec 2016, 01:58
Location: UK

Find dialog with whole word and RegEx support

07 Jun 2018, 23:38

- Here is a script to replace Notepad's Find dialog with a more powerful Find dialog. It overrides the Ctrl+F and F3 hotkeys. The window criteria can be changed to make the script work on other programs that use Edit controls.
- The script is an AHK v2 script, rather than an AHK v1.1 script, because AHK v2 is much better for producing GUIs.

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

Last edited by jeeswg on 12 Jun 2018, 07:28, edited 1 time in total.
Helgef
Posts: 3096
Joined: 17 Jul 2016, 01:02
Contact:

Re: Find dialog with whole word and RegEx support

11 Jun 2018, 10:43

Very nice jeeswg, it works well. I would probably catch regex exceptions and display the error in the search dialog, maybe color the needle red when it is invalid.

Thanks for sharing, cheers.
User avatar
jeeswg
Posts: 4793
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Find dialog with whole word and RegEx support

12 Jun 2018, 07:39

- Thanks for testing Helgef. I've added in error handling for RegEx.
- I've set the zoom to 1.5x and to the position that I myself use. The previous values (still available as comments) were 1.8x (to display the text without truncation) and centred (the default when no position is specified).
- I've made the buttons single-line (as in an older prototype script), this makes them look better when the text is too big for the Button control. (It prevents vertical centring and wraparound.)

- I just used the script for the first time, I wanted to do a RegEx search for \d:\d.
- I had been using a very similar script, that lacked the RegEx handling. However, that script used my unfinished custom GUI function library, and so wasn't going to be ready to share for a while. It had the advantage of having no icon. It also had the advantage of having a custom class name, #32770, it was thus compatible with existing hotkeys that I'd defined for the Notepad Find dialog.
- This script flashes each time it's used on Notepad, although I don't notice this when it's of a certain position and size. I had wondered about temporarily changing the window parent/owner, in case this could avoid the flash.
- I presume that you wouldn't get the flash, if you used this script as part of your own GUI, e.g. for a custom Notepad replacement.
Guest

Re: Find dialog with whole word and RegEx support

12 Jun 2018, 07:41

How about a screenshot for those who can't bothered to download v2 just to have a peek at how it looks :-)

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 14 guests