Power Filter [v1.0 alpha4]

Discuss and share scripts and script files...
FluxTorpedoe
Posts: 855
Joined: 05 Oct 2011 13:15

Power Filter [v1.0 alpha4]

Post by FluxTorpedoe »

Hi'

=====================
Power Filter v1.0 alpha 4
=====================

- 2012-12-06 -


Here's a script for a Custom Toolbar Button (CTB).
• Left Click (LC): Power Reset
=> Reset view (reset filters, view type, columns, sorting...)
• Right Click (RC): Power Filter
=> Opens a menu of filtering options
PowerFilter.jpg
PowerFilter.jpg (57.44 KiB) Viewed 20693 times
Notes:
••• Left Click (LC) - Power Reset •••
• By default, the view will be reset to "Details View" and "Single Pane" "Dual Pane" (to comply with XY default).
=> To always reset the view to "List View" and "Dual Pane", change the header of the script by setting to "1" the two tweaks resp.:
- $GEN_ListView
- $GEN_DualPane
• The columns layout will also be reset on LC, so be sure that you already have a default column layout defined.
=> If not, click View | Columns | "Define Current Column Layout as Default". (Or you can remove the first #377; line.)
• By default, when the view is filtered, a Left Click (Power Reset) will only remove the filter and won't change the view or sorting. A second LC will then reset the view and sorting (if necessary).
=> To change this behavior and have a single LC simultaneously remove the filter(s) and reset the view and sorting, change the header of the script by setting to "1" the tweak: $GEN_FullReset


••• Right Click (RC) - Filters •••
• The first "Filter Labeled Items" has two functions:
- If no item (or a non labeled item) is selected, then it will filter the view to (only) show all labeled items
- If a labeled item is selected, then it will filter the view to (only) show same-label items
=> If you want to filter only specific labels, you can change or add selfilter lines. For example, I left the one I use with "(" (my main color labels have parenthesis in their name), and I added the second selfilter with "e" (by default, all color label names contain "e").
• By personal preference, the "Filter Modified..." or "Filter Created..." are based on hours - so "Modified Today" means "Modified during the last 24 hours".
• By default, filtering by Date (modified or created) won't will change the view and sorting.
=> To leave the view and sorting untouched, change the header of the script by setting to "0" the tweak: $GEN_DateViewSort
• By default, filtering by Label will be sorted by Label.
=> To leave the Sorting untouched, change the header of the script by setting to "0" the tweak: $GEN_LabelSort
• To force all filters by item types (Images, Audio, Video, Documents, Archives, System) to be sorted by Extension, change the header of the script by setting to "1" the tweak: $GEN_TypeSort
• To force the filter by Images to be displayed unchanged or in one of the 3 Thumbnails View, change the header of the script by setting to "0", "1", "2" or "3" the tweak: $GEN_ImgView
• To force the other filters by item types (Audio, Video, Documents, Archives, System - plus Label) to be displayed in Details or List view, change the header of the script by setting to "1" or "2" the tweak: $GEN_OthersView



Disclaimer:
- I've been using this script for a while without any problem,
- Though, know that this script is NOT optimized. At all more optimized. Slightly. It's been built and modified incrementally (hence the alpha status), and is provided as-is, following a request.
- I may take the time to enhance it or clean it up some day... depending on its usefulness to others. Anyway, feel free to change it, ofc!

Hoping it might prove useful,

Enjoy, 8)
Flux


--------------------------
################
### Installation ###
################


To use this script, first, copy the following file into XYplorer scripts folder: <xyscripts> ,
PowerFilter.xys
(12.41 KiB) Downloaded 1111 times
then either:
1a. add load "PowerFilter.xys", "_PowerReset"; to the "On click:" of your custom button
1b. add load "PowerFilter.xys"; to the "On right-click:" of your custom button, or

2. use the following snippet (with Don's litteral instructions):
-a) Paste ::snippet; into the address bar and press ENTER. A text box will open to enter snippet.
-b) And here comes the copy+paste ready snippet. It will create a new button at the right end of your toolbar.

Code: Select all

Snip: CTB 1
  XYplorer 11.80.0, 01.12.2012 16:00:00
Action
  NewUserButton
Name
  PowerFilter
Icon
  :visualfilter
ScriptL
  load "PowerFilter.xys", "_PowerReset";
ScriptR
  load "PowerFilter.xys";

FireClick
  0
[/size]
-------------------
############
### Extras ###
############

