ISDBApplicationEvents::OnTrackProperties
Jump to navigation
Jump to search
CoClass SDBApplication, Interface ISDBApplicationEvents
Sub OnTrackProperties(TrackList As SDBSongList)
Parameters
Name | Type | Description |
---|---|---|
TrackList | SDBSongList | A list of tracks that were modified. |
Event description
Is called whenever track(s) metadata were modified. This happens a lot, so use this event wisely. Unregister the event when your script doesn't need to handle it anymore.
Event is called after data were saved to the database.
Note: If you modify track(s) metadata within the event handler, the event handler will be called again. Be sure to prevent the event handler from executing, otherwise this would cause an infinite loop. See the example below.
Example code
Script.RegisterEvent SDB, "OnTrackProperties", "SDB_OnTrackProperties"
Dim InEventHandler : InEventHandler = False ' Control variable (shows if event handler is executing)
Sub SDB_OnTrackProperties(TrackList)
If InEventHandler Then Exit Sub ' Prevent executing event handler from within itself
InEventHandler = True ' Event starts --> set control variable
' make some changes to tracks in TrackList
TrackList.UpdateAll ' By applying the changes, the event handler will we called
InEventHandler = False ' Event finished --> clear control variable
End Sub