rm65453 Posted February 2, 2016 Posted February 2, 2016 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.
Moderators Melba23 Posted February 2, 2016 Moderators Posted February 2, 2016 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rm65453 Posted February 2, 2016 Author Posted February 2, 2016 (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 February 2, 2016 by rm65453
Moderators Melba23 Posted February 2, 2016 Moderators Posted February 2, 2016 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rm65453 Posted February 2, 2016 Author Posted February 2, 2016 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.
Moderators Melba23 Posted February 2, 2016 Moderators Posted February 2, 2016 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rm65453 Posted February 2, 2016 Author Posted February 2, 2016 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.
Moderators Melba23 Posted February 2, 2016 Moderators Posted February 2, 2016 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rm65453 Posted February 2, 2016 Author Posted February 2, 2016 tried to play another file, still nothing. are there other options to play a wav or mp3 file?
Moderators Melba23 Posted February 2, 2016 Moderators Posted February 2, 2016 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rm65453 Posted February 2, 2016 Author Posted February 2, 2016 No changes that I can aware off. I can ask the IT dept to confirm as well.
rm65453 Posted February 3, 2016 Author Posted February 3, 2016 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?
MuffinMan Posted February 3, 2016 Posted February 3, 2016 Does it have to be a certain sound, or just any audio cue? You might try Beep(), I don't know if it uses WMP or not, but I doubt it. https://www.autoitscript.com/autoit3/docs/functions/Beep.htm
rm65453 Posted February 5, 2016 Author Posted February 5, 2016 Unfortunately has to be an audio file, wav or mp3.
nend Posted February 5, 2016 Posted February 5, 2016 You can use Bass.dll there is a UDF on the forum for that and it's not relying on the windows mediaplayer.
Moderators Melba23 Posted February 5, 2016 Moderators Posted February 5, 2016 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rm65453 Posted February 6, 2016 Author Posted February 6, 2016 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.
Moderators Melba23 Posted February 6, 2016 Moderators Posted February 6, 2016 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rm65453 Posted February 11, 2016 Author Posted February 11, 2016 (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 February 11, 2016 by rm65453
ViciousXUSMC Posted February 11, 2016 Posted February 11, 2016 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")
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