Gathering image metadata

I wonder if there is VB guru out there who can help me with a VB problem.

I want to be able to select an image or a group of images and gather the image metadata field SUBECT into a string variable. I have searched the documentation and the best I have come up with is that I probably need to use DOpus.FsUtil and imagemeta in some way.

Unfortunately that is way outside my programming skills. Is there anybody who could point me in the right direction?

What do you want to do with it once it's in the variable?

It's good to describe the whole plan so solutions that won't work can be avoided.

I want to take the contents of the variable and use it to populate and entry in a VB form.

Scripts (JS & VBS) Snippet: Enumerating files and metadata tags shows one way to get metadata out of files, but I'm not sure if it will be the best way as we still only have a very small picture of what you're aiming to do overall.

It is interesting to follow the logic of this code, but it does not help much as on every image I try it on it tells me there are no tags, when I can see that there are indeed metadata entries fro all the files.

Basically what I need is VB snippet that will let me extract data from the Author, Copyright,Imagedesc,Subject and Title fields and store them in variables that I can later load into a form.

Any help would be much appreciated

Here's an example of how to do it if you are looping through the selected files in the current window:

Option Explicit Function OnClick(ByRef clickData) Dim selItem, imageData For Each selItem in clickData.func.sourcetab.selected Set imageData = selItem.Metadata.image DOpus.Output "Author: " + imageData.mp3artist DOpus.Output "Copyright: " + imageData.Copyright DOpus.Output "Description: " + imageData.imagedesc DOpus.Output "Subject: " + imageData.Subject Next End Function


Many thanks Leo.

Quick JS variant here..
This thread with the VBScript code still pops up when using search engines (and no JS example for some reason, this should fix this.. o).

function OnClick(clickData){
	for(var i=0;i<clickData.func.sourcetab.selected.count;i++) {
		var selItem = clickData.func.sourcetab.selected(i);
		var imageData = selItem.Metadata.image;
		DOpus.Output("Author     : " + imageData.mp3artist);
		DOpus.Output("Copyright  : " + imageData.Copyright);
		DOpus.Output("Description: " + imageData.imagedesc);
		DOpus.Output("Subject    : " + imageData.Subject);
	}
	DOpus.Output("Done.");
}
1 Like