Can I use a command id in a script for a Visual filter ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Can I use a command id in a script for a Visual filter ?

Post by Ysl »

Hi

I would like to use the visual filter 02 in a script.

Is there a command id for each visual filter that I can use and if yes, where do I find them ?

If no, is there another way of using a Visual Filter in a Script ?

Thanks

Muroph
Posts: 561
Joined: 21 Aug 2007 16:13

Re: Can I use a command id in a script for a Visual filter ?

Post by Muroph »

you can use the command

Code: Select all

filter [pattern]
to set/unset a visual filter.

in this specific case you could use

Code: Select all

filter "02";
My shared scripts:
TeraCopy Integration, Tag Manager, Comments Menu, Text Replacer, Image and Media Tools, Checksum Calculator, Video Calculator
only 5 URLs are allowed on the sig...

Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Re: Can I use a command id in a script for a Visual filter ?

Post by Ysl »

Thanks for the Filter command I didn't knew of !

But in fact, what I am looking for is to use the "Filter" command whit the same result as the visual filter NUMBER 02 (and not the text 02). Sorry for not having been more clearer.

So I would like a filter in a script that act like the visual filter number 02 which is the music filter (.mp3;.wav; etc)...

My visual filter number 03 is picture filter and so on

Thanks for your help !

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Can I use a command id in a script for a Visual filter ?

Post by Stefan »

Ysl wrote:to use the "Filter" command whit the same result as the visual filter NUMBER 02
You mean an script command to use as filter what is on position 02 at "Tools > List Management > Visual Filters" ?
This list is dynamic and will alter over time, so this is no good idea.
Anyway, you could use
getkey(key, section, [INIfile])
getkey("2", "mruVisualFilter");

Try this in address bar:
::msg getkey("2", "mruVisualFilter");

So an script would look like
$filter = getkey("2", "mruVisualFilter");
filter $filter;


But better would be to copy&paste this filter to an filter [pattern] command as Muroph has mentioned.
Because position 2 in [mruVisualFilter] could be something different tomorrow.

Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Re: Can I use a command id in a script for a Visual filter ?

Post by Ysl »

Thanks for your answer !

I finally used "filter <|*.flac|*.wma|*.ogg|*.wav|*.m4a|*.mp3|>" which work great but I would like to ask one more thing :

How to apply this only to files ?

I have a folder "Music mp3" which appear when I apply the filter...strange because the "." in ".mp3" is not present in the folder name...

Thanks again !

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Can I use a command id in a script for a Visual filter ?

Post by Stefan »

Ysl wrote:
I finally used
"filter <|*.flac|*.wma|*.ogg|*.wav|*.m4a|*.mp3|>"
which work great but I would like to ask one more thing :

How to apply this only to files ?
Is this the syntax to use?
filter <| | |>
(i miss this syntax for more then one filter in the help)


Then try
filter <|"*.flac"|"*.wma"|"*.ogg"|"*.wav"|"*.m4a"|"*.mp3"|>

since the dot is used as an concatenation.
So "*.flac" means: "*" + "flac", in other words: "<all signs>" + "flac"
where the quoted "*.flac" means: use the dot literally as sign, in other words: "<all signs>" + "." + "flac"

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

Re: Can I use a command id in a script for a Visual filter ?

Post by admin »

There is no problem with the dot when it is within quotes.
To exclude folders prefix "!\|".

E.g. this shows all files starting with D or E or ending with .TXT:

Code: Select all

filter "!\|d*|e*|*.txt";

Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Re: Can I use a command id in a script for a Visual filter ?

Post by Ysl »

Thanks again !

filter <|"*.flac"|"*.wma"|"*.ogg"|"*.wav"|"*.m4a"|"*.mp3"|> works perfectly !

Ysl

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

Re: Can I use a command id in a script for a Visual filter ?

Post by admin »

Ysl wrote:Thanks again !

filter <|"*.flac"|"*.wma"|"*.ogg"|"*.wav"|"*.m4a"|"*.mp3"|> works perfectly !

Ysl
:? What are you doing wiht these < and > ? These are not part of the syntax. :? And as I said: you don't have to quote each individual pattern.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Can I use a command id in a script for a Visual filter ?

Post by Stefan »

admin wrote:
Ysl wrote:Thanks again !

filter <|"*.flac"|"*.wma"|"*.ogg"|"*.wav"|"*.m4a"|"*.mp3"|> works perfectly !

Ysl
:? What are you doing wiht these < and > ? These are not part of the syntax. :? And as I said: you don't have to quote each individual pattern.
This was also suspect for me :lol:

And i was wrong with my thinking in my last post above regarding the quoting and the dot.

Don is right,
It should be:
filter "*.flac|*.wma|*.ogg|*.wav|*.m4a|*.mp3";

But this still shows folders like "Music.MP3" too. Of course i may say now.

So right here is:
filter "!\|*.flac|*.wma|*.ogg|*.wav|*.m4a|*.mp3";


I missed the syntax for more then one pattern in the help
but i can find them in the Ctrl+J -dialog.
But this "excluding folders"-trick is missing there too.

