Jump to content

Soundplay stopped working


rm65453
 Share

Recommended Posts

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.

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

rm65453,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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.

Link to comment
Share on other sites

  • Moderators

rm65453,

I actually meant just:

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

Does the file play in other players?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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?

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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.

Link to comment
Share on other sites

  • Moderators

rm65453,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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
Link to comment
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
 Share

×
×
  • Create New...