autoitfan Posted January 23, 2005 Share Posted January 23, 2005 (edited) Using SoundPlay ("52 minute.mp3", 1) Click 'Start Menu - Shut Down ...' to stop work. Windows hangs until the remainder of the MP3 file has played, then Shut Down proceeds. Can't use 'exit=0' because script is randomly passed any one of 193 MP3 file names to play as an execution parameter. There is no way (that I'm aware of) to determine when one MP3 has finished, so that the script can be reinvoked with a new random selection. Is there a reasonable way to solve this problem? Edited January 23, 2005 by autoitfan Link to comment Share on other sites More sharing options...
ezzetabi Posted January 23, 2005 Share Posted January 23, 2005 (edited) I am afraid there is nothing to do. SoundPlay wait=1 is a stopping function just like MsgBox() . The only almost solution is something like this, compile a script like this one: #NoTrayIcon If $CmdLine[0] > 0 Then SoundPlay ($CmdLine) EndIf That just starts the sound you set as parameter. And a second script that runs the first and check if it pids still exist. ;LOOP for seeking files and starting files. $pid = Run('Otherscripname.exe "' & $soundname & '"') While ProcessExists($pid) Sleep(1000) WEnd ;ENDLOOP Exit Func OnAutoItExit() ProcessClose($pid) EndFunc So closing this second script will close the first one, yet since you can't know what process windows will want to close for first you have to close it manually before turning off. But I am not even sure ProcessClose() can close an Autoit session where is acting a stopping function. If it does not you have to use PSKILL, that I tested working. Edited January 23, 2005 by ezzetabi Link to comment Share on other sites More sharing options...
autoitfan Posted January 24, 2005 Author Share Posted January 24, 2005 Thank you ezzetabi. I'll give your idea a try and let you know how it works. I was using the Windows Media Player with the /Close parameter before and did not have the shutdown hang problem. Unfortunately, the stopping and starting of the WMP every time one MP3 ended and the next began would cause the active window to lose focus (even the WPM was starting as taskbar icon). That's why I've been trying to use SoundPlay instead of WPM. autoitfan Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now