Here's a small pack of extra icons (for this script and others to come)
[Icons].zip
(42.28 KiB) Downloaded 878 times
• All icons (and resp. credits) are from the free collection: Open Icon Library,
- except zip.ico, rar.ico, and archives.ico (Freearc), belonging to their respective owners (I presume).
• To use with this script (you gotta deserve it!):
- Extract with folder name (i.e. in [Icons]) in your XYplorer\Data folder (<xydata>): e.g. XYplorer\Data\[Icons]
- In the script, find all menu title lines that have comments and delete the beginning title until the opening double-quotes - including the comment sign "//" AND the space behind, e.g.:
"Filter Images|:viewthumbs" //-"Filter Images|[Icons]\Images.ico"
=>
"Filter Images|[Icons]\Images.ico"[/color]


-------------------------
##################
### Changelog ###
##################

v1.0a4
++ Added 5 new variables (see script header for info):
++ LC - $GEN_FullReset - "One Click" Reset Filter+View+Sorting (instead of Remove Filter, then Reset View+Sorting)
++ RC - $GEN_TypeSort - Sort all 6 Item Types by Extension
++ RC - $GEN_LabelSort - Sort Labels filtered by Label
++ RC - $GEN_ImgView - Display filtered Images in Thumbnails (1,2 or 3)
++ RC - $GEN_OthersView - Change display of other filtered items
* Renamed var $GEN_DateSorted to $GEN_DateViewSort to match new vars
* Set var $GEN_DualPane to 1 by default to comply with new XYplorer default
* Optimized all filters depending on user settings and tweaks
*! Optimized (and fixed) Power Reset (Left-Click) to be more polyvalent
* Added commented menu title entries with alternate icons, to be used with the extra icon pack

v1.0a3
! Fixed weird bug (incompatible Carriage Return could break code)
v1.0a2
+ Added "Settings" header to regroup all tweaks
+ Added Tweak to force DetailsView and Sorting for date filtering: $GEN_DateSorted
! Fixed ListView and DualPane tweaks

* Rewrote "Filter Labeled" and "Filter Commented" codes to preserve selections (when possible)
! Forced sizes to be filtered by MB whatever the column settings
! Forced dates to be filtered by full Y+H:M:S whatever the column settings

! Fixed implementation of filtering items with "[" or "]" in names
* Changed code for filtering items with "#" in names
* "Remodeled" code to make it cleaner and clearer
Last edited by FluxTorpedoe on 08 Dec 2012 11:03, edited 4 times in total.

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

Re: Power Filter [v1.0 alpha1]

Post by admin »

First impression (without testing, no time, sorry): cool stuff!
Keep informed how this works out. It looks like something I should build in!

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

Re: Power Filter [v1.0 alpha1]

Post by FluxTorpedoe »

Thanks for the vote of confidence! :D
(and ofc it goes without saying that you're more than welcome to alter/implement whatever you feel's worthy!)

And you haven't seen its two brothers... :kidding:
They're a trilogy: Filter, Search(/Branch), and Select.

With their LC being one of their most useful feature - specially for the last two.
Which brings me to say:

@all
- all the RC entries should work as advertised,
- the LC "Power Reset" is the button I use literally all the time whenever the view has changed (different sorting, branch view, columns, thumbnails, Dual/Single Pane...). I've quickly added List/DetailsView and Single/DualPane tweaks, but since it was custom-made to reset to my own default view, it'll probably need some more tweaking to make it more generic. Don't hesitate to speak out.

kotlmg
Posts: 298
Joined: 30 Jun 2010 17:14

Re: Power Filter [v1.0 alpha1]

Post by kotlmg »

hello FluxTorpedoe ,
thanks a lot for your superb xyscript.

kunkel321
Posts: 645
Joined: 10 Jun 2012 03:45
Location: Near Seattle

Re: Power Filter [v1.0 alpha1]

Post by kunkel321 »

Here you go :biggrin:
Image

Couldn't help myself!
https://docs.google.com/open?id=0BwtnO5 ... i1DY24yWFk

Didn't turn out quite as good as the Session Manager one... Oh well.
ste(phen|ve) kunkel

kunkel321
Posts: 645
Joined: 10 Jun 2012 03:45
Location: Near Seattle

Re: Power Filter [v1.0 alpha1]

Post by kunkel321 »

A couple possible bugs (user error?)

If I'm in dual pane, the active pane will always get reset to List View, no matter if $ListView = 0 or 1. However if I'm in single pane, it will rest as expected (to Details View). Also, I'm not sure if the > 10 MB and > 100 MB are working.... Some of the items *do* get filtered out, but it looks like I still have items showing that are both above, and below, 10 or 100 MB in size...

Both issues are present on Vista and Win 7, XY v11.80.

All in all, it's pretty darn cool though! And unlike Session Manager, I can almost understand parts of the code.... Almost! :D

Are you ready to get bombarded with feature requests?? :whistle:
ste(phen|ve) kunkel

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

Re: Power Filter [v1.0 alpha2]

Post by FluxTorpedoe »

