Hi people.
I am looking for a .vbs command that adds a Path/File.mp3 into the Now Playing List.
Thank you
.vbs to Add a File into NowPlaying List (from Path)
Moderators: Gurus, Addon Administrators
Re: .vbs to Add a File into NowPlaying List (from Path)
You have a few options, depending on what exactly it is that you're trying to do...
- SDB.Player.PlaylistAddTrack(objSongData)
- SDB.Player.PlaylistAddTracks(objSongList)
- SDB.Player.PlaylistInsertTrack(objSongData)
- SDB.Player.PlaylistInsertTracks(objSongList)
... all of which are documented on the wiki in SDB.Player
- SDB.Player.PlaylistAddTrack(objSongData)
- SDB.Player.PlaylistAddTracks(objSongList)
- SDB.Player.PlaylistInsertTrack(objSongData)
- SDB.Player.PlaylistInsertTracks(objSongList)
... all of which are documented on the wiki in SDB.Player
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Re: .vbs to Add a File into NowPlaying List (from Path)
Thank you very much trixmoto, BUT
the big question is how I get that objSongData object from a path like e.g. "c:\folder\myfile.mp3" .....
Thanks in advance !!!
the big question is how I get that objSongData object from a path like e.g. "c:\folder\myfile.mp3" .....
Thanks in advance !!!
Re: .vbs to Add a File into NowPlaying List (from Path)
Ah right, I see. Well in that case I'd recommend SDB.Database.QuerySongs, something like...
Notice that I have excluded the drive letter, this is because MM holds this in a separate table. If you need to ensure the drive letter is correct as well then the sql segment will need to be amended to link to the Medias table, which complicates things a little.
Code: Select all
Dim path : path = "c:\folder\myfile.mp3"
Dim iter : Set iter = SDB.Database.QuerySongs("SongPath='"&Mid(path,2)&"'")
If Not iter.EOF Then
SDB.Player.PlaylistAddTrack(iter.Item)
End If
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Re: .vbs to Add a File into NowPlaying List (from Path)
Thank you trixmoto but what about if file is not scanned in database? Just like when you drag it from the explorer to now playing list......but programmatically,,,
Thanks for your time...
Thanks for your time...
Re: .vbs to Add a File into NowPlaying List (from Path)
Ok, in that case you need to create an entry in the database, so that you can add it to the now playing list, something like this...
This first tries to get the metadata from the tags stored in the file (using ReadTags) and then if that fails, it tries to get it from the filename itself (using MetadataFromFilename).
Code: Select all
Dim itm : Set itm = SDB.NewSongData
itm.Path = "c:\folder\myfile.mp3"
itm.ReadTags
itm.UpdateDB
If itm.Title = "" Then
itm.MetadataFromFilename
itm.UpdateDB
End If
itm.UpdateArtist
itm.UpdateAlbum
SDB.Player.PlaylistAddTrack(itm)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Re: .vbs to Add a File into NowPlaying List (from Path)
Thanks very much !!!! You spent so much time for me ?
Man I don't know how to thank you........
Man I don't know how to thank you........
Re: .vbs to Add a File into NowPlaying List (from Path)
No worries, always glad to help out a fellow scripter
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.