by highonv8splash » Mon Jun 21, 2010 10:30 am
Hi everyone,
I've just gotten the sample VBscripts working and have started working on my own script with the Read and Write sample as my base. I've read through the wiki documentation a fair amount already, I'm hoping someone can point out a stupid mistake that I'm making, it's been a while since I've written in VBscript

. I want to be able to pull Songs.ID based on the path of the file.
- Code: Select all
'Set file path
StringFilePath = "C:\Users\cclub\Music\Real Music\Muzak\Music\AC@_DC\Back In Black\06 Back In Black.mp3"
'Set Data Selection Method
SelectMethod = 2
'Random SampleID Code (Remove if SampleID known)
Set iter = SDB.Database.OpenSQL("SELECT DISTINCT Songs.ID FROM Songs WHERE Songs.SongPath = '" & StringFilePath & "'")
While Not iter.EOF
SampleID = iter.StringByIndex(0)
iter.Next
Wend
StringNewTitle = "Butterflyz"
Set objSongList = SDB.NewSongList 'SelectMethod 2 and 3 SDB.NewSongList
Select Case SelectMethod
Case 1
Set objSongData = SDB.Player.CurrentSong 'SDB.Player.CurrentSong
Case 2
Set objSongListiterator = SDB.Database.QuerySongs("AND Songs.ID=" & SampleID) 'SDB.Database.QuerySongs
It's failing on the very last line in that code block, but it looks like its failing because it doesn't have a SampleID, so I'm assuming its a result of my first SQL statement not returning anything. I don't understand why this would happen, I've tried using various different forms of the path (%20 instead of spaces, etc). When I put that path into an explorer window, it finds and launches the file just fine.
Any thoughts?
Hi everyone,
I've just gotten the sample VBscripts working and have started working on my own script with the Read and Write sample as my base. I've read through the wiki documentation a fair amount already, I'm hoping someone can point out a stupid mistake that I'm making, it's been a while since I've written in VBscript :) . I want to be able to pull Songs.ID based on the path of the file.
[code]
'Set file path
StringFilePath = "C:\Users\cclub\Music\Real Music\Muzak\Music\AC@_DC\Back In Black\06 Back In Black.mp3"
'Set Data Selection Method
SelectMethod = 2
'Random SampleID Code (Remove if SampleID known)
Set iter = SDB.Database.OpenSQL("SELECT DISTINCT Songs.ID FROM Songs WHERE Songs.SongPath = '" & StringFilePath & "'")
While Not iter.EOF
SampleID = iter.StringByIndex(0)
iter.Next
Wend
StringNewTitle = "Butterflyz"
Set objSongList = SDB.NewSongList 'SelectMethod 2 and 3 SDB.NewSongList
Select Case SelectMethod
Case 1
Set objSongData = SDB.Player.CurrentSong 'SDB.Player.CurrentSong
Case 2
Set objSongListiterator = SDB.Database.QuerySongs("AND Songs.ID=" & SampleID) 'SDB.Database.QuerySongs
[/code]
It's failing on the very last line in that code block, but it looks like its failing because it doesn't have a SampleID, so I'm assuming its a result of my first SQL statement not returning anything. I don't understand why this would happen, I've tried using various different forms of the path (%20 instead of spaces, etc). When I put that path into an explorer window, it finds and launches the file just fine.
Any thoughts?