Geeez...
Shoulda known there's no such thing as publishing a script "as-is"! :oops:
There were indeed a few bugs, and some shortsightedness... Most of it should be fixed now, and I took the time to clean the code a bit.
Well, at least I didn't flag it "alpha" for no reason! :twisted:
Don't hesitate to voice your comments, questions... Or requests! Yes, who knows... :wink:

---

@kotlmg
Thanks! Always glad to hear it's useful to someone. :D

@kunkel
Looks like you wanna keep your status as the King of Beta-testers! :kidding:
Well, thanks a lot for the feedback - specially since every problem was on my side. :wink:

Btw, yep, icons really make a difference in the pleasure we have interacting with software! 8)
Here's my menu using free icons from the Open Icon Library.
In case someone's interested in the icons I used (and the corresponding script), I could post the pack as an "Extra".
Attachments
PowerFilter-Flux.jpg
PowerFilter-Flux.jpg (59.06 KiB) Viewed 20597 times

kunkel321
Posts: 645
Joined: 10 Jun 2012 03:45
Location: Near Seattle

Re: Power Filter [v1.0 alpha2]

Post by kunkel321 »

Thanks for the update!

I'm getting a crash when I do a reset:
Line 35 if (get('View') != 0) {

'.' is not a valid script command (is what the debugger shows).
ste(phen|ve) kunkel

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

Re: Power Filter [v1.0 alpha3]

Post by FluxTorpedoe »

kunkel321 wrote:'.' is not a valid script command
Wooowwww!
That one I didn't see coming, and it took me a while to figure it out: it was literally an "invisible" code bug!
- Two lines had a "Mac" end of line (CarriageReturn only), instead of a "Windows" end of line (CarriageReturn/LineFeed).
I've not the slightest idea how that could have happened... (since I didn't have it on my side!) :shock:

But I've updated the first post with the fix.

Anyway, thanks Kunkel for enforcing your BetaTestor status! 8)

xycooper
Posts: 28
Joined: 26 Sep 2010 22:49
Location: USA

Re: Power Filter [v1.0 alpha3]

Post by xycooper »

FluxTorpedoe

I like this a lot works great for me.
How can I change the script to: Details and Modified not Ext.?

@Don I think this would be a great addition to XYplorer.
XYplorer - Simply the Best!

Slavaon
Posts: 158
Joined: 29 Mar 2012 07:35

Re: Power Filter [v1.0 alpha2]

Post by Slavaon »

FluxTorpedoe wrote: In case someone's interested in the icons I used (and the corresponding script), I could post the pack as an "Extra".
Please, add icons.
Thank you.

Online
klownboy
Posts: 4052
Joined: 28 Feb 2012 19:27

Re: Power Filter [v1.0 alpha3]

Post by klownboy »

Once again Flux, very nice job. I second the above request. There's always interest in nice icons. :)
Ken
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

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

Re: Power Filter [v1.0 alpha3]

Post by admin »

Yes, I'm thinking about adding parts of the Power Filter. To me these look like universally useful:

Code: Select all

Modified Last 3 Hours
Modified Today
Modified This Week
-
Text
Images
Audio
Video
Web & Office
To make this nicely I will have to add date-support to the Visual Filters (similar syntax as in Color Filters, e.g. ageM:d = Modified Today).

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

Re: Power Filter [v1.0 alpha4]

Post by FluxTorpedoe »

@xycooper & @klownboy
Thanks guys, glad to hear your appreciation! :D
xycooper wrote:How can I change the script to: Details and Modified not Ext.
The new version of the script offers much more liberty. You'll find more info in the instructions above and in the script header to adjust the tweaks to your needs.
Sorting by Modified is probably not a generic need, so you'll have an extra step to follow:
- set $GEN_TypeSort to "1", then
- go to the bottom of the script and in the line with the comment "// Sort by Extension - Change letter to Sort by different column", replace the "e" (extension) with a "m" (modified).
Please, add icons.
There they are too! Including some that are used in other related scripts (that may come one day...).
I couldn't automate icon detection (cause it's not a dynamic menu), and I didn't feel like updating two versions each time, so you'll have to do a little manual work! :wink:

@Don
Good idea, that would show new users the potential of XY filters! :)
And at least you'll avoid the pitfalls of the "Power Reset" with lots of different user settings and needs - well, not that you don't already face this all the time, so... :twisted:

@all
I hope you enjoy this new version, and I especially hope this is nearing a strong beta status now... 8)

xycooper
Posts: 28
Joined: 26 Sep 2010 22:49
Location: USA

Re: Power Filter [v1.0 alpha4]

Post by xycooper »

@FluxTorpedoe
New script works great for me. Just one request could you add "Filter tags".

@Don
I might be dreaming but, it would be great if there was a way for the user to pick
which filters they would like to have or add to your list. Though your list would be good for most.
XYplorer - Simply the Best!

Post Reply