A summary of multiple code for music playback with VBS _VBS

Source: Internet
Author: User
The first code, which uses the program associated with the default MP3 file, will appear in the Music Play box
Copy Code code as follows:

Wscript.Sleep 12000
Set Ws=createobject ("Wscript.Shell")
Ws.run "brother, Are you tired? MP3"


The second code calls the WMPlayer.OCX plug-in, the music player does not appear, and if you want to turn off the music, you need to turn off the wscript.exe process in the process.
Copy Code code as follows:

Dim WMP
Set wmp = CreateObject ("WMPlayer.OCX")
wmp. URL = "Brother Zhang Meng Meng mp3"
Do Until wmp.playstate = 1
Wscript.Sleep 1000
Loop

VBS Hide Play Music
Copy Code code as follows:

Set Ws=createobject ("Wscript.Shell")
Ws.run "Wmplayer.exe" &ws.currentdirectory& "\08.wma", 0

Ws.currentdirectory gets the local directory for the VBS, and this program needs to use the Wmplayer.exe player.
Or
Copy Code code as follows:

Set Ws=createobject ("Wscript.Shell")
Ws.run "Wmplayer.exe E:\mp3\08.mp3", 0

A more good one of the VBS player recommended
Copy Code code as follows:

MsgBox "It's just a sample and can't play songs." You need to change your own! Author: After knowing ", 60," The Madman self-made player "
Set Player = CreateObject ("WMPlayer.OCX")
Todo
I=inputbox ("Please enter the song number you want to choose, exit please press 0:" &vbCrlf& "1 >> Phoenix Legend" &vbCrlf& "2 >> laughing Lake" &vbCrlf& "3 >> Maria-Don't hurt me with my Love" &vbCrlf& "4 >> Premiere-happy Taste" &vbCrlf& "5 >> Kelly-Dance" &vbcrlf & "6 >> fir-Our Love" &vbCrlf& "7 >> east to east-even crying is my fault" &vbCrlf& "8 >> Pace Wu-the decision of the Flash of Tears", " Music player-After Knowing "," 1 "
If I=1 Then
Player.url = "E:\music\ Phoenix legend. mp3"
ElseIf i=2 Then
Player.url = "E:\music\ laughing. mp3"
ElseIf I=3 Then
Player.url = "E:\music\ Maria-Don't hurt me with My love. mp3"
ElseIf I=4 Then
Player.url = "E:\music\ Premiere-The Taste of happiness. wma"
ElseIf I=5 Then
Player.url = "E:\music\ is better than dancing-Kelly. mp3"
ElseIf I=6 Then
Player.url = "E:\music\-our love. wma"
ElseIf I=7 Then
Player.url = "E:\music\ East to the east-even crying is my fault. mp3"
ElseIf I=8 Then
Player.url = "E:\music\ 's decision to Flash tears. mp3"
ElseIf I=0 Then
Exit Do
End If
Loop
Set player=nothing
The REM URL can be either a network or a local one! If this is a Web script, it can be used anywhere.
Set wshell=wscript.createobject ("Wscript.Shell")
If MsgBox ("To my space to turn?") By the way, dig gold! ", vbYesNo + vbquestion," after knowing ") = vbyes Then
Wshell.run "http://user.qzone.qq.com/420123641"
End If

Simpler versions of the previous version of the simplified version
Copy Code code as follows:

Set Player = CreateObject ("WMPlayer.OCX")
Strsong=inputbox ("Please enter songs, such as F:\mp3\1.mp3; Exit Press Cancel:" & VbCrlf & "Recursive traversal is also simple, lazy to integrate", "VBS player", "f:\!music\classic\ piano Strauss-"The Blue Danube" waltz. mp3 ")
If Strsong <> "" Then
Todo
Player.url = Strsong
Strsong=inputbox ("playing" & VbCrlf & "Please do not close the window" & VbCrlf & VbCrlf & "You can also choose to play other" & VbCrlf & " Exit Press Cancel "& VbCrlf &" ", VBS is 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.