Search within selected folders

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

otlaolap
Bronze Member
Bronze Member
Posts: 172
Joined: 2007 Aug 11, 21:37

Re: Search within selected folders

Post by otlaolap » 2013 May 14, 14:50

I too would like Ctrl+F to apply: if nothing is selected in the folder then to the whole folder; if anything is selected in the folder then only to the selected folders and files (files since I might have a text search in mind).

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Search within selected folders

Post by Kilmatead » 2013 May 14, 16:20

otlaolap wrote:...files since I might have a text search in mind.
Interestingly, file objects are considered invalid as far as the "Look in:" field is concerned (an error is given if you try it), so I don't think robust search (or whatever name it goes by) is geared towards supporting specific files other than those targeted via the "Named:" field. Hence the reason I just filtered out anything that didn't have a -D- attribute. :shrug:

otlaolap
Bronze Member
Bronze Member
Posts: 172
Joined: 2007 Aug 11, 21:37

Re: Search within selected folders

Post by otlaolap » 2013 May 14, 21:01

Hence the reason I just filtered out anything that didn't have a -D- attribute.
As do I in my AutoHotkey replicand, and for the same reason. But what would I like? Select the items I want to search, hit Ctrl+F, and go. Why should a file down a level be searchable but one right here in front of me not be?

In any case, the "Named" field is problematic (for me). If I put a specific file nam in it, such as "a.ahk", and also have "search subfolders" checked, then the search finds a lot of files that are not named "a.ahk" and returns them (as well as a.ahk). So I revert to the first paragraph: what do I want? Highlight some Items and search them.

All in all, though, I am much more than happy to have Xplorer2. Two things that have made it enormously helpful to me: first, its keyboard-driven nature; and second the almost complete exposure of its internal operations through 3XXXX message numbers (mostly without side effects).

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Search within selected folders

Post by Kilmatead » 2013 May 14, 22:23

otlaolap wrote:In any case, the "Named" field is problematic (for me). If I put a specific file name in it, such as "a.ahk", and also have "search subfolders" checked, then the search finds a lot of files that are not named "a.ahk" and returns them (as well as a.ahk).
I may be wrong about this, but isn't that what the new RegEx mode is for? For example, if you only want to match the file 'a.ahk' (when, obviously search sees this as '*a.ahk*', thus matching more than you want) - if you set the Fuzzy-matching number to 0 (initiating RegEx) and in the 'Named:' field put '^(a.ahk)' without the single-quotes - you'll match only the literal 'a.ahk' string, no matter what level of the structure it's on, so searching subfolders becomes friendly again.

Now I'm the first to stand up and say "Well, yeah, that'll work, but Jeez man, it shouldn't be that weird"... however, it does solve the problem of trying to find a literal filename sans those annoying, invisible (but occasionally useful) presumed wildcards over a deep nest.

