Dynamic setting of metadata

Relative newcomer to an attempt at this kind of sophistication in a custom DOpus command here…

In the course of processing many digital music files, and scans of the album artwork for them, I’ve more or less settled on a convention where I have files sorted into folders named as such:

<artist> - [<date>] <album title>

…and I use the following convention in naming the various scanned artwork image files:

[<edition year> <label> <catalog #>] <image/part description>

<edition year> refers to the release year of that physical edition of the album, not the original album’s release year. For example, the Beatles’ “Abbey Road” was originally released on 1969-09-26 (<date> in the folder name), but my scans are from the 2009 remastered edition (<edition year>)

I’m trying to set up a custom command that will use the folder name (for now, obtained via typed string input from me), then inject that input, followed by the filename(s) of selected image file(s) into the metadata fields for TITLE, SUBJECT, DESCRIPTION and COMMENT, and also inject a date, input separately by me, into the DATE TAKEN field. Some examples of what I want to see in TITLE/SUBJECT/DESCRIPTION/COMMENT:

“Beatles, The - [1969-09-26] Abbey Road [2009 Apple 0946 3 82468 2 4] Front”
“Beatles, The - [1969-09-26] Abbey Road [2009 Apple 0946 3 82468 2 4] Rear”
“Beatles, The - [1969-09-26] Abbey Road [2009 Apple 0946 3 82468 2 4] CD”
“Beatles, The - [1969-09-26] Abbey Road [2009 Apple 0946 3 82468 2 4] Booklet 01+16”

My first attempt at doing all this looks like:

@ifset:$pre
@ifset:else
@set pre={dlgstring|Enter prefix to used for Title/Subject/Description/Comment}
@set taken={dlgstring|Enter release date (YYYY-MM-DD)}
@ifset:common
SetAttr Meta "title:{$pre} {file$|noext}" "subject:{$pre} {file$|noext}" "imagedesc:{$pre} {file$|noext}" "comment:{$pre} {file$|noext}" "datetaken:{$taken} 00:00:01"

Based on my reading of the instructions for the command and modifiers in the DOpus help file, I expected this sequence to set the values of $pre and $taken ONCE, but perform SetAttr Meta using the fielname for each selected image file (obtained via {file$|noext}). Instead, it is using the filename from only the first selected image file and injecting it into the chosen metadata fields of all selected files. Is there something else I can do, or do I misunderstand the usage and capabilities of @ifset, @ifset:else and @ifset:common?

Also, I would ultimately like to refine this to where it automatically assigns the folder name to $pre, and extracts the date from the folder name for $taken, but it looks to me like the latter isn’t currently possible without scripting, which I don’t know enough about to tackle at this time. Can anyone confirm?

Are you familiar with javascript or vbscript or a similar scripting language?

If so, writing it using scripting would give you more control over how the command is built for each file.

It would also let you prompt for both strings in a single dialog, or do extra processing/validation on the inputs.

Not as familiar as I think I’d need to be, which is why I wrote “it looks to me like the latter isn’t currently possible without scripting, which I don’t know enough about to tackle at this time.”

Are you saying that I can’t do what I hoped to without scripting?

Anyway, I managed to refine my code a bit:

@set date={dlgstring|Enter release date:|{filepath$|..\..|nopath|noterm}}
SetAttr META "comment:{filepath$|..\..|nopath|noterm} {file$|noext}" "title:{filepath$|..\..|nopath|noterm} {file$|noext}" "subject:{filepath$|..\..|nopath|noterm} {file$|noext}" "imagedesc:{filepath$|..\..|nopath|noterm} {file$|noext}" "datetaken:{$date}"

Now, I do only have to deal with one dialog. But I still don’t understand why {file$|noext} doesn’t update the string to be injected into each file (which I think should also result in me getting a string dialog request for each selected file as well, as currently written). Does anybody know?

Apologies, I missed that line when I read the first post.

SetAttr META knows how to loop through the selected files itself, so the command-line is only built once, for the first file, and it then loops through all the files itself applying the command to them.

An easy way to work around things is by using dopusrt to run SetAttr as if it was an external command, where the command line will be re-built for each file:

@set date={dlgstring|Enter release date:|{filepath$|..\..|nopath|noterm}}
dopusrt /acmd SetAttr FILE {filepath$} META "comment:{filepath$|..\..|nopath|noterm} {file$|noext}" "title:{filepath$|..\..|nopath|noterm} {file$|noext}" "subject:{filepath$|..\..|nopath|noterm} {file$|noext}" "imagedesc:{filepath$|..\..|nopath|noterm} {file$|noext}" "datetaken:{$date}"

You may find that works well enough as it is, but if not let us know and we can turn it into a script which does things in a better way.

That does exactly what I need! Thank you!

By the way, I’m not sure if there’s somewhere else I should bring this up, but I’m not receiving email notifications for new replies to this topic, even though the page says “You will receive notifications because you created this topic.” I did receive email notifications for replies to a topic I started a few weeks back.

Thanks again.

The Site Feedback area is for this.

Emails from the forum seem to be working in general (I just sent a test one). The forum won't send notification emails if you visit the site and see the notifications first that way. It only sends them if you haven't logged in for a while. Other than that, check spam filters etc. in case the emails are getting swallowed.