DO Meta Wizard Command

Meta Wizard is a Directory Opus script add-in command that simplifies the task of editing metadata, allowing you to modify it by specifying a search pattern and replacing it in the selected metadata properties.

Master your files effortlessly as Meta Wizard swiftly finds and replaces metadata properties values in no time. Discover the magic of intuitive and efficient metadata search and replace!!!

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 pattern search using regular expressions, ignoring diacritics, matching whole words and case.
  • Extended file information can be used in the Replace field, with support for most DOpus metadata insertion codes (e.g. {file}, {date}, etc.), similar to the Advanced Replace dialog.
  • Preview the changes to be made for each file as you type.
  • Ability to make multiple changes and reuse the same window.
  • Easy to use, fully multilingual interface (in all languages supported by DOpus).
  • Automatic creation of logs, so you can track the changes made by the command and even undo them.
  • No interface mode, which allows you to make changes directly without showing the main window.

:warning: 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 command.
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 go to Settings / Scripts (or run Prefs SCRIPTINSTALL) and select the downloaded file.
:warning: IMPORTANT: Needs at least v13.1
v.0.9.1 Alpha : MetaWizardCommand.opusscriptinstall (18.4 KB)

OPTIONS
In the Script Management window, select Meta Wizard and click in Edit button.

  • debug : Logging level to be displayed. OFF to shows none. ALL to shows all the messages. WARNING to shows messages that may require your attention.
  • Logs Path : Folder path where log files will be stored.
  • After actions : Choose among several options to be performed after the command has been completed.
  • Doc Exts : File extensions that will be considered as "true" documents (e.g. can have Author, Subject, etc).
  • Dialog Mode : Select the dialog's UI you want to use. Currently you can choose between 3 modes:
    Preview List on Left :

    Preview List on Bottom :

    Preview List on Right :
  • Preview List max column width : Maximum column width in Preview List. 0 to always autosize.
  • Properties List max column width : Maximum column width in Properties Sheet List. 0 to always autosize.
  • Find : Hotkey for Find Edit Control.
  • Replace : Hotkey for Replace Edit Control.
  • Metadata Filter : Hotkey for Metadata List filter.
  • Properties Sheet Filter : Hotkey for Properties Sheet List filter.
  • Case sensitive checkbox : Hotkey for Case sensitive checkbox.
  • Regular expressions checkbox : Hotkey for Regular expressions checkbox.
  • Whole words checkbox : Hotkey for Whole words checkbox.
  • Ignore diacritics checkbox : Hotkey for Ignore diacritics checkbox.
  • Global replace checkbox : Hotkey for Global replace checkbox.

USAGE
You can use Meta Wizard with the selected files in the source Lister, by simply using MetaWizard.

The UI comes with 4 sections:

Pattern section : Lets you edit the search and replace strings. These values and the checkboxes below them are used to build the search pattern and its replacement.
In addition, the button allows you to insert references to other file properties in the replacement field, as well as a special keyword ({empty}) to clear the values in the selected properties in the Metadata List.

Preview section : Contains the Preview List, which is a list of all files used by this command. It also contains a column for each property selected in the Metadata List, showing the new calculated value in real time.
You can also select which files to apply the replacements to.
The number of pending tasks to be applied is displayed at the top.

Metadata section : Contains the Metadata List, which allows you to choose the properties on which to apply the search and replace. It has a filter for quick search. You can check/uncheck a property with its respective checkbox or by double clicking on it.

Property Sheet section : Contains a list of all properties (editable and not) for the file selected in the Preview List.
It also has a filter for easy searching. In addition, it allows you to apply certain filter settings by pressing the button.
Double-clicking on a property value activates the edit mode for the value (only useful for copying the selected value, it does not really edit anything).

The FIND, REPLACE, CASE, NODIACRITICS, NOGLOBAL, PROPERTIES, REGEX and WHOLEWORDS arguments allow you to prefill data in the UI, in the corresponding fields.

The Add and Apply buttons are activated when the Find and Replace fields have content and at least one property and one file are checked.
The Add button allows you to save in memory the changes currently made, and start a new replace task (NOTE : It does not make any changes to the files yet, for that is necessary to use Apply at the end).
The Apply button adds the current changes to the task list, and applies (saves the changes to the files) all pending tasks.
The Undo button is activated when there is at least one pending task. It allows you to undo the changes of the last saved task.

