rm65453

Soundplay stopped working

21 posts in this topic

I have a script that alerts every 1 hour with a wav file. It was working for a week and now this week it has stopped working.

 

here is the sound loop code

 

Send ("{VOLUME_UP}")
_SetMasterVolumeLevel(0)
Local $aSound = _SoundOpen("path\deliveryalert.wav")
SoundPlay($aSound, 1)
_SoundClose($aSound)
$DeliveryFlag = 1

 

I have confirmed that the loop still runs at the designated time, just the file does not play.

Share this post


Link to post
Share on other sites



rm65453,

Firstly, there is no need to use the UDF functions _SoundOpen/Close if you play the file using the native SoundPlay - you do need them if you use the UDF _SoundPlay function to play certain files.

Secondly, what does the _SetMasterVolumeLevel(0) line do? Have you checked the volume sliders during script execution to see if they are at a suitable level to allow you to hear the sound?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

The reason I started using _SoundOpen/close was because some computers were not playing using simply the soundplay.

Many staff members lowers the volume of these alerts, the _SetMasterVolumeLevel(0) line increases the volume before playing the file.

 

But even if i did use the _SoundOpen/Close, it would not cause problems, would it?

The modified code did not work either

Send ("{VOLUME_UP}")
_SetMasterVolumeLevel(0)
SoundPlay("path\deliveryalert.wav", 1)
Edited by rm65453

Share this post


Link to post
Share on other sites

rm65453,

Have you tried using the UDF functions (_SoundOpen/Play/Close) to play the file?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

you mean this

 

Local $aSound = _SoundOpen("path/filename.wav")
If @error = 2 Then
    MsgBox($MB_SYSTEMMODAL, "Error", "The file does not exist")
    Exit
