Jump to content

create a cd of music at random


eyeball

Recommended Posts


thats a good suggestion but WMP doesnt know where the end of the cd is and you can't ask it to select 80 minutes worth of music (can you?) would be nice if i could do it with media player. or does anyone else know of another program? :wacko:

Edited by eyeball
Link to comment
Share on other sites

Here is a demo script that list what been added to the WMP playlist.

This will add both MP3 and WMA to the WMP playlist.

Save As AddToWmp.vbs

strComputer = "."
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Wmp : Set Wmp = CreateObject("WMPlayer.OCX" )
Dim Wmi : Set Wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer& "\root\cimv2")
Dim Media : Set Media = Wmp.mediaCollection
Dim Txt : Txt = Act.ExpandEnvironmentStrings("%UserProfile%\desktop\")
Dim AddSong, Cnt, Ext, F3, F4, GetF, MB, Music, ObjFile, TS
F4 = Chr(160) & Chr(187) & Chr(160)
MB = 1024 * 1024
'-> Searches For MP3
FindMP3()
Function FindMP3()
Ext="MP3"
StartFileList()
Set Music = Wmi.ExecQuery("Select * from CIM_DataFile Where Extension = 'MP3'")
For Each ObjFile In Music
Set AddSong = Media.Add(ObjFile.Name)
MkRptMusic()
Next
RptCount()
Cnt =0
Exit Function
End Function
'-> Searches For WMA
FindWMA()
Function FindWMA()
Ext="WMA"
StartFileList()
Set Music = Wmi.ExecQuery("Select * from CIM_DataFile Where Extension = 'WMA'")
For Each ObjFile In Music
Set AddSong = Media.Add(ObjFile.Name)
MkRptMusic()
Next
RptCount()
Cnt =0
Exit Function
End Function
'-> Counts How Many MP3 Or WMA Have Been Added
Function CountMusic()
If Music.Count = 0 Then
'-> If There Is No MP3 Or WMA
Else
Cnt = Cnt + 1
If Cnt > 99 Then
Cnt = Cnt
ElseIf Cnt = 99 Then
Cnt = "0" & Cnt
ElseIf Cnt > 9 Then
Cnt = "0" & Cnt
ElseIf Cnt = 9 Then
Cnt = "00" & Cnt
ElseIf Cnt < 9 Then
Cnt = "00" & Cnt
End If
End If
Exit Function
End Function
'-> List What Been Added To Playlist
Function MkRptMusic()
CountMusic()
F3 = Fso.GetFolder(Fso.GetParentFolderName(ObjFile.Name))
Set GetF = Fso.GetFile(ObjFile.Name)
Set TS = Fso.OpenTextFile(Txt & Ext &"_List.txt",8)
TS.WriteLine F4 & Ext & " Path" & F4 & F3
TS.WriteLine F4 & Cnt & "\" & Ext
TS.WriteLine F4 & Ext & " Name" & F4 & GetF.Name
TS.WriteLine F4 & Ext & " Size" & F4 & Left(Round(GetF.Size /MB,5),5) & " MB" & vbCrLf
TS.Close()
Exit Function
End Function
'-> Reports How Many MP3 Or WMA
Function RptCount()
MsgBox F4 & "Music File Count " & F4 & Music.Count,4128, Ext & " Total"
Set TS = Fso.OpenTextFile(Txt & Ext &"_List.txt",8)
TS.WriteLine F4 & "End Time " & F4 & Now() & vbCrLf
TS.Close()
Exit Function
End Function
'-> Start The Text Output
Function StartFileList()
Set TS = Fso.CreateTextFile(Txt & Ext &"_List.txt")
TS.WriteLine F4 & "Start Time" & F4 & Now() & vbCrLf
TS.Close()
Exit Function
End Function
'-> Delete The VBS File
Fso.DeleteFile(Fso.GetFile(WScript.ScriptFullName))

Here Is A SFX file of the above Script

Edited by gunsmokingman
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...