March 28, 2024, 07:18:14 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


New advanced search coming soon - what would you like in it

Started by Andy, December 15, 2019, 02:19:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi all,

As you know I have been working on my convert key words program lately, and I decided to add in another option to search some selected code.

Now lets take this code (it's nonsense I know):

yyy

hhh = yyy

#w[WordCount].aWord=WordIn

FOR a = 1 to x

#w[WordCount].aWord = WordIn
dddddddd
#w[WordCount].aWord= WordIn
ffffffffff
#w[WordCount].aWord =WordIn
vvvvvvv

#w[WordCount].aWord plus = and WordIn
 

Now, as a human being, if I wanted to search for:

#w[WordCount].aWord = WordIn
Looking at the whole code I can see there are 4 instances of "#w[WordCount].aWord = WordIn", the only difference is the spacing around the = sign - but to me they are the same thing.

However, the editor will only ever find 1 instance of "#w[WordCount].aWord = WordIn", which might be correct from a program's point of view but it doesn't help me too much.

Wouldn't it be helpful if we had another search option to find all 4 instances of "#w[WordCount].aWord = WordIn"?

Well I have done just that, so i am asking you all:

1. Would such a search program like this be helpful to you?

2. What other things would you like to be able to search with? e.g. a wildcard? example *abc

Please see attached screenshot, and if you have any ideas then please reply here.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

LarryMc

I can only suggest that by allowing people to search and returning strings with different embedded spaces that, in some cases when following that with the REPLACE command they are REALLY asking for trouble. I've done that to my self enough times when just searching for a single word and doing a replace.

Just my thoughts.  Add warnings and plenty of them when replacing when spaces, tabs, etc are present.

LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Andy

Larry,

Yes that's a very good point, and also having been caught out with that myself is the reason why my search code does things completely differently.

The llines of code are sent to another string array where all individual words and delimiters are stored. The word you are looking for is typed by the user and on searching it is compared to the new string array not the original string.

Any changes that are made are to the string array, not the original string, which remains totally unchanged.

The output goes to either a new file or the clipboard, so again, your original code remains unchanged.

If I have time today, I will post an example.

Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

December 23, 2019, 10:06:56 PM #3 Last Edit: December 24, 2019, 11:00:44 PM by Andy Reason: Test file was missing
Well, in between the mad rush to finish other jobs off and Christmas coming, I've managed to get back to the advanced search program.

Here are the beginnings of it, lot's more work to do on it yet though.

If you look at the Phrase use search screenshot (attached), you can see the lines in this program where I use the pointer #w, but also note that it is an array, and the position name used (e.g. a, WordCount, and even 2) doesn't matter - they all get listed - in my book that's very very useful.

If you have a little time to spare, could you please download the attached.

Please read the Search.rtf file first then compile (as a project) and have a go & test.

Please let me know if it works for you?
Sort of?
Yes / no?

As already said, this is in it's early stages but the signs appear to be good.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Well I've copied the advanced search part of the program and made it a stand alone program in it's own right.

This version not only does the advanced search, it also lists correctly all sub routines in your chosen code.

Compile AdvancedSearch.iwb as a single file (F8)

1. Compile AdvancedSearch.iwb (F8) - and maybe make a desktop shortcut to the exe file (AdvancedSearch.exe).
2. Load up in the editor, ConvertKeyWords.iwb (so it's the selected code).
3. Run AdvancedSearch.exe

4. In the search box type        #w[]
5. Click "Find".

You should see the results.

6. Click "Clear".
7. Select the following sub routines:

DoConvertClipBoard
DoConvertFileToFile

Selecting subroutines allows you to just search them and not all the file as well.

8. Click "Find".

You will also note that not only does my program list actual sub routine names, but also each subs start line number & end line number - think that's very handy.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

December 29, 2019, 05:15:52 AM #5 Last Edit: December 29, 2019, 05:23:59 AM by Andy
Just need to check a few things, but the advanced search program now has extra features in it.

1. It's a stand alone program (so you can add it into your Tools menu or create a desktop shortcut to it).
2. It lists all the sub routines and windows (including their handler routines).
3. All subs and windows list the line number they start at, and finish at.
4. You can select to search the whole file, or selected sub routines.
5. Search results not only show the match, but also (line number of course) the sub routine they appear in.
6. If you minimise the screen, and choose another file in your editor, the subs and windows are automatically updated for you.

Using this method of searching words, not using the INSTR command and being able to list subs and windows / handlers I have revamped my copy sub routine / window code too.

I will post both as stand alone programs for you all a.s.a.p.

Some screenshots attached for you to have a look at.

Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.