filter script

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

:info: Please include the following information:
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
Post Reply
graham
Posts: 457
Joined: 24 Aug 2007 22:08
Location: Isle of Man

filter script

Post by graham »

If this isn't a bug then it is confusing


Using the VF without script in normal use to get a filter for say *.txt and *.exe seems to require VF set as *.txt;*.exe

eg C:\Program Files\XYPlorer|*.txt;*.exe
gives me what I wante (seems wrong to me)

Same used in a script does not give this result

Is this a bug or is an incompatability?

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Re: filter script

Post by jacky »

graham wrote:eg C:\Program Files\XYPlorer|*.txt;*.exe
gives me what I wante (seems wrong to me)
Why does it seem wrong ? It's exactly what it should be, and as been ever since VF were made I believe.

And what doesn't work in script ? works fine here, eg: ::filter "*.txt;*.exe" (with 6.80.0070, new syntax)
Proud XYplorer Fanatic

graham
Posts: 457
Joined: 24 Aug 2007 22:08
Location: Isle of Man

Post by graham »

graham wrote:
eg C:\Program Files\XYPlorer|*.txt;*.exe
gives me what I wante (seems wrong to me)

Why does it seem wrong ? It's exactly what it should be, and as been ever since VF were made I believe.

And what doesn't work in script ? works fine here, eg: ::filter "*.txt;*.exe" (with 6.80.0070, new syntax)
Thanks you have sorted it out for me.

What seems wrong is the use of an end of command ; being used within a normal filter statement (in this case) and then the need to use quotes for a script to contain them. I think that is not the best way and looks like a fudge. Possibly the use of ; in the visual setting should be changed to some other so that ; is reserved for scripting command separation.

Ok you can have the rules to obey but this just seems to be one rule that could be avoided.

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

Post by admin »

graham wrote:
graham wrote:
eg C:\Program Files\XYPlorer|*.txt;*.exe
gives me what I wante (seems wrong to me)

Why does it seem wrong ? It's exactly what it should be, and as been ever since VF were made I believe.

And what doesn't work in script ? works fine here, eg: ::filter "*.txt;*.exe" (with 6.80.0070, new syntax)
Thanks you have sorted it out for me.

What seems wrong is the use of an end of command ; being used within a normal filter statement (in this case) and then the need to use quotes for a script to contain them. I think that is not the best way and looks like a fudge. Possibly the use of ; in the visual setting should be changed to some other so that ; is reserved for scripting command separation.

Ok you can have the rules to obey but this just seems to be one rule that could be avoided.
Well, using quotes to handle those cases was more or less the whole point in changing the syntax of scripting. I don't know what a fudge is, but I know that quotes in this context are the standard way.

graham
Posts: 457
Joined: 24 Aug 2007 22:08
Location: Isle of Man

Post by graham »

Well, using quotes to handle those cases was more or less the whole point in changing the syntax of scripting. I don't know what a fudge is, but I know that quotes in this context are the standard way.
Admin:

I fully understand. I personally hate using quotes in code (other than exceptional situations or for text). What I meant was that if ; was only used as an end of command then where currently used in other contexts it could be changed to another symbol and possibly avoid the need for quotes.
Filter was one I used and it seems more natural for , to separate parameters.

I appreciate you cater for all complexities but this is how I see it.

fishgod
Posts: 231
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Post by fishgod »

When you search for a seperator for a filter-pattern a "," would be as bad as ";" because both of the characters can be part of a filename.

e.g. Using a filter like *,* to find every entry with a , in the name instead of filtering files with a special extension.
The best solution for this case would be to use a character which de facto can't be part of a filename!
There we have theese chars: \, /, :, *, ?, ", <, > and |
But *, ?, /, \ and " are allready reserved for special purposes, so we have to choice between :, <, > and |. I think a : is to ugly and < and > doesn't make a lot of sense so the best choice (for me) would be to use the | as delimiter between filenamepattern.

Than we can do: ::filer *.foo|*.bar or ::goto C:\|*.bat|*.sys

Little example with I can't solve with 6.90.0071:
Filelist:
1. foo.jpg
2. bar.jpeg
3. foobar.jpg;jpeg
4. foobar (jpg,jpeg)

Trying to get only the foobar.jpg;jpeg-item:
::filter *.jpg;jpeg //returns item 1 and shows me that "jpeg" is not a valid script command. Exactly what I expected
::filter "*.jpg;jpeg" //returns all the four items, not very nice
::filter """*.jpg;jpeg""" //return only item 1, don't know why
I don't see any solution for this here...

Ok, lets try to get the foobar (jpg,jpeg)-item:
::filter *.jpg,jpeg* //filter only for *.jpg all after the , is probably interpreted as second nonexisting parameter?
::filter "*jpg,jpeg*" //quoting works fine here (:
When you now use a , as seperator than we have the same problem as above here...


The existing of characters in filenames is a general problem, that should not be underrated!
Operating System: Win10 x64 / Win11 x64 / almost allways newest XY-beta
totally XYscripting-addicted

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

Post by admin »

fishgod wrote:Than we can do: ::filer *.foo|*.bar or ::goto C:\|*.bat|*.sys
I would agree to allow "|" as an alternative pattern separator. I don't see a problem with it, and, as you say, if the filename contains ";" there is no way to filter it using ";" as a separator.

BTW, Multiple Location Search in Find Files also allows these two separators, | and ;. A nice parallel...

Post Reply