Visual Filter Addition

Features wanted...
Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Visual Filter Addition

Post by Enternal »

Hello. The current Visual Filters are really nice but what if it can also do this:
It reads all the file extension in the current folder and lists them so that you can quickly select which to filter out. For example, I'm in C:\TEMP\ and there are many files with extension gif, jpg, rar, zip, 7z, ut, and py. XYplorer will automatically read all those extension(s) and when I click on the Visual Filter button, those extensions will automatically show up on the list and I can just simply click the extension I want to filter and show only those extension(s). It's a bit quicker and require less steps especially in folder where certain file extension(s) is little compared to the other files (10 jpg among 1000 exe, 200 png, and etc.). What do you think?

admin
Site Admin
Posts: 60612
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Visual Filter Addition

Post by admin »

Possible, but useful? You could also script it.

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: Visual Filter Addition

Post by Enternal »

I think it would be useful. There are quite a few times that I browse a certain folder and certain file extension I have not seen before shows up. These folders usually have many many files so I never knew their existence until I accidentally stumbled upon them. Normally you would then type in the file extension into the address bar or use the visual filter to filter them out but I think it would be quicker if XYplorer's Visual Filter already read all the extensions in that folder and listed for you and then allows you to filter them out. Also allows you to know exactly all the extension that's in the folder (quite useful for folders with many files and many types of files). In my case, I have already set up all my "Video," (added a couple more video format than the one that's already included in XYplorer) "Audio," "Archives," and several others but I never knew I also had some extension with tmp, db, lzh, and !ut in that folder until I start manually filter out all the other file types.

Of course I could script it but thought it would be nice if it's part of Visual Filter since it really is an addition to it.

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Visual Filter Addition

Post by FluxTorpedoe »

Hi'
That's one need I didn't think of, but... one's gotta try to be sure! Plus, it sounds fun. :biggrin:
So I just made this quick'n dirty script to get a feel of it (and to bloat my PowerFilter button).
You've probably done one already, but if someone wanna give this idea a try, here it goes:

Code: Select all

"Filter by List of Extensions"
  $FileInfo = report("{Ext};{Name}<crlf>");
  $FilterList = "|";
  foreach($item, $FileInfo, "<crlf>") {
    if $item {
      $FileExt = gettoken($item, 1, ";");
      if ($FileExt && ($FilterList UnLike "*$FileExt*")) {
        $FilterList = $FilterList.$FileExt."|";
      }
    }
  }
  $FilterList = trim(formatlist($FilterList, s, "|"), "|")."|-|Cancel";
  $Ext = popupmenu($FilterList);
  if ($Ext && ($Ext != "Cancel")) {
    filter "*.$Ext";
  }
Have a nice day, 8)
Flux

Edit: Added "Cancel" to popupmenu

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Visual Filter Addition

Post by TheQwerty »

My mini-golf attempt ended up being a pretty powerful one-liner:

Code: Select all

Filter(InputSelect('Extensions (or Drives) to display:',FormatList(Report('{Dir +\|{Ext}|{Name}}|'),'dents'),'|',2));
If you run it when the list is in Drives mode (viewing Computer) you can use it to select drives, and it defaults to including all folders as well.


EDIT: Don, it would be pretty awesome if Filter() could add to the existing visual filter instead of always overwriting it.

admin
Site Admin
Posts: 60612
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Visual Filter Addition

Post by admin »

TheQwerty wrote:My mini-golf attempt ended up being a pretty powerful one-liner:

Code: Select all

Filter(InputSelect('Extensions (or Drives) to display:',FormatList(Report('{Dir +\|{Ext}|{Name}}|'),'dents'),'|',2));
If you run it when the list is in Drives mode (viewing Computer) you can use it to select drives, and it defaults to including all folders as well.


EDIT: Don, it would be pretty awesome if Filter() could add to the existing visual filter instead of always overwriting it.
Wow, awesome one-liner!

Awesome wish: well, maybe later.

admin
Site Admin
Posts: 60612
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Visual Filter Addition

Post by admin »

I now see the use of this feature. Something like this (a little enhanced even) will come.

