Summary of multiple codes for music playback using VBS

Source: Internet
Author: User

The first code will use the program associated with the default mp3 file, and a music playing Box will appear. Copy codeThe Code is as follows: wscript. sleep 12000
Set ws = createobject ("wscript. shell ")
Ws. run "Brother, you're exhausted"

The second section of the Code calls the wmplayer.ocxplug-in, which does not appear in the music box. If you want to close the music plug-in, you can close the wscript.exe process.Copy codeThe Code is as follows: Dim wmp
Set wmp = CreateObject ("WMPlayer. OCX ")
Wmp. URL = "Brother Zhang mengmeng"
Do Until wmp. playState = 1
WScript. Sleep 1000
Loop

VBS hide and play musicCopy codeThe Code is as follows: set ws = createobject ("wscript. shell ")
Ws. run "wmplayer.exe" & ws. currentdirectory & "\ 08.wma", 0

Ws.currentdirectoryis the retrieved directory in vbs. This program is used in the wmplayer.exe player.
OrCopy codeThe Code is as follows: set ws = createobject ("wscript. shell ")
Ws. run "wmplayer.exe E: \ mp3 \ 08.mp3", 0

A good vbs player recommendationCopy codeThe Code is as follows: MsgBox "is only a sample and cannot play songs. You need to modify it yourself! Author: I think ", 60," Crazy homemade players"
Set Player = CreateObject ("wmplayer. ocx ")
Do
I = inputbox ("Enter the song number you want to select. to exit, press 0: "& vbCrlf &" 1> Phoenix Legend "& vbCrlf &" 2> laugh at Rivers and Lakes "& vbCrlf &" 3> Han Jing-do not use my love to hurt me "& vbCrlf & "4> Xu huixin-happy taste" & vbCrlf & "5> Chen Huilin-better than dancing" & vbCrlf & "6> FIR-our love" & vbCrlf & "7> it's my fault to go east-to-East-to even cry "& vbCrlf &" 8> Wu peici-a decision with tears shining ", "Music player-perception", "1 ")
If I = 1 then
Player. url = "E: \ music \ legend of the Phoenix"
Elseif I = 2 then
Player. url = "E: \ music \ Joy Lake"
Elseif I = 3 then
Player. url = "E: \ music \ Han Jing-do not use my love to hurt me"
Elseif I = 4 then
Player. url = "E: \ music \ Xu huixin-happy taste .wma"
Elseif I = 5 then
Player. url = "E: \ music \ skip-Chen Huilin Wu"
Elseif I = 6 then
Player. url = "E: \ music \ Apsara stack-our love .wma"
Elseif I = 7 then
Player. url = "E: \ music \ traveling to the east-even crying is my fault"
Elseif I = 8 then
Player. url = "E: \ music \ a tearful decision"
Elseif I = 0 then
Exit do
End if
Loop
Set Player = nothing
The rem URL can be a network or local! The web script can be used anywhere.
Set Wshell = WScript. CreateObject ("WScript. Shell ")
If MsgBox ("go to my space? By the way, dig gold! ", VbYesNo + vbQuestion," I think ") = vbYes Then
Wshell. Run "http://user.qzone.qq.com/420123641"
End if

Simpler Lite versionCopy codeThe Code is as follows: Set Player = CreateObject ("wmplayer. ocx ")
Strsong = inputbox ("enter a song, for example, F: \ mp3 \ 1.mp3; exit and press Cancel:" & vbCrlf & "recursive traversal is also simple, too lazy to integrate ", "vbs player", "F :\! Music \ classic \ piano music \ maid ")
If strsong <> "" then
Do
Player. url = strsong
Strsong = inputbox ("playing... ●●" & vbCrlf & "Please ●do not close the window." & vbCrlf & "you can also choose to play other videos." & vbCrlf & "exit and press Cancel. "& vbCrlf &"", "vbs playing", strsong)
If strsong = "" then exit do
Loop
End if
Set Player = nothing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.