Page 1 of 3
Visual Filter Addition
Posted: 07 Mar 2013 04:24
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?
Re: Visual Filter Addition
Posted: 07 Mar 2013 07:56
by admin
Possible, but useful? You could also script it.
Re: Visual Filter Addition
Posted: 07 Mar 2013 10:32
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.
Re: Visual Filter Addition
Posted: 07 Mar 2013 14:17
by FluxTorpedoe
Hi'
That's one need I didn't think of, but... one's gotta try to be sure! Plus, it sounds fun.
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,
Flux
Edit: Added "Cancel" to popupmenu
Re: Visual Filter Addition
Posted: 07 Mar 2013 15:26
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.
Re: Visual Filter Addition
Posted: 07 Mar 2013 17:27
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.
Re: Visual Filter Addition
Posted: 07 Mar 2013 17:28
by admin
I now see the use of this feature. Something like this (a little enhanced even) will come.
Re: Visual Filter Addition
Posted: 07 Mar 2013 17:47
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.
Re: Visual Filter Addition
Posted: 07 Mar 2013 18:20
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".

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.
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.
Re: Visual Filter Addition
Posted: 08 Mar 2013 01:31
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+');
Re: Visual Filter Addition
Posted: 08 Mar 2013 09:02
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...
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.
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"!

Re: Visual Filter Addition
Posted: 11 Mar 2013 20:06
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.

Re: Visual Filter Addition
Posted: 11 Mar 2013 20:30
by Filehero
admin wrote: "Type Stats and Filter". Let me know what you think. I certainly have use for it.

I like.
Cheers,
Filehero
PS: .... slowly I do see what the ribbon approach can be good for ("Search and Filters").
Re: Visual Filter Addition
Posted: 12 Mar 2013 00:54
by eil
i find this function useful too.

only one thing: why that large name, and not something simple, like "Files Filter"?
Re: Visual Filter Addition
Posted: 12 Mar 2013 09:00
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!