Ysl
Posts: 158
Joined: 03 Jan 2007 22:22

Re: Can I use a command id in a script for a Visual filter ?

Post by Ysl »

What are you doing wiht these < and >
Because i saw in the XYWiki "Filter <pattern>" and because I'm a stranger to scripting !

Anyway I now use your filter "!\|*.flac|*.wma|*.ogg|*.wav|*.m4a|*.mp3"; which is oerfect

Thanks again

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

Re: Can I use a command id in a script for a Visual filter ?

Post by admin »

Stefan wrote:I missed the syntax for more then one pattern in the help
but i can find them in the Ctrl+J -dialog.
But this "excluding folders"-trick is missing there too.
Just added it.

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

Re: Can I use a command id in a script for a Visual filter ?

Post by admin »

Stefan wrote:I missed the syntax for more then one pattern in the help
The Help is okay:
Set Visual Filter

Control what you see by stating simple wildcard patterns like *.txt. The Visual Filter is per-tab and, of course, saved between sessions. The current filter is displayed on the tab headers.

By factory default, Visual Filters will not persist across folders within the same tab; in other words, a Visual Filter is automatically cancelled when you change the location within the same tab. Tip: The context menu of the Visual Filter toolbar button contains a toggle Persist Visual Filters Across Folders where you can change this behavior.

You can state an unlimited number of wildcard patterns separated by ";" (logically treated as OR). Further you can use the wildcard "#" for any single digit (0-9). Visual Filter pattern matching is not case-sensitive: a=A.



Note that you can separate Visual Filters by "|" as well, not only by ";". The | has priority of over ; so using | you can filter items containing the ";" characte:

Desktop|;|, = List all items containing ";" or ","

If you state only one pattern and this pattern contains a ; then you have to add another dummy | to avoid that the ; is treated as separator:

Desktop|;| = List all items containing ";"

Desktop|;a| = List all items containing ";a"

Desktop|"*; *"| = List all items containing "; "



A leading ! (excalamation mark) will invert the filter, i.e. show only items *not* matching any of the patterns. If you want to show items starting with "!" you have to escape it with "\":

Examples:

a*;b* -> show all items starting with "a" or "b".

!a*;b* -> hide all items starting with "a" or "b".

\!a*;b* -> show all items starting with "!a" or "b".



You can define a filter to apply only to files but show all folders. Simply prefix "\|" to the pattern(s). For example:

\|*.txt -> show only *.txt files and all folders

\|!* -> show all folders and no files

To hide all folders simply prefix "!\|" to the pattern(s). For example:

!\|*.txt -> show only *.txt files and hide all folders

!\|* -> show all files and no folders

You can also define a filter to apply only to folders but show all files. Simply prefix "*|" to the pattern(s). For example:

*|a* -> show only folders beginning with "a" and all files

*|!* -> show all files and no folders



You can also define a caption for each Visual Filter. Simply prefix a quoted string followed by at least one space to the filter:

"Images" *.gif|*.png|*.jpg

"Items ending with g" >g$

The tab captions will show only the (unquoted) caption of a Visual Filter with caption.



Note that Visual Filters in combination with tabs allow you to show completely different listings ("filtered views") of the same location. You could for example have a tab "DLLs" (Visual Filter set to *.dll) and and tab "OCXs" (Visual Filter set to *.ocx) and have both pointing to Win\System32.

If a Visual Filter is on, the item count on the statusbar tells you the total number of items, and it does it in blue (or whatever you set the Marked Color to) as a further indication that a filter is active and effective.

Shortcut: Ctrl+J

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Can I use a command id in a script for a Visual filter ?

Post by Stefan »

admin wrote:
Stefan wrote:I missed the syntax for more then one pattern in the help
The Help is okay:

Set Visual Filter
Oh, from where came this from? :D

1.) we talked about SC Filter, there the info is missed. At least (as i see now) an link to Set Visual Filter

"Advanced Topics > Scripting Command Reference"
filter

Define a Visual Filter or remove any existing Visual Filter.

Syntax
filter [pattern]
pattern: The Visual Filter to apply to the List. If empty or missing any existing Visual Filter is removed.

Examples

filter "*.txt"
Show only *.txt files.

filter
Show all files.
See "Set Visual Filter" for more about the syntax.


2.) This "View Menu" side (from which "Set Visual Filter" is an sub-topic) has no item in the content list on the left of the help file.
We can only find this by using "Find" or "Index" by accident. Or if someone point use to that.

I wonder now what else i have missed from the help, because usually i use the "Content" side to see what is in the help.

Do you still search an maintainer for the help file?

.

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

Re: Can I use a command id in a script for a Visual filter ?

Post by admin »

Stefan wrote:2.) This "View Menu" side (from which "Set Visual Filter" is an sub-topic) has no item in the content list on the left of the help file.
We can only find this by using "Find" or "Index" by accident. Or if someone point use to that.

I wonder now what else i have missed from the help, because usually i use the "Content" side to see what is in the help.

Do you still search an maintainer for the help file?

.
Please explain again.

No, not anymore. I now have this great help software.

Post Reply