This script add-in is deprecated. Use DO Meta Wizard Command instead.
Find and Replace Metadata is a Directory Opus script command that simplifies the task of editing metadata allowing you to modify them by specifying the content to find and their replacement in the selected metadata properties.
Its main features are:
- Support for almost all metadata properties editable by Directory Opus.
- Easy selection of metadata properties to edit, with search support.
- Support for deleting metadata properties based on search criteria.
- Support for regular expressions, ignoring diacritics, whole words and match case.
- Extended file information can be used in the Replace field, with support for most DOpus metadata insertion codes (e.g. {file}, {mp3artist}, etc.), similar to Advanced Replace dialog.
- Preview of changes to be made for each file (in the Files tab).
- Easy to use, fully multilingual UI (in all languages supported by DOpus).
- Automatic creation of logs, so that you can track the changes made by the command and even undo them.
IMPORTANT: READ BEFORE PROCEED
This script is provided "as is" and without warranty of any kind.
It has been made during my spare time and has not been extensively tested, so it is presented as a testing version and should be used with extreme caution.
The user assumes full responsibility for its use and understands that the author is not responsible for possible failures or loss of data.
It is strongly recommended that files be backed up before using them with this script.
Any feedback on possible improvements or bugs is welcome.
BEFORE YOU BEGIN
- Re-read the notice above.
- Read all the info about SETATTR information on this page. It is important that you know what kind of values (text, numeric, etc.) each property uses before you start playing with this command.
HOW TO INSTALL
Download the file below. Then run Prefs SCRIPTINSTALL
and select the downloaded file.
IMPORTANT: Needs at least v13.0.54
v1.0.7: Find and Replace Metadata.opusscriptinstall (15.3 KB)
OPTIONS
In the Script Management window, select Find and Replace Metadata
and click in Edit button.
- after_actions: Choose among several options to be performed after the command has been completed.
- debug: Useful if you have some problems with results obtained and want to see the command line generated by the script. You can select the log level as OFF, ALL or WARNING.
- doc_exts: File extensions that will be considered as "true" documents (e.g. can have Author, Subject, etc).
- logs_path: Folder path where log files will be stored.
USAGE
You can use Find and Replace Metadata with the selected files in the source Lister, by simply invoking it with FRMeta
.
Other arguments are:
COMMAND ARGUMENTS
ARGUMENT | TYPE | DESCRIPTION |
---|---|---|
CASE | /S | Start the dialogue window with 'Match Case' checked |
FILES | /K/M | Specifies the name of the file or files to use with this command. If you don't provide this argument the command operates on all selected items in the source Lister. |
FIND | /K | Set Find edit control content when starting the dialog window |
NODIACRITICS | /S | Start the dialogue window with 'Ignore diacritics' checked |
NOEMPTY | /S | Disables edition for those metadata properties that are originally empty |
NOGLOBAL | /S | Find and replace only applies to the first match. (disables 'g' flag in pattern) |
NOMULTILINE | /S | Disables multiline mode match (disables 'm' flag in pattern) |
OPENINFILES | /S | Lets you open the dialog with the Files tab active |
PROPERTIES | /K | Set metadata properties to edit when starting the dialog window |
REGEX | /S | Start the dialogue window with 'Regular expressions' checked |
REPLACE | /K | Set Replace edit control content when starting the dialog window |
WHOLEWORDS | /S | Start the dialogue window with 'Whole words' checked |
The script will generate 2 files in the folder of your choice (or in /profile\DOpus_F&RLogs
) if any metadata changes are made. The "Files" file contains the SETATTR commands run by the command.
The "Backup" file contains the SETATTR commands needed to undo the changes made (that is, using the original values). You can copy these commands (e.g. to a button) and run them if you wish.
NOTES / FURTHER DEVELOPMENT
-
Your feedback is important for possible improvements and bug fixes.
-
Please refrain from using it on 300,000 files at once for the time being.
-
If the replace value for a meta property is empty (''"), after expansion, that property won't be changed. In order to delete a property, use the
{empty}
keyword in the Replace edit control. e.g. If you want to delete a property regardless of their content:- Select the desired properties you want to delete from the list.
- Use in Find edit control :
.*
- Use in Replace edit control :
{empty}
- Check Regular Expressions
-
Yes, with this tool you can also set the value of a property based on other metadata values. e.g. set the comment as a combination of artist, album and title values.
-
Yes, it is deliberately not being able to set creation, modification and access dates. I think DOpus already has many ways to do that. But you can use those values (as extended information) in other supported properties.
-
It is in my plans to support the same pattern matching syntax used by Directory Opus (this one) when regular expressions is unchecked, although I haven't had enough time to do it myself. I think that there is no quick way to do it, the ideal would be to use Wild object and that this has a way to return an equivalent pattern that can be used with RegExp, or that there exists a method to make replacements using the pattern returned by Wild (e.g. Wild.replace(pattern,replace)).
-
I didn't set hotkeys. I forgot, sorry. But you can give ideas on which ones to add.
KNOWN ISSUES
- The command does not perform any check on the data types to be written and their compatibility with the property you intend to write to, so again, use it carefully.
- The submenus when inserting extended information sometimes appear far away from the Replace edit control, this is expected. AFAIK you cannot create actual submenus and they are always displayed at the current mouse coordinates.
- The fact that the find and replacement pattern are multiline is to make it easier to enter and read the data, it does not mean that the values entered will be multiline (line breaks are replaced by a space).
- Some files are recognised as Documents, even if they have only 1 or 2 general values of this type. And if you try to write a property not allowed in these files, DO will show an error. To avoid that, use
doc_exts
in configuration to define all the extensions you want to consider as "true" documents. If a file recognized as document doesn't have their extension registered in there, ONLY those properties already existing can be edited (like anNOEMPTY
implicit for those files). - In the Files tab, at the top of the property list of the selected file, its full path and its filetype group are displayed. When the path is too long and does not fit on one line, the full information is not displayed. Solved by resizing the dialog a bit (seems to be a problem with self-sizing controls).
- Some properties cannot be edited with this command, because they require a value that has a specific meaning. I will consider adding support for these properties in the future if there is a request.
List of unsupported properties
- Contrast
- Exposure program
- Flash
- Metering mode
- Rotation
- Saturation
- Scene capture type
- Sharpness
- White balance
- Compilation
- Cover art
CHANGELOG
v1.0.7 (2024-01-18)
- Added
doc_exts
in script configuration to define file extensions that are going to be considered as "true" documents (e.g. can have Author, Subject, etc).
Complete changelog
v1.0.6 (2023-12-26)
- Improved search functionality for metadata preview in Files Tab. You can now configure search options from the same dialog (match case, regular expressions, ignore diacritics and whole words are supported).
- Minor changes in UI.
v1.0.5 (2023-12-21)
- Several changes in UI. You can give feedback if you like/dislike those changes.
- Added new arguments:
PROPERTIES
,CASE
,NODIACRITICS
,REGEX
,WHOLEWORDS
,REPLACE
andFIND
, which allow to pre-fill the dialogue window. - You can now change the value of Global and Multiline replacement on runtime.
- Properties can now be removed, using the keyword
{empty}
in the Replace edit control. - Added some missing editable properties.
- Added a fix for files recognised as Documents, which were showing an error when trying to write a property they cannot have (read KNOWN ISSUES above).
v1.0.4 (2023-12-20)
- Fixed an issue with the progress window not hiding.
- Fixed some extended keywords being messed up.
- Now the new values are calculated only when needed.
v1.0.3 (2023-12-19)
OPENINFILES
argument lets you open the dialog with the 'Files' tab active.- Now is possible to check/uncheck files, to decide on runtime on which files the changes will apply.
- Small changes/fixes in UI.
- Changed properties in Files tab now are more visibles.
- Code cleanup and overall script file reduction.
v1.0.2 (2023-12-18)
- Minor update to get in line with some fixes in v13.0.53.
v1.0.1 (2023-12-17)
- Revamped UI, now you can see all keyword values available for each file.
v1.0.0 (2023-12-10) : Initial release