Better file / folder selector

Discuss and share scripts and script files...
highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Better file / folder selector

Post by highend »

This one is for the beginners (and even advanced users) who want a better file selection tool...

Update:
v1.2 posted
- Empty (or a single "*") patterns are accepted
- Replaced all (time critical) foreach loops


What does it do? It selects files (and / or folders) (and displays them as a paperfolder if the option is set) xD

But it has a few options that make it very a tiny bit powerful:

- A logical not operator to inverse patterns
- In- / exclude file extensions
- Only files / folders | both
- Case-(in)-sensitive search

with the following pattern types...

- Begins with
- Ends with
- Contains
- Date (created)
- Date (modified)
- Date (acessed)
- DOS expression
- Regular expression
- Property (XY internal & custom ones)
- Random
- Every nth item

Annotation:
- The help file is none existent! Does anybody want to provide a nice looking HTML5 template for it?

Syntax should be obvious, two exceptions:
- Randomly selected: Just use a number to set the value how many files will be chosen
- Every nth item: <start number>:<every nth number>
So the bar ":" is the divider between the start and the step value
Ofc using the "Not" switch will reverse the selection! :)

A picture says more than a thousand words, right?
Unbenannt.png
Unbenannt.png (10.02 KiB) Viewed 7094 times
Download:
Current version:
v1.2
BetterFileSelector_v1.2.zip
(9.36 KiB) Downloaded 542 times
Old version(s):
v1.0
BetterFileSelector_v1.0.zip
(7.08 KiB) Downloaded 305 times
v0.9
BetterFileSelector_v0.9.zip
(6.26 KiB) Downloaded 248 times
DC: 42
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Better file / folder selector

Post by highend »