:shrug: (Hey, I just answer the questions - I don't rationalise the answers themselves! :wink:)

Then again, I could be wrong - RegEx is not my strong-suit. (But the above example does work, empirically.)
otlaolap wrote:Why should a file down a level be searchable but one right here in front of me not be?
I have enough doubts about Nikos even understanding the basics of this thread correct in the first place (he doesn't seem to "get it"), never mind the actual work involved in going further and implementing that - but yeah, you're right, that should be the assumed behaviour. It'll never happen, of course, unless Nikos is overcome with a bout of madness... but no one should hold their breath waiting for that. :wink:

otlaolap
Bronze Member
Bronze Member
Posts: 172
Joined: 2007 Aug 11, 21:37

Re: Search within selected folders

Post by otlaolap » 2013 May 15, 00:32

Regarding the "Named" field, the help ("?" help button in the upper-right-hand corner of the find-files window) has this to say:
Fuzzy name search. The number box next to the Named field dictates the percent exactness when matching file names. 100% means exact match, but lower values will allow for small spelling errors or the presence (or lack) of accented characters e.g. umlauts and other diacriticals. Setting the fuzzy indicator to 0 turns on the regular expression mode where the Named field is interpreted as a regular expression to match.
I understand "100% means exact match" to mean "100% means exact match" with the name. Apparently, though, it means that the string(s) entered must match not the filename but some part of the filename to be listed in the result. The strings are not the names of matching files, but of text contained within the names of matching files. This explains what I see as extra files returned in the search. Given this interpretation of "exact match", which actually is quite reasonable if to me unexpected, the names produced by the search make sense.

But I still want to be able to search specific things -- named files and name folders (these specific files and all files in these specific folders). This is what I mean when I select them and hit Ctrl+F. Still a good program, though.

dunno
Gold Member
Gold Member
Posts: 442
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Re: Search within selected folders

Post by dunno » 2013 May 15, 05:22

otlaolap wrote: what do I want? Highlight some Items and search them.
That in a nutshell is intuitive behaviour for a search UI, "highlight and execute", if nothing is highlighted then search current window. Case Closed.

User avatar
ozzii
Bronze Member
Bronze Member
Posts: 121
Joined: 2005 Jun 01, 05:48

Re: Search within selected folders

Post by ozzii » 2013 May 15, 06:42

otlaolap wrote:As do I in my AutoHotkey replicand
A little question: can you send me your file so I can saw what/how you did?
I more understand autohotkey that autoit.

Thanks in advance.


P.S: the problem with searching the selected file; when you select a file you can't disable the select.
Even if I change folder and came back, the file is always selected. I need to close/open x² for having the file not selected.

otlaolap
Bronze Member
Bronze Member
Posts: 172
Joined: 2007 Aug 11, 21:37

Re: Search within selected folders

Post by otlaolap » 2013 May 15, 15:41

can you send me your file
Done via PM. Over half the code is simply making sure that a new find-files-or-folders window is the one that gets updated. You can have many of these open when you type a new Ctrl+F (one per open Xplorer2 window minus the window you are working in), and I wanted to make sure that it was the new window that was updated. Otherwise the code is similar to Kilmataed's Autoit.

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Search within selected folders

Post by Kilmatead » 2013 May 15, 18:12

otlaolap wrote:...and I wanted to make sure that it was the new window that was updated.
Whilst many may be open, only one may be active, and when that one fires the 32885 (<Ctrl+F>) code into the getmsg queue, the resulting window takes focus automatically, and as long as it's of [CLASS:#32770], then the oompaloompas are happy.

Technically one could make an argument that a race-condition could occur wherein a freak thunderstorm could focus a different [CLASS:#32770] window (all x2 childwindows are classed the same, but only one may be launched and active via the parent process) at just the right moment, and then a conflict could arise, but I've never seen it happen. I have seen amusing code where people go to great lengths to secure the parental PID's of the current and/or spawned processes, then divide out the subwindows on that level from the overall list of running PID's to derive a "super-accurate" window handle, but... well, that's just mental. :D

One of the reasons Snakebyte's Menuhack programme went a bit wobbly after the 2.0 launch of x2 was because he had used all sorts of spaghetti window checking code just to prove the Earth was round - when I reckoned that the odds of any process other than the currently active x2 window launching Menuhack was rather infinitesimally small, I jettisoned all that and decided that the active window was always going to be the birthday-girl.

In much the same way as Chastity Belts could lead (so the wiki tells us) to genitourinary infections, too much worrying over which window is receiving our advances just invites trouble, when the worst that could happen is that some other window accidentally receives gobbledegook and we have to start over. By targeting the actual control ID's in the windows themselves (which for some inexplicable reason didn't work for poor ozzii), that's enough layers of protection to keep me happy.

(If nothing else, at least I learned that the term "genitourinary" is just as unpleasant as I would have always assumed it was. :D)

pj
Gold Member
Gold Member
Posts: 402
Joined: 2006 Jan 26, 14:01
Location: Florida

Re: Search within selected folders

Post by pj » 2013 May 16, 01:10

LocaleSearch, The Original Script, runs fine for me.

Test system:
OS - XP SP3
x2 - 2.0.0.0 (unicode) - I'm reluctant to upgrade my work (@home) system.
Admin account
-------------------------------------
PJ in (The Most Wonderful Time of the Year) FL

pj
Gold Member
Gold Member
Posts: 402
Joined: 2006 Jan 26, 14:01
Location: Florida

Re: Search within selected folders

Post by pj » 2013 May 16, 01:16

Oh yeah - LS TOS is the way I originally thought ctrl-F worked, but was sadly mistaken.

I agree with Nikos there has to be some consideration to the boundary conditions and idiot-proofing (wonder just how much code is dedicated to the idiots of the world?), but having this functionality without the the keyboard gymnastics is an improvement.

Should go on the list just BELOW "Fix the @#%$& scroll-jumping bug" on the fix-it list. :mrgreen:
------------------------------------------------------
PJ in (wish you were here - NOT!) FL

profess
Silver Member
Silver Member
Posts: 307
Joined: 2003 Oct 06, 11:39

Re: Search within selected folders

Post by profess » 2013 May 23, 09:17

i see what nikos is saying here also.

#1 the simpler way
so as i see it there should be, at least, a tick box (another one ;)) for searching selected folders only, available in the Find dialog. existing behaviour unchanged.

#2 complicated (maybe) and merky waters
then after that you can implement the 'search selected folders only' or 'search current folder' (existing behaviour) if none are selected - available for when you're browsing files. i can see how this could go wrong though so optional would be best.

but wouldn't it be more awkward for existing work-flow patterns to remember if you've got some folder selected or not and whether you want to search in the folder or selected subfolder(s), or not, and then pressing search, or deselecting before searching? or you could be navigating a folder and press Find and be expecting the existing behaviour, only for it to ignore the current directory and search the selected folder(s) instead.

i dunno - but i see where everyone is coming from.

=

everyone has a picture in their head of what they see implemented. most of our communication friction seems to happen when we don't see each other's vision or understand it. if understood it could then seem illogical, as seems to be niko's viewpoint. trying to apply logic to what you find illogical is always difficult though.

=

share your vision.

Osei
Live life...

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Search within selected folders

Post by Kilmatead » 2013 May 23, 10:38

That's why there's a "Look in" window in the first place - so you can see what you're about to search. If you see a bunch of nonsense that you have "accidentally" selected then you should just be able to clear it, and it would search the current folder as default. Ironically, Nikos didn't build in the safe-guard for that, as if you enter a blank field, it whines about how "You must specify a starting folder..." and does nothing, instead.

If it just defaulted (as is logical) to the current folder when the Look in box is empty, then that does away with any perceived checkbox necessities. To clear the field is just as easy as ticking a box.
profess wrote:...most of our communication friction seems to happen when we don't see each other's vision or understand it.
Just for that, you'll be put in charge of answering the queries of all the marauding hoards of Hare-Krishna's that so plague the forums in these trying times of pink elephants and happy-friendly attitudes. :wink: Oh, the horror of it all.
profess wrote:...trying to apply logic to what you find illogical is always difficult...
Not really - that's the only thing preventing me from jumping off Victoria Falls in a beautiful fit of existential lust - gives me something to do each day.

However, were you to say "...trying to apply logic to what Nikos finds logical is always difficult..." then I would have to agree with you in honour of the "2nd Law of Necessary Chutzpah". (Which, for those, interested, is the one that comes just after Gravity. Or possibly it's the one just after the one about Thermodynamic Pizzas? As all three are equally important, it's difficult to tell them apart sometimes. :D)

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Re: Search within selected folders

Post by Kilmatead » 2013 May 23, 11:11

Actually, it would probably just be easier to extend Custom Keyboard Assignments to User Commands (rather than leaving them limited to useless subsets). That way <Ctrl+F> (or whatever) could be easily subverted into using LS TOS, or any other script, and Nikos could just go back to his nap. :shrug: User Commands have been out in the cold for too long.

User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1162
Joined: 2005 Oct 16, 19:09

Re: Search within selected folders

Post by FrizzleFry » 2013 May 23, 14:07

I like that idea... I have never liked that user commands can only be assigned Ctrl|Alt|Shift numeral keyboard shortcuts.

Post Reply