Page 1 of 1
SDB.Database.QuerySongs
Posted: Tue Jul 05, 2005 2:07 am
by Anubis
I am starting to learn VBScripting and MM. Bare with me, I really don't know VBScript, but I do know non-object based programming, I just need a little helping hand...
I don't understand how to access the results of a SDB.Database.QuerySongs command.
Here is a code segment...
Code: Select all
MsgBox(itm.Title)
Set iter = SDB.Database.QuerySongs("AND SongTitle='" & itm.Title & "'")
if iter.EOF then
MsgBox("No title found")
else
MsgBox("Found at least one...")
end if
I get the "Found" msg when I run my code, what I don't know is how to access the results of the QuerySongs command. As a starting point I'd like to do
MsgBox(iter.Artist) or some such command to see the artist (and album) of the song I have found.
Can anybody help out here?
Thanks
Re: SDB.Database.QuerySongs
Posted: Tue Jul 05, 2005 2:34 am
by onkel_enno
Code: Select all
MsgBox(itm.Title)
Set iter = SDB.Database.QuerySongs("AND SongTitle='" & itm.Title & "'")
if iter.EOF then
MsgBox("No title found")
else
while not iter.eof
Msgbox(iter.item.artist)
iter.next
wend
end if
Not tested!
Re: SDB.Database.QuerySongs
Posted: Tue Jul 05, 2005 7:02 am
by Anubis
onkel_enno wrote:
Not tested!
When I use this, I get the following error...
Code: Select all
Error #438 - Microsoft VBScript runtime error
Object doesn't support this property or method
There must be a different way to refer to the artist and album information.
Any other suggestions?
Posted: Tue Jul 05, 2005 8:14 am
by onkel_enno
Sorry, not artist but artistname. Artist is the Artist-Object!
Posted: Wed Jul 06, 2005 3:04 am
by Anubis
onkel_enno wrote:Sorry, not artist but artistname. Artist is the Artist-Object!
Your a LEGEND!
I feel so embarrassed that I didn't work this out myself.
I think I'm on track now.
If I have any more questions, I know where to come!
Thanks
Posted: Wed Jul 06, 2005 3:09 am
by onkel_enno
Anubis wrote:
If I have any more questions, I know where to come!
You're welcome
Re: SDB.Database.QuerySongs
Posted: Wed Apr 06, 2022 9:08 am
by hh_perth
Although this topic may be outdated – I couldn’t find an answer anywhere else :
with a large database of songs I like to check / manipulate tags by applying VBA-EXCEL macros.
With SDB = CreateObject("SongsDB.SDBApplication") access works great in MM4
(with change SDB = CreateObject("SongsDB5.SDBApplication" unfortunately it does not work in MM5)
manipulating selected songs.
Problem: I want to check, whether a song “Artist – Title” already exists any how many (with what quality (bitrate) and length and where stored (path)).
With trying QuerySongs or OpenSQL both did not work properly, as a I was not able to formulate a direct search with
Artist & Title.
Set objSongListiterator = SDB.Database.QuerySongs("SongLength > 6*1000")
While Not objSongListiterator.EOF
Set objSongData = objSongListiterator.Item
If LCase(objSongData.artistname) = N_Artist And LCase(objSongData.title) = N_Title Then _
ActiveCell.Offset(i, 0) = objSongData.artistname: _
ActiveCell.Offset(i, 1) = objSongData.title: _
ActiveCell.Offset(i, 2) = objSongData.Path: _
ActiveCell.Offset(i, 3) = i & " of " & n: i = i + 1
objSongListiterator.Next
n = n + 1
Wend
Set objSongListiterator = Nothing
I was able to retrieve the requested information, but the macro needs to search the whole database.
There must be a better way – please help.