Reserved for changelogs
v1.2
• Added : A button to change between normal and branch view
• Added : An empty pattern (and an asterisk) are now accepted as default
values
• Changed: Use formatlist instead of a loop to remove all items from the
current selection, that do not match a selected one
• Changed: Randomly selected: Use a gettoken for multiple items on
randomized selection instead of a while loop
• Changed: Every nth item: Faster while loop
• Changed: "Begins with" & "Ends with" separated
Foreach loop replaced with a regexreplace()
• Changed: DOS expression: Made "*" lazy of greedy
• Changed: [x] Incl. files is now a separate option
• Fixed : "Ends with" used the same pattern as "Begins with"
v1.0
• Added: Branch view support!
• Added: Show how long it took to execute the selection
• Changed: Removed many global variables (permanent ones are global by default)
• Changed: Removed the # from all internal XY property names
It get's readded in the "_PropertyMatches" subscript
Allows user to jump to the leading character of a property more easily
• Fixed: nth selection (separator "|" was wrong!)
• Fixed: Resetting the form did not work under specific circumstances
v0.9
• Added: Javascript "onkeydown..." to submit form on enter while in drop-down fields
• Changed: Paper folder (now: <xypaper>)
v0.8
• Changed: Resetting the form should be more reliable (unset removed)
• Fixed: Using paperfolders requires "<crlf>" delimited entries
v0.7
• Added: Support for multiple AND combined search patterns
v0.6
• Changed: Create html option list via a loop for "Match method"
• Changed: Renamed and reordered a few options
• Added: Exit with status message (nr. of items or if no matches are found
• Removed: Leading character for match method
v0.5
• Added: Property matching (XY build-in and customs)
• Added: File extension matching (not remembered across sessions)
• Added: "Reset" button (restores defaul settings)
• Changed: Button "Search" is now "Select"
• Changed: Reverted from "<crlf>" to "|" as a separator
• Changed: Renamed a few permanent variables
• Changed: Pattern separator for random & nth from "|" to ":"
• Changed: Match method got leading characters for quick selecting
• Changed: Local variable names for subscripts
• Removed: Tag matching (is now done via properties)
v0.4
• Added: Options: In-/exclude folders | Use (not use) paperfolders
v0.3
• Fixed: Shortened "Every nth item" code
• Fixed: urldecode() was replacing spaces with "+"
• Fixed: "else if" statements (must be "elseif")
• Added: Match DOS expression
• Added: Form remembers it's last state
v0.2
• COMMENT: Initial version
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Better file / folder selector

Post by highend »

v0.3 posted. Changelog in post nr. 2, download at the end of the first posting...

Another checkbox for including or excluding folders could be useful, right?
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Better file / folder selector

Post by bdeshi »

Yep.
Please do consider allowing us ( :whistle: ) to make selections instead of PF.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Better file / folder selector

Post by highend »

Please do consider allowing us ( :whistle: ) to make selections instead of PF.
Done. v0.4 is out...

No more updates till sunday evening / monday morning
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

Stef123

Re: Better file / folder selector

Post by Stef123 »

Thank you highend,
very useful, very comfortable, very one-stop-get-it-right-on-first-try compared to my multiple-steps closing-in approach.

I am a heavy user of dialogs like FilterExtensions, ExternalSearch, etc.
Been trying to figure out your HTML-dialog, its scaffolding behind the stage, but it's too heavy for me to lift. How would I integrate something like this:

Code: Select all

selfilter inputselect("Choose The File Types To Select:", formatList(report("{Dir |*.{Ext}}|"), "dents"), "|", 2, , , , "Select By Type");
I am too lazy to look up where I got it from - apologies to the author. Is there a way to merge that into BetterFileSelector?

OT (but related): At first glance the scripting department seems to target code-liners only, but I found so many ready-to-use gems in here that I wonder: Wouldn't it make sense to have a central repository for all things "interface and dialogs"? To reassure those newbies who expected a bit more click+tick dialogs out of the box.

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Better file / folder selector

Post by bdeshi »

That script snippet allows selecting by extension, Better FileSelector allows that too, only it doesn't provide a list of selected extensions, and honestly I think it doesn't really have to.

Choose "End With" from the "match method" dropdown, check "Incl. Ext" and enter the needed extension with or without the dot.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Stef123

Re: Better file / folder selector

Post by Stef123 »

Thanks Sammay,
Yes, I realize I could simply enter an extension manually. But often my mind is bound up in other things. Lacking dual-core processing, my brain then abandons the main thread and starts thinking about syntax and what the heck was the extension for Adobe Color Swatches? .aco? .ase? Both are correct, which one is the old format again? Not to mention .asv (selective color), .acv (curves), .alv (levels) ...

I will remember it immediately once I see it in front of me. Recognition is a lot easier than "Active Recall". Sure, I could key in "a??" or maybe "a*" - but that would select the whole bunch. Unless I use up even more human CPU cycles constructing RegEx.

Or I could run #385, make a mental note, then run BetterFileSelector .... :wink:
SammaySarkar wrote:it doesn't provide a list of selected extensions, and honestly I think it doesn't really have to.
Didn't mean to preach the gospel. Just asking on my own behalf whether it's posssible to adapt the script to my needs.
Do you know of any resources or guidelines how to create HTML-dialogs for XY?

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Better file / folder selector

Post by bdeshi »

Your posts often generate smiles... :kidding:
Just asking on my own behalf whether it's posssible to adapt the script to my needs.
yes, of course!

And, here's an excellent SC html primer by Stefan.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

fogg
Posts: 32
Joined: 15 Jul 2014 16:13
Location: Going around the World

Re: Better file / folder selector

Post by fogg »

I needed something like this, many thanks to @highend! :appl: :appl: :appl:
I wish it support file's properties. For example I want to select some music files with the same genre.
s404:signature not found.

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Better file / folder selector

Post by highend »

v0.5 posted...
Is there a way to merge that into BetterFileSelector? (about file extensions)
Done

But...
The setting for the selected file extension will not be remembered across sessions! Im unsure
if this should really be changed...
I wish it support file's properties
Done

Remark:
Use "p - Match property" in the first drop-down field
AND
either "<custom>" or one of the other inbuild ones (but not <property>^^)

If you use "<custom>", use this syntax:
<property>:<search pattern>
E.g. (bad example):
type:mp3

To show all existing properties for a file, use e.g.: http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=7423 (the v3 version)

With the integration of property support it's even more powerful now...
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Better file / folder selector

Post by bdeshi »

:appl: :appl: :appl:
You know, it can get even better, with multiple filters at once: pattern of EXTension AND Begins with .. AND ends with AND ... :biggrin:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Better file / folder selector

Post by highend »

You know, it can get even better, with multiple filters at once: pattern of EXTension AND Begins with .. AND ends with AND ...
Too complicated (how do you want to add fields on demand to the form, what about sizing / scrolling, what about combining all of them (which would require people to use correct parenthesis if an OR is used), etc.?) and most of these (simple) filters can be done by using the regex matching method anyway.

E.g. match method = "r - match regular expression" and ext = mp3
Input:
^adele.*?rain\.\w+$
Et voilà...
Adele - Set Fire To The Rain.mp3
got selected... :)
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

fogg
Posts: 32
Joined: 15 Jul 2014 16:13
Location: Going around the World

Re: Better file / folder selector

Post by fogg »

Wow! It's perfect now!
:biggrin: :appl: :appl: :appl: :appl: :appl: :biggrin:
:appl: :biggrin: :biggrin: :appl: :biggrin: :biggrin: :appl:
s404:signature not found.

highend
Posts: 13033
Joined: 06 Feb 2011 00:33

Re: Better file / folder selector

Post by highend »

v0.6 posted

A few minor changes here and there...

I could probably allow multiple searches (done in the pattern input) e.g. by:
Unbenannt.png
Unbenannt.png (9.66 KiB) Viewed 7390 times
"::" would be the delimiter (a single : is already taken for property searches).

The example would (hopefully obviously) select all files containing
png and jpg...

Is there a strong demand for this feature (only AND searches would be supported)?
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

Post Reply