WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: pguild on May 25, 2019, 12:41:25 PM

Title: PlayMp3 Error
Post by: pguild on May 25, 2019, 12:41:25 PM
;This script fails:
filename = "C:\Users\Administrator\Downloads\TTS-mp3\mp3-error.mp3"
donotwait = 1
PlayMidi( filename, donotwait)
RETURN

I get an error message suggesting that the file may be corrupt or the necessary support files are not present.

Windows 10 plays the file just fine when I paste the pathname into the "Type here to search" box at lower left.
You may want to check out this video to see for yourself:

https://www.loom.com/share/350fbbb5304044638431f89bda5b726f (https://www.loom.com/share/350fbbb5304044638431f89bda5b726f)
Title: Re: PlayMp3 Error
Post by: pguild on May 25, 2019, 01:02:56 PM
I see that I am trying to use the PlayMidi function to play an MP3 file -- of course -- that doesn't work.
I was able to play an mp3 file like this:

filename = "C:\Users\Administrator\Downloads\TTS-mp3\Affirmations-1558810514_5ce98f9240800.mp3"
;filename = "C:\Users\Administrator\Downloads\TTS-mp3\mp3-error.mp3"
donotwait = 1
;shellexecute(filename, "", "", @ZOOMED,"")
;pause("runshell",filename)
runshell( filename,"", "", @ICON, @NOWAIT)

The challenge, now, is that @ICON specification does not iconize the application playing the MP3 file.
Title: Re: PlayMp3 Error
Post by: td on May 28, 2019, 06:58:17 AM
WinBatch passes the starting window state to the application as part of a call to the CreateProcess Win32 API function.  Most applications honor the request but an application doesn't necessarily have to.  It is up to the application's developer to determine how it responds to the request.