j_c_hallgren
XY Blog Master
Posts: 5824
Joined: 02 Jan 2006 19:34
Location: So. Chatham MA/Clearwater FL
Contact:

Re: Visual Filter Addition

Post by j_c_hallgren »

admin wrote:I now see the use of this feature. Something like this (a little enhanced even) will come.
Good! I'd thought about this quite some time ago but never posted as wish...at that time, I was trying to locate the very few files in a large folder that were the "abnormal" types for that folder...hard to spot when only one or two of them among hundreds and when you don't know what types they are.
Still spending WAY TOO much time here! But it's such a pleasure helping XY be a treasure!
(XP on laptop with touchpad and thus NO mouse!) Using latest beta vers when possible.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Visual Filter Addition

Post by TheQwerty »

admin wrote:Wow, awesome one-liner!
Not quite.. I realized I wasn't truly filtering by extensions so it would include "atxt.ini" when filtered by "txt". :oops: So a better one-liner would be:

Code: Select all

Filter(InputSelect('Extensions (or Drives) to display:',"+\|".FormatList(Report('{Dir |*.{Ext}|{Name}}|'),'dents'),'|',2));
EDIT: Forgot I had to move the directory outside of the FormatList now.
admin wrote:Awesome wish: well, maybe later.
I thought you would say this which is why I tried to code around you. :P

It's no longer a simple one-liner (off by 56) but it lead to an interesting and perhaps useful script, that includes the ability to invert the filter or include existing filters. I imagine it won't work well if you start with a complex visual filter as I make some assumptions, but if you're just using this script over and over it should do okay.
Attachments
FilterExts.xys
(1.7 KiB) Downloaded 331 times

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: Visual Filter Addition

Post by Enternal »

Wow, so many scripts already! Glad Don can see the usefulness of it already so it would be nice to have something like this directly implemented in the Visual Filter. Also wow, there's a lot of simpler ways of doing things looking at all those scripts. I never script before so this would be my first time but I was using the regexmatch and been messing with all those regular expressions... what a pain.

Anyway, TheQwerty, your long script also works really well but I think it would be really nice if you have the icons shown so that you know if there's any potential program association with those extensions. Of course, it's simply:

Code: Select all

#HEREDOC , $vfitems,'|', 2, /*cancel*/, /*w*/, /*h*/,'Filter by Extension+');
Changed to

Code: Select all

#HEREDOC , $vfitems,'|', 2+1, /*cancel*/, /*w*/, /*h*/,'Filter by Extension+');

FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Re: Visual Filter Addition

Post by FluxTorpedoe »

TheQwerty wrote:My mini-golf attempt ended up being a pretty powerful one-liner
And it put my maxi-golf to shame! I definitely lost my (w)edge... :biggrin:
Well, that'll teach me to recycle code mindlessly: the whole foreach+ was literally useless in this case (and the rest coulda been streamlined), my bad. :oops:

Anyway, I'm glad your script taught me the {Dir ...} template for report(), powerful...
and the versatility of the formatlist I'd overlooked - I'm gonna love your "dents"! :)

admin
Site Admin
Posts: 60612
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Visual Filter Addition

Post by admin »

admin wrote:I now see the use of this feature. Something like this (a little enhanced even) will come.
Upload in a minute. "Type Stats and Filter". Let me know what you think. I certainly have use for it. :mrgreen:

Filehero
Posts: 2645
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Visual Filter Addition

Post by Filehero »

admin wrote: "Type Stats and Filter". Let me know what you think. I certainly have use for it. :mrgreen:
I like. :D


Cheers,
Filehero

PS: .... slowly I do see what the ribbon approach can be good for ("Search and Filters").

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: Visual Filter Addition

Post by eil »

i find this function useful too. 8) only one thing: why that large name, and not something simple, like "Files Filter"?
Win 7 SP1 x64 100% 1366x768

Enternal
Posts: 1174
Joined: 10 Jan 2012 18:26

Re: Visual Filter Addition

Post by Enternal »

Wow. It's amazing! The ability for it to list how many files of each types is actually a really good and amazing idea! Never even thought about that.

Would it be possible to choose our own sorting of the file types though? Anyway, good job! :biggrin:

Post Reply