Page 1 of 1

MCI library still usable?

Posted: 28 Jan 2019, 08:43
by x32
Dug out one of my old Win XP scripts because I have a new use for it. It is a media player that would retrieve the total length of a track and the time left. Now, on Win 10, it doesn't work at all and I can find no apparent reason.

It was entirely based on the MCI.ahk library. Does anyone know if this old library can still be used in Win 10 and the latest version of AHK or is it obsolete?

Does anyone know of another method to get the total song length?

MCI.ahk
https://github.com/camerb/AHKs/blob/master/thirdParty/MCI.ahk

Edit, here is a simple play script using the MCI library. The "Open" command always returns an error.

Code: Select all

#Include, MCI.ahk

song = %A_ScriptDir%\abbeybellsfx.wav 
Gui, Add, Button, x5 y5 w100 h25 vb1 gb1, Play
Gui, Show, w110 h50 , Simple MCI Player 
Return

b1:
hMedia:=MCI_Open(song)
MsgBox, %hMedia%
MCI_Play(hMedia)
Return

Re: MCI library still usable?

Posted: 10 Apr 2019, 18:26
by PuzzledGreatly
I just found this thread. I can use mci functions to play audio on a laptop that used to run Windows 8 but was upgraded to windows 10. I always stop a sound before I play it, eg:

Code: Select all

NOW := "Full path to Sound File"

space::

CloseSound("NowPlaying")
Playsound(NOW, "NowPlaying")

return

; ====================================================================

PlaySound(SoundFile, SoundAlias, Flags="") { ; Flags: repeat, etc...
  mciSendString("open " """" SoundFile """" " type mpegvideo Alias " SoundAlias)
  mciSendString("play " SoundAlias " " Flags)
}

CloseSound(SoundAlias) {
  mciSendString("close " SoundAlias)
}

;..Rest of the MCI library
I can post the mci functions I have if that would be useful.

Re: MCI library still usable?

Posted: 12 Apr 2019, 15:02
by x32
Thanks for the reply. I haven't had, and won't have time to look at your example, for a few days but I will. I'll compare your functions with what's in my library and see if there is any difference.