Getting SongData members at run time

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Getting SongData members at run time

Re: Getting SongData members at run time

by Bex » Wed Jan 07, 2009 1:36 pm

Yes, but you can use it multiple times and also save the code for other scripts as well. There is no automated way to retrieve this.
It would be nice though with some auto functions that returns an Arrays consisting of e.g.
All fields (get/let or get)
Editable fields (get/let)
non-editable fields (get)

But for now you need to create them manually. I believe that both Steegy and Trixmoto has made such functions in a couple of their scripts. I have a similar one which I use in ADFF's Copy/Paste Metadata.

Re: Getting SongData members at run time

by Teknojnky » Wed Jan 07, 2009 1:23 pm

but that is the same as coding for each field.

What if you did not know the fields? Yes I know they are documented, but from a programtic point of view?

Re: Getting SongData members at run time

by Bex » Wed Jan 07, 2009 1:00 pm

You have to create your own function which takes a songdata object and the returns all properties as an array. You can then do stuff with the array.

E.g.

Code: Select all

Sub GetAllProperties(SongdataObj)
  Dim AllPropArray(?)
  AllPropArray(0)=SongdataObj.Artist
  AllPropArray(1)=SongdataObj.Title
  AllPropArray(2)=SongdataObj.Album
  A.s.o. to
  AllPropArray(?)=SongdataObj.???

  GetAllProperties=AllPropArray
End Function

Getting SongData members at run time

by Teknojnky » Wed Jan 07, 2009 12:41 pm

Something that always bugged me that I never figured out, was if/how it would be possible to get all the songdata fields dynamically at run time, instead of coding for each individual field.

Basically, I want to get a (indexed?) list of fields, perform a search, make a change, or check for certain data types on each field (or only specific ones), then move to the next songdata item.

Top