Bug found - Metadata.Tags performing inconsistently

I believe I have found a bug. I'm having a bit of trouble retrieving tags from MP3 files. I'm using this code:

@script vbscript
Option Explicit

Function OnClick(ByRef ClickData)
Dim oFile, oFiles, oTags, Tag
Set oFiles = ClickData.Func.SourceTab.Selected_Files

For Each oFile In oFiles
	If UCase(oFile.Ext) = ".MP3" Then
		DOpus.Output "Count = " & oFile.Metadata.Tags.Count
		Set oTags = oFile.Metadata.Tags
		For Each Tag In oTags
			DOpus.output "Tag = " & Tag
		Next 'Tag
	End If
Next 'oFile

End Function

If I edit an MP3 file and add a tag to it, then run the code above, it works just fine. If I run the code again (without doing anything else), the Count is empty and no tags are displayed. After that point, it no longer works for that file until I modify the tags in the file. If I modify the tags again, then it will work for one run but no longer works on any subsequent runs.

Am I doing something wrong or is this a bug? I'm using Directory Opus 11.4.4 (beta) (64-bit) on Windows 8.

(Aside: You have @nodeselect at the top of the button, but that does not work with script buttons. @script vbscript (or similar) is the only modifier that should appear at the top of a script. Use ClickData.Func.Command.Deselect = False to do the equivalent of @nodeselect from a script.)

What kind of tag are we talking about here?

How are you adding the tag?

Oh, cool! Thanks for the tip on the deselect command. I'll start using that from now on. :thumbsup:

Here's my process to recreate the issue:

  1. I highlight an MP3 file and then open the Metadata Pane.
  2. Under Extended Properties, I click in the Tags field, type in a tag name (e.g., "red"), and click Apply.
  3. I click on the button to run the script above, and it displays "Count = 1" and "Tag = red".
  4. I click on the button to run the script a second time, and it displays "Count = " and nothing else. No matter how many times I run the script after this point, it never displays the tag again.
  5. I change the tag to something else (e.g., "blue"), using the process in step 2.
  6. I click on the button to run the script again, and it displays "Count = 1" and "Tag = blue".
  7. I click on the button to run the script again, and it displays "Count = " and nothing else. The tag never displays again after this point.

Sometimes when I click the button to run the script in step 4, it will actually display the correct "Count = #" but it doesn't display the tag. Any additional button clicks just result in "Count = " and nothing else. The only time I can ever get the tag to display is right after I add or change it.

Is there any other info I can give you to help narrow down this issue? I'm happy to help anyway that I can. Thanks!