你能帮忙写一个脚本,通过vbscript播放特定文件夹中的所有歌曲.
Set wmp = CreateObject("WMPlayer.OCX") wmp.openPlayer("xxx.mp3")
上面的脚本可以运行单个文件.
谢谢
我制作了一个可以从文本文件中读取歌曲路径列表(本地或在线)的vbscript,可能会给你一个想法,当然你可以改进它:)
因此,要测试此脚本,必须创建名为PlayList.txt的文本文件
http://soundjay.com/mechanical/bomb-falling-and-exploding-01.mp3 http://hackoo.alwaysdata.net/Best of Avicii Megamix 2014.mp3 http://hackoo.alwaysdata.net/Megamix 90.mp3
并使用以下代码进行测试:
'**********************Description************************ 'Play a PlayList contained in a text file © Hackoo © 2014 '********************************************************* Option Explicit On Error Resume Next Call Play() If Err <> 0 Then Ws.popup Err.Description,"3",Err.Description & Copyright,VbCritical Err.Clear End If '********************************************************* Sub Play() Dim Sound,Xwmp Dim File,fso,F,ReadME,PlayList,i,Ws,Copyright,Name,Duration Copyright = " © Hackoo © 2014" File = "PlayList.txt" Set Ws = CreateObject("wscript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FileExists(File) Then Ws.popup Err.Description,VbCritical End IF Set F = fso.OpenTextFile(File,1) ReadMe = F.ReadAll PlayList = split(ReadMe,vbcrlf) Set Sound = CreateObject("WMPlayer.OCX.7") Sound.settings.volume = 100 Sound.currentPlaylist.Clear For i = Lbound(PlayList) to Ubound(PlayList) Set Xwmp = Sound.newMedia(PlayList(i)) Sound.currentPlaylist.insertItem(i),Xwmp Sound.Controls.Play() Do while Sound.currentmedia.duration = 0 wscript.sleep 100 Loop wscript.sleep(int(Sound.currentmedia.duration)+1)*1000 Next End Sub '***********************************************************