ElseIf @extended <> 0 Then
    Local $iExtended = @extended ; Assign because @extended will be set after DllStructCreate().
    Local $tText = DllStructCreate("char[128]")
    DllCall("winmm.dll", "short", "mciGetErrorStringA", "str", $iExtended, "struct*", $tText, "int", 128)
    MsgBox($MB_SYSTEMMODAL, "Error", "The open failed." & @CRLF & "Error Number: " & $iExtended & @CRLF & "Error Description: " & DllStructGetData($tText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
Else
    MsgBox($MB_SYSTEMMODAL, "Success", "The file opened successfully")
 EndIf
 Sleep (500)
    _SoundPlay($aSound, 1)
    _SoundClose($aSound)

 

Still nothing, the funny thing is the original code worked for a week and now suddenly stopped working.

Share this post


Link to post
Share on other sites

rm65453,

I actually meant just:

Local $aSound = _SoundOpen("path/filename.wav")
_SoundPlay($aSound, 1)
_SoundClose($aSound)

Does the file play in other players?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yes the file plays fine in other players. 

 

That code is pretty much what I pasted without the error handling. unfortunately still not working!!

 

btw thank you so much for your quick help melba23, much appreciated.

Share this post


Link to post
Share on other sites

rm65453,

I am afraid I have not been of much help.

If you select another file rather then the current one, does AutoIt manage to play it?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

tried to play another file, still nothing.

 

are there other options to play a wav or mp3 file?

Share this post


Link to post
Share on other sites

rm65453,

Has anything changed on the system since the time when the file did play? Any new AV or HIPS software now on the system which might object to AutoIt playing a sound file?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

No changes that I can aware off. I can ask the IT dept to confirm as well.

Share this post


Link to post
Share on other sites

Ok so here is what I found out. The first of every month, the IT dept sends some changes. Somehow the windows media player was not installed anymore. VLC player is the default for the organization. I reinstalled windows media player for the machine and that seems to have fixed the issue. but not all machines have that installed as default.

 

Anyway I can overcome this limitation?

Share this post


Link to post
Share on other sites

Unfortunately has to be an audio file, wav or mp3.

Share this post


Link to post
Share on other sites

You can use Bass.dll there is a UDF on the forum for that and it's not relying on the windows mediaplayer.

Share this post


Link to post
Share on other sites

rm65453,

VLC has a command line interface - from what I can see you should be able to start it minimized (--qt-start-minimized) and play the file. You could then use ProcessClose to shut it down.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Brilliant idea Melba23, will try this next week. Didnt even think of that.

 

Feel free to point me to some sample code if you have something in mind, i have not extensively searched the forum but a quick search didnt show me something relevant.

Share this post


Link to post
Share on other sites

rm65453,

I just Googled "open VLC hidden" and found that command line option.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Hi Melba23,

 

Sorry to bother you again about this, need a few clarification:

1. I am  having a hard time figuring out how to send the command line command with autoit (without opening the command prompt window)

"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --qt-start-minimized

 

2. Once I have accomplished this, would the soundplay run via VLC or do I  need to change those commands as well?

Edit: Ignore the second question, I found that that I can specify the location of the file in the command line as well.

Thanks

 

I am using the following code:

 

ShellExecute("C:\Program Files (x86)\VideoLAN\VLC\vlc.exe --qt-start-minimized " & '"' & $aSound & '"')

where the $aSound is the path for the sound file.

 

It executes but windows throws and error saying "Windows Cannot Find 'ShellExecute("C:\Program Files (x86)\VideoLAN\VLC\vlc.exe --qt-start-minimized "soundpath/soundalert.wav"')

Edited by rm65453

Share this post


Link to post
Share on other sites

This works for me.

I like the Bass.dll idea though so it can be fully self contained.

 

$sVLCPath = '"C:\Program Files (x86)\VideoLAN\VLC\VLC.exe"'
$sSoundPath = '"C:\Users\Public\Music\Sample Music\Kalimba.mp3"'

Run($sVLCPath & ' --qt-start-minimized ' & $sSoundPath)

Sleep(5000)
ProcessClose("VLC.exe")

 

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

  • Similar Content

    • MightyMalcolm
      By MightyMalcolm
      Hello everyone,
       
      I am not 100% sure how to phrase my problem so I'm sorry if the issue has been addressed elsewhere. Here is my situation: I have added a file called MyStartup.exe (generated by AutoIt) to the list of programmes to launch on startup via the Windows registry on my laptop. As soon as it is running, this file will display a 3 minutes (tooltip) countdown and in the end call Run("Another.exe"). The latter is an AutoIt script, too. Among other things, it contains a few SoundPlay() commands, but for some reason, there is no sound coming at all! Strangely, however, when i manually run the MyStartup.exe and let it do its job, THEN the Another.exe plays sounds properly.
      I can only guess what might be the matter here, since the same procedure (autostart) works fine on my other PC.
       
      Any help would be greatly appreciated
    • Danyfirex
      By Danyfirex
      A Friend told me about this. so I got interesting in.
      ¿Did you know I was able to play sound directly from link using soundplay?
      SoundPlay("http://www.freesfx.co.uk/rx2/mp3s/10/12598_1439008511.mp3",1) should help file talks about it? I work for me a least wit mp3 hot link. with wav it doesn't.
      Saludos
    • TheAutomator
      By TheAutomator
      Hello programmers 
      it's been awhile since my last topic but I stumbled on something strange..
      make an Autoitscript and put this in it:
      soundplay("file.wav",1) then make a bunch of folders inside of other folders and put the script with the wav file into the deepest folder:
      new folder000new folder001new folder002new folder003new folder003new folder005new folder006new folder007new folder008new folder009new folder010my_autoitscript.au3 file.wav
      then try to play the sound file with your autoitscript...
      the sound does not play but if i place the script with the sound file a few folders up, it works.
      hope you can help me and thanks for reading my post,
      TheAutomator
    • johnmcloud
      By johnmcloud
      Like title, i'm searching into the forum but i don't have find anything, so i'm posting a new thread

      Example script:

      SoundPlay("2_minute_song.mp3",0) Sleep(5000) If SoundPlay_isActive() Then MsgBox(0,0,"Song is running") Else MsgBox(0,0,"Song isn't running") EndIf Func SoundPlay_isActive() ;put a function here EndFunc
      There is a way to recognize if SoundPlay is active or not?
      Thanks