Text Filter

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

14 Jan 2021, 06:01

New window or not doesn't matter. The difference is, that he takes for each subsequent step the result of a previous query as a new haystack, while I take always the original haystack.

Stepping forward, I believe results are the same as long "case sensitivity" and "whole word match" is for both the same (putting asside, that his approach is for each subsequent step a bit faster).

Stepping backwards I can now change "case sensitivity" and "whole word match" and so come to a dead end before coming to the first step (if I wouldn't take the original haystack). Besides I can go now directly to the first step or in-between moreover, I can branch from what ever step in-between to a new step direction, or start a completely new query...

P.s.: teadrinker's approach makes difference between needles e.g. a b and b a, besides it's slower and "attacks" the whole haystack at once which can make app unresponsive for a large haystack much earlier.

P.p.s.: Updated script on previous page (small not essential changes)
garry
Posts: 3738
Joined: 22 Dec 2013, 12:50

Re: Text Filter

14 Jan 2021, 07:07

@rommmcek thank you for your comments and the excellent script , good idea from @SundayProgrammer
SundayProgrammer
Posts: 143
Joined: 25 Dec 2020, 12:26

Re: Text Filter

14 Jan 2021, 07:53

SpeedMaster wrote:
13 Jan 2021, 16:35
rommmcek wrote:
13 Jan 2021, 12:47
There is no multi level anymore! Now it's real time! Every change of the needle searches across the whole haystack!
by a "multi-level" search, I mean a step-by-step search like this :think:
.
.
.
SundayProgrammer has a different approach for each step/level there is a new window :roll:
even though i like the "real time" (aka Find As You Type) approach by @rommmcek, they are by all means not mutually exclusive whatsoever. we can always have both FAYT and multi-level in one single tool, i guess. i've already come up an idea how to arrange them in a design. and am squeezing time to work on it.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

14 Jan 2021, 07:55

Yeah, the main credit goes to SundayProgrammer's filter engine!
One more update on previous page to get the right output count!
Last edited by rommmcek on 16 Jan 2021, 10:29, edited 1 time in total.
garry
Posts: 3738
Joined: 22 Dec 2013, 12:50

Re: Text Filter

14 Jan 2021, 08:06

@rommmcek I think the line count was correct if each line ends with `n ( also the last line )

Code: Select all

;.....
I took the one less traveled by,
And that has made all the difference.

)"
;...
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

14 Jan 2021, 08:11

You're right, now I edited the script (twice!) so count will be always correct!
strreplace(RTrim(Haystack, "`r`n") "`n", "`n",, blc)
garry
Posts: 3738
Joined: 22 Dec 2013, 12:50

Re: Text Filter

14 Jan 2021, 08:33

@rommmcek thank you , works fine , count lines with / or without `n at last text-line
A question for checkbox : both checked is possible ? So not radio-button needed ? ( "When the user clicks a radio button to turn it on, any others in its radio group are turned off automatically " )
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

14 Jan 2021, 09:10

Case sensitive and Whole word only are independent. We can check only one of them, both or non as we desire, similar to Find options in most editors!
ozzii
Posts: 481
Joined: 30 Oct 2013, 06:04

Re: Text Filter

14 Jan 2021, 09:28

thank you @SundayProgrammer and @rommmcek
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

14 Jan 2021, 12:44

Fixed bug for marking Case sensitive/insensitive search, introduced through changing its logic!
User avatar
kunkel321
Posts: 969
Joined: 30 Nov 2015, 21:19

Re: Text Filter

14 Jan 2021, 18:03

Hey would it be difficult to set this up for use with larger texts? I tried pasting in the main section of the hotstrings from AutoCorrect.ahk
https://www.autohotkey.com/download/AutoCorrect.ahk
but I get an error that the continuation section is too long. I think it only sees the first 700 hotkeys or so.
ste(phen|ve) kunkel
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

14 Jan 2021, 20:43

You most probably use first script in the OP. It is obsolete now! I recommend you to use this script.
Besides there is one more truble. Text in your link is in one line only and Text Filter is designed to work on multiple lines. To fix this append to the script (in the link) F8:: Clipboard:= StrReplace(Clipboard, "::", ";::`n") Run the script and press F8 to transform your one line text in the Clipboard to multiline text. Then you can paste into Text Filter Gui.
sofista
Posts: 645
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Text Filter

15 Jan 2021, 09:50

Nice script, thank you. Maybe it's too much to ask for, but is there any chance to hightligth the matched strings?
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

15 Jan 2021, 09:58

Focus haystack control via tab or mouse click and press f.
sofista
Posts: 645
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Text Filter

15 Jan 2021, 13:54

Thank you for the fast reply. However, I was expecting something else. Will try to explain my point. From my Notepad++ experience to highlight a string is a different action from a selection, as the caret is not involved. Highlighting just colors all the matched strings without the need to select them -although it can do that, but I don't requiere it here-, since the main use I thought for highligthing is to visualize all the search results at a glance.

Hope this is still possible.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

15 Jan 2021, 14:51

I'm not an expert! But Notepad++ is using Scintilla control, This thread is using standard Windows Edit control. Your wish is like: Can MS Notepad color all matches? The Answer is no!
However e.g. AutoGUI uses Scintilla too and there it is possible. If Text Filter will ever implement Scintilla... I don't know, but you can start it by yourself and I'm sure you'll get some help form members...
User avatar
kunkel321
Posts: 969
Joined: 30 Nov 2015, 21:19

Re: Text Filter

15 Jan 2021, 16:45

rommmcek wrote:
14 Jan 2021, 20:43
You most probably use first script in the OP. It is obsolete now! I recommend you to use this script.
Besides there is one more truble. Text in your link is in one line only and Text Filter is designed to work on multiple lines. To fix this append to the script (in the link) F8:: Clipboard:= StrReplace(Clipboard, "::", ";::`n") Run the script and press F8 to transform your one line text in the Clipboard to multiline text. Then you can paste into Text Filter Gui.
Thanks for the feedback Rommmcek! Sorry for my not asking a clear question... It wasn't the entire AutoCorrect.ahk script that I was using, just the part that looks like:
Spoiler
Also, though, the thing that I was really interested in is whether the script could be adapted to larger sources of text. Right now it seems to be using a continuation section that is hardcoded into the script. There's no reason you couldn't have a 50 page document (that is separated into separate lines) and save it to a variable, then load that variable into Text Filter, yes?

EDIT: I thought it might be as easy as substituring the below code for that hard-coded poem, but alas, this does not work.

Code: Select all

theHay:= theHaystack:= %ClipboardAll%
ste(phen|ve) kunkel
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Text Filter

15 Jan 2021, 17:04

I've been using it on a 23M wordlist (700k+ lines) without problem. Don't use first script on page one!
User avatar
kunkel321
Posts: 969
Joined: 30 Nov 2015, 21:19

Re: Text Filter

15 Jan 2021, 17:09

Yep, I was using the revised version. Just had my syntax wrong...
This works:

Code: Select all

theHay:= theHaystack:= Clipboard
I just tried it with chapter 392-172 of the Washington Administrative Codes (WAC). 131 pages. It was super fast -- awesome!

EDIT: As a side note: This words well for legal documents, because they are already formatted into an outline format anyway (bullets and numbered lists).
ste(phen|ve) kunkel
sofista
Posts: 645
Joined: 24 Feb 2020, 13:59
Location: Buenos Aires

Re: Text Filter

15 Jan 2021, 17:47

rommmcek wrote:
15 Jan 2021, 14:51

However e.g. AutoGUI uses Scintilla too and there it is possible. If Text Filter will ever implement Scintilla... I don't know, but you can start it by yourself and I'm sure you'll get some help form members...
Hmm, for the time being I have had enough of Scintilla. Dealing with Notepad++ Scintilla component was for me a frustrating and unproductive experience, so I'm quite reluctant to get involved again with it. At least, not without new ideas, which I currently lack. Time will tell :roll:

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 117 guests