Jump to content
Sign in to follow this  

SoundPlay exit=1 hangs shutdown

Recommended Posts

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 by autoitfan

Share this post

Link to post
Share on other sites

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:

If $CmdLine[0] > 0 Then
   SoundPlay ($CmdLine)

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)

Func OnAutoItExit()

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 by ezzetabi

Share this post

Link to post
Share on other sites

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.


Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...