I meant that if you define and save a filter, you can then use that filter in a command. Not that commands can save filters (since they can't generate filters, I'm not sure what they would save).
You can create filters via the Find panel (Advanced tab), or anywhere else that shows the filter UI. e.g. Preferences / File Operations / Filters.
A Button "Filter on the Fly".
It go in the opus filter directory.
Create line by line a ofi/xml-file with the filtering options.
In this example "location match image or location match pic".
This can be adjusted and extended with other metadata fields.
Then apply the filter as argument for the select command.
All files with paths/location containing pic or image will be selected.
[code]<?xml version="1.0"?>
Filter on the Fly #newcommand
@externalonly @runmode:hide
set filter_dir_path="%appdata%\GPSoftware\Directory Opus\Filters"
cd %filter_dir_path%
What i actually wanted to do is an "exclude path" and an include path" filtering for flat-view.
And using the button above and making small changes, i created the "exclude path"-button.
So when man has flatview and some folders are not important and better be hidden, simply select at least one file and than click exclude path.
All other items from this location disappear.
Tested with FlatView mixednofolders.
The button do what i described, but i encounter one small problem with the creation of filter on the fly.
Each time when the filter is created, the hidding button apply the "old version" of the filter content.
I.e.:
i select "C:\path1\file1.txt" and click "exclude path" -> only this file disappears.
i select "C:\path2\file2.txt" and click "exclude path" -> the file "C:\path2\file2.txt" disappears and all files inside "C:\path1"
There is a "delay" or "asynchronism", so to speak.
Opus load the filter version sooner than i need.
How can i force Opus to reload the filter definition?
Are there modifiers that could be helpful?
What you're doing there is unsupported. There's no guarantee that Opus will notice direct changes to the XML config files at all except when it starts up. Sometimes those files are cached in memory.
That said, it might work without the @async there (not sure what that is doing there), or maybe with some kind of delay between writing the file and running the select command, or by writing the file in a different way (maybe the DOS echo command isn't flushing the changes to disk until the batch file completes or something).
In order to check the delay problem, I slitted the button in two buttons.
One for filter creation, and one for execution.
Problem was not solved.
I found out the problem is in the Clipboard COPYNAMES=path
The old clipboard content has been delivered. Not the actual one. There is a queue.
How can get the location path otherwise without clipboard?
This was a workaround for me. I don't like overwriting or adding content there with commands.
The {filepath} contains a Backslash, the filename and the extension.
I don't need them, but there are no modifiers, to get the location path only. Or?
I tried splitting filepath to path and file in batch cmd, but is was to ugly and was not working.
Not so ugly was powershell splitt-path command. But this mean dependency. It may works on old system, it may not.
I want to use internal opus commands only.
Please tell me how?
[quote="aDopusUser"]The {filepath} contains a Backslash, the filename and the extension.
I don't need them, but there are no modifiers, to get the location path only. Or?[/quote]
{filepath|..|noterm} will give you the parent of {filepath}, without the backslash on the end.
I was not happy with the dos-batch escaping of filenames. All not latin character an ampersand make some trouble.
Therefore i try to run a php-script for processing selected files, an creating filter on the fly.
I don't think those modifiers are supported with {allfilepath} or the other {all*} codes that output multiple filenames.
But since you're passing the filenames to php it should be easy to process them within the script. (You'd need to do that anyway to remove duplicate parent folders.)
By the way, you might want to use {allfilepath|filem|utf8} to pass the script the name of a temp-file containing the list of filenames, instead of passing the filenames directly, so that you don't run into command-line length limits. (I'm assuming utf8 is best for php, but there are other options for the encoding if needed.)