WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sound and Media

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Play MP3 Files

Keywords:   MP3

Question:

Is there a way to play MP3 files using Winbatch?

Answer:

I play MP3's from Winbatch with the following code:
mpegName="path to mpeg file"
PlayMedia("open mpegvideo!%mpegName% alias music")
PlayMedia("play music")
You must have Windows Media player 2.0 or higher for this to work.

This code will wait for the song to complete before playing the next song.

dir = AskDirectory("Choose directory of songs to play", "", "", "", 0 )
DirChange(dir)
songlist = FileItemize( "*.mp3" )
count = ItemCount( songlist, @TAB )
For xx = 1 To count
   song = ItemExtract( xx, songlist, @TAB )
   PlayMedia('open mpegvideo!' : song : ' alias music')
   PlayMedia("play music WAIT");Wait for song to complete
Next
Exit

REFERENCE: MCI Command Strings http://msdn.microsoft.com/en-us/library/ms712587(VS.85).aspx


Article ID:   W14303
Filename:   Play MP3 Files.txt
File Created: 2009:05:11:13:56:18
Last Updated: 2009:05:11:13:56:18