When using NOGUI, the main dialog is not shown, and values must be provided by the corresponding arguments (at least FIND,REPLACE and PROPERTIES must be present).

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 to revert them.

COMMAND ARGUMENTS

ARGUMENT TYPE DESCRIPTION
CASE /S Start the dialogue window with 'Case sensitive' checked
With NOGUI will be applied to the search pattern directly.
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.
With NOGUI will be applied to the search pattern directly.
NODIACRITICS /S Start the dialogue window with 'Ignore diacritics' checked.
With NOGUI will be applied to the search pattern directly.
NOEMPTY /S Disables edition for those metadata properties that are originally empty.
NOGLOBAL /S Start the dialogue window with 'Replace All' checked.
With NOGUI will be applied to the search pattern directly.(disables 'g' flag in pattern)
NOGUI /S Builds the pattern and applies the replace in the selected properties without showing the default UI
Must need that at least FIND, REPLACE and PROPERTIES arguments been used.
PROPERTIES /K Set metadata properties to edit when starting the dialog window. Current valid values are :
tags, rating, usercomment, 35mmfocallength, album, albumartist, aperture, artist, author, bpm, cameramake, cameramodel, category, comment, company, composers, conductor, copyright, creator, datedigitized, datetaken, digitalzoom, directors, discnumber, encoder, encodingsoftware, exposurebias, exposuretime, fnumber, focallength, genre, gpsaltitude, gpslatitude, gpslongitude, imagedesc, initialkey, instructions, isospeed, lastsavedby, lensmake, lensmodel, orientation, producer, producers, publisher, releasedate, shutterspeed, software, subject, subjectdistance, title, track, year

With NOGUI the replace will be applied to those properties directly.

REGEX /S Start the dialogue window with 'Regular expressions' checked.
With NOGUI will be applied to the search pattern directly.
REPLACE /K Set Replace edit control content when starting the dialog window.
With NOGUI will be used to replace pattern matches directly.
WHOLEWORDS /S Start the dialogue window with 'Whole words' checked.
With NOGUI will be applied to the search pattern directly.

GOOD TO KNOW

  • Meta Wizard is the spiritual succesor of my other script add-in Find and Replace Metadata.
  • The command will only try to write the properties that the file CAN have (e.g. it won't try to write album for a document file). So it's safe to choose mixed properties for the replacement.
  • The command, at the time of writing, only performs a check for some types of data (mostly numbers or properties that require a special syntax) to avoid unwanted behavior when actually setting the changes in the file. However, not all values are checked (dates por example), so again, use it carefully.
  • Please refrain from using it on hundreds of files at once when using the UI for the time being. Since the results are displayed in real time, there may be a delay due to the number of files.
  • 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}
      :ballot_box_with_check: Check Regular Expressions
  • Hotkeys can be set via Script Configuration.
  • 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.
  • For multi values properties, the command automatically skips those who are duplicates.
  • 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 an NOEMPTY implicit for those files).
  • 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
  • Saturation
  • Scene capture type
  • Sharpness
  • White balance
  • Compilation
  • Cover art

NOTES / FURTHER DEVELOPMENT

  • Your feedback is important for possible improvements and bug fixes.
  • Some strings in the UI are showed in English/Spanish (depending on DO current language). If you want to collaborate with translation to your language, please contact me via private message.

CHANGELOG
v0.9.1a (2024-02-04) :

  • Fixed error when using NOGUI.
  • Fixed error with Abort button when setting metadata.

v0.9.0a (2024-02-03) : Initial release

9 Likes

Powerful script, an all-terrain tool!!!

1 Like

A more than worthy follow-up to Find and Replace Metadata. I already have it installed. Well done, as usual.

1 Like

Update v0.9.1a (2024-02-04) :

  • Fixed error when using NOGUI.
  • Fixed error with Abort button when setting metadata.
1 Like

dear errante Thank you so much for the nice script. It's very useful to me. it's make DOpus more powerful. Great Job. Thanks Brother

1 Like

Fantastic script! Thanks

1 Like

Powerful script, does installing this mean I no longer need the Find and Replace Metadata script?

1 Like

I would say yes.