GP SoftwareTwitter
Opus FAQsManualCommandsObjects

'Multi-line' dialog losing picture metadata



I’m using a script to bring the dialog box up, so that I can fill the ‘Description’ metadata for my pictures more easily than in a single-line DO metadata panel. The edit control on the form is of a ‘multiline’ type and I can indeed put many lines of text there. But when the data is written to the file only the first line is saved, others are lost. It doesn’t make a difference if a line break was forced by ENTER key (carriage return) of SHIFT-ENTER (line break).

I noticed that other programs, which allow for multi-line entry (like Lightroom) save it with line-breaks inside the text, so, when viewed in programs that can read them they are shown as multiline, and when viewed in DO they are shown as one long line, with no breaks. How to make DO to write all lines to the file?


How is your script taking the text and adding it to the tags?

If it’s adding them to an Opus command line, having line feeds in the command line may not work (it is a command line after all).

Some commands/arguments let you encode linefeeds as \n but only a handful support it.

If needed, you could have your script run an external command line tool to update the tags, assuming a dedicated tool will be more flexible than Opus’s built-in Set META command.


I don’t think I’ll bother, as there is a perfect solution outside DO, but for good order’s sake, this is what I use in my script:
The current value of the meta tag from the file is read into ‘caption’:
caption = imageData.imagedesc
… then it is displayed in the dialog box’s ‘edit control’ called ‘dcaption’:
dlg.control("dcaption").value = caption
… then the user is allowed to make changes - the new contents of the field is captured into ‘captiona’:
captiona = dlg.Control("dcaption").Value
… If the new value (‘captiona’) is different from the one originally read from the file (‘caption’), then the new value is written into the file (into metadata field called ‘imagedesc’):
If captiona<>caption Then ClickData.Func.Command.AddLine("SetAttr META ""imagedesc:" & captiona & """") End If