Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
kami
- Posts: 9
- Joined: 11 Sep 2011 19:35
- Location: Jamaica
#1
Post
by kami » 19 Sep 2011 20:48
I an trying to create something like a JukeBox where the user is able to select from a list of tracks and it plays. I would also love if the track could repeat over and over until the user wants it to stop.
I have the .wav files which i have named each ones by numbers(1-9) in a folder called JukeBox which also contains the batch file also calle JukeBox on my desktop.
I am running windows 7 and when i try to run the little piece of code I have it says "mplay32.exe", "wmplayer32.exe" or the word "play" is not recognised.
Can someone please help...pretty please?
This is the little i have so far.
Code: Select all
@echo off
:start
cls
echo.
echo WELCOME To JUKEBOX WORLD
echo ----------------------------
echo.
echo Select 1-9 for the track you wish to play
echo.
set "choice="
set /p choice=Please enter your prefered track:
rem %choice%.wav
echo.
start %choice%.wav
Play sound
mplay32.exe/play/close/JukeBox\%choice%.wav
echo.
pause
type %choice%.wav | more
pause
goto :start
pause
-
Ed Dyreen
- Expert
- Posts: 1569
- Joined: 16 May 2011 08:21
- Location: Flanders(Belgium)
-
Contact:
#2
Post
by Ed Dyreen » 19 Sep 2011 22:41
'
How about:
Code: Select all
start "mplay32" /low /min "mplay32.exe" "%choice%.wav" /play /close /JukeBox
-
kami
- Posts: 9
- Joined: 11 Sep 2011 19:35
- Location: Jamaica
#3
Post
by kami » 20 Sep 2011 16:05
nah doesn't work either
-
nitt
- Posts: 218
- Joined: 22 Apr 2011 02:43
#4
Post
by nitt » 20 Sep 2011 19:02
kami wrote:nah doesn't work either
It's not "wmplayer32", it's just "wmplayer".
-
kami
- Posts: 9
- Joined: 11 Sep 2011 19:35
- Location: Jamaica
#5
Post
by kami » 20 Sep 2011 19:48
yh man. doesnt work
-
Captcha142
- Posts: 13
- Joined: 18 Sep 2011 23:35
#6
Post
by Captcha142 » 20 Sep 2011 21:27
I have a simple "chimes.bat" in my archive;
try
Code: Select all
mplay32 /play /close c:\windows\media\flourish.mid
To play the flourish track from XP.
If
Code: Select all
mplay32 /play /close c:\JukeBox\%choice%.wav
doesn't work, try changing the file extensions... mplay doesn't play many file types.
-
kami
- Posts: 9
- Joined: 11 Sep 2011 19:35
- Location: Jamaica
#7
Post
by kami » 21 Sep 2011 05:36
This is what i did instead. I think the IF statements need to be corrected...but so far it works ok.
Code: Select all
@echo off
color FC
:start
cls
echo.
echo WELCOME To JUKEBOX WORLD 2.0
echo --------------------------------
echo.
echo Music Selection
echo Options
echo 1. Keida - Bubble up
echo 2. Camar - Pole Technician
echo 3. Katy Perry - Firework
echo 4. Wande Coal - Bumper 2 Bumper
echo 5. I-Octane - Study yuh friend
echo.
echo Video Selection
echo Options
echo 6.
echo 7.
echo.
echo.
echo If you wish to exit please press E
set choice=
echo Select 1-9 for the track you wish to play
echo.
set /p choice=Please enter your prefered track:
rem %choice%.mp3
if "%choice%" =="1" (start 1.mp3)
if "%choice%" =="2" (start 2.mp3)
if "%choice%" =="3" (start 3.mp3)
if "%choice%" =="4" (start 4.mp3)
if "%choice%" =="5" (start 5.mp3)
echo.
pause
rem type %choice%.mp3 | more
goto :start
pause
-
Ed Dyreen
- Expert
- Posts: 1569
- Joined: 16 May 2011 08:21
- Location: Flanders(Belgium)
-
Contact:
#8
Post
by Ed Dyreen » 21 Sep 2011 12:51
'
next code:
Code: Select all
if "%choice%" =="1" (start 1.mp3)
if "%choice%" =="2" (start 2.mp3)
if "%choice%" =="3" (start 3.mp3)
if "%choice%" =="4" (start 4.mp3)
if "%choice%" =="5" (start 5.mp3)
can be replaced by:
Code: Select all
for /l %%! in (
1, 1, 5
) do if /i ["%choice%"] == ["%%~!"] (
::
start "mp3" "%%~!.mp3"
)
-
kami
- Posts: 9
- Joined: 11 Sep 2011 19:35
- Location: Jamaica
#9
Post
by kami » 21 Sep 2011 16:49
Yaaaaay. Thank you guys
.
How do i display an error message if the user enters a wrong option?