For Each f In clickData.func.sourcetab.selected
For Each tag In f.metadata.tags
If (tagString <> "") Then
tagString = tagString & "; "
tagString = tagString & tag
Else
tagString = tag
End If
Next
Next
I use this to get the tags out of an image file. Now I want to get the tags out of the image displayed in a viewer window. Naturally this only works with a Lister. How do I amend the code to do what I need?
For each f in clickData.func.viewer.current
For Each tag In f.metadata.tags
If (tagString <> "") Then
tagString = tagString & "; "
tagString = tagString & tag
Else
tagString = tag
End If
Next
Next
I had kinda figured that out, but gave up on it when it did not appear to work. Using this, the tagString variable is always empty.
Is "clickData.func.viewer.current" somethnig that needs or even works with a "for each" block?
To me this is not some kind of collection, so that may be why tagString is always empty (inner for-loop did not run)?
Try to insert some DOpus.Output("I'm here!") statements to see which lines get executed or skipped.
dim f : f = clickData.func.viewer.current
For Each tag In f.metadata.tags
If (tagString <> "") Then
tagString = tagString & "; "
tagString = tagString & tag
Else
tagString = tag
End If
Next
Next
Could I just trouble you with another question. What I have done is to create a button which opens a form that shows all the interesting metadata in a picture and allows me to change it without using the Opus metadata panel. The biggest advantage is that it is much more readable than the metadata panel and I can have a multiline caption input box.
The problem I have when I use it with the viewer is that I have to close the viewer, reopen it and select the next picture to get the button to work. It has me baffled.
Although the script works fine the first time. If I advance the viewer to the next image and run the script again it does not pick up any metadata from the the new image. (Although the script does pick up the file name).
It is as though the script somehow does not realise that the image has changed. If I close the viewer and re-open the new picture, the script works fine. Any idea what I am doing wrong?