sTYLE Posted February 6, 2012 Share Posted February 6, 2012 (edited) Okay so now I've figured out the sound I thought I'd add buttons. So the start button works perfectly Func button5() $msg=$button5= SoundPlay(@WindowsDir & "LibrariesMusicahh.wav") EndFunc But the Stop button doesn't work. I tried both _SoundStop and SoundStop. Are they both wrong or have i gone wrong? $button4=GUICtrlCreateButton("Stop Music",184,100,85,40) $button5=GUICtrlCreateButton("Start Music",184,60,85,40) Func button4() $msg=$button4= SoundStop(@WindowsDir & "LibrariesMusicahh.wav") EndFunc If $msg=$button4 Then button4() If $msg=$button5 Then button5() The error is: $msg=$button4= SoundStop(@WindowsDir & "LibrariesMusicahh.wav") $msg=$button4= ^ ERROR Edited February 6, 2012 by sTYLE Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 6, 2012 Share Posted February 6, 2012 There's no SoundStop(), and _SoundStop() doesn't work like that. Check the helpfile! .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
sTYLE Posted February 6, 2012 Author Share Posted February 6, 2012 There's no SoundStop(), and _SoundStop() doesn't work like that. Check the helpfile!I did, but It's just so confusing.. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted February 6, 2012 Share Posted February 6, 2012 Did you look at the examples then? It's not confusing if you just read. Also please use a meaningful title next time you create a thread. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 6, 2012 Moderators Share Posted February 6, 2012 Hi, STYLE. Look at the helpfile under SoundPlay(), it gives you an example of how to stop the current sound with another call to SoundPlay. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
sTYLE Posted February 6, 2012 Author Share Posted February 6, 2012 Did you look at the examples then? It's not confusing if you just read. Also please use a meaningful title next time you create a thread.Yes, It's confusing, all's I need is the stop sound code, whatever it is. Link to comment Share on other sites More sharing options...
sTYLE Posted February 6, 2012 Author Share Posted February 6, 2012 Hi, STYLE. Look at the helpfile under SoundPlay(), it gives you an example of how to stop the current sound with another call to SoundPlay._SoundClose($aSound) This? So I'm guessing ($aSound) means your directory to the sound? e.g. @WindowsDir & "LibrariesMusicahh.wav"if so.. That didn't work. Link to comment Share on other sites More sharing options...
czardas Posted February 7, 2012 Share Posted February 7, 2012 (edited) Did you run the helpfile example as AdmiralWhiteHatAlkex suggested? I've simplified it a bit for you. #include <Sound.au3> ;open sound file : must be modified if run under Vista $sound = _SoundOpen(@WindowsDir & "mediaWindows XP Startup.wav") ; replace with an existing sound file if necessary If @error Then Exit ; In case the file doesn't exist or other issues opening the file _SoundPlay($sound) While 1 Sleep(100) If _SoundPos($sound, 2) >= 1000 Then ; After 1 second stop the sound _SoundStop($sound) ExitLoop EndIf WEnd _SoundClose($sound) I doubt this simple script will work on vista. I haven't read enough about it. I still have XP. Edited February 7, 2012 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 7, 2012 Moderators Share Posted February 7, 2012 The helpfile states, use SoundPlay("") to stop a playing sound and close the open handle. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 7, 2012 Moderators Share Posted February 7, 2012 (edited) sTYLE,You are confusing the native AutoIt function SoundPlay and the functions within the Sound.au3 UDF which all begin with an underscore like this _Sound*. As is often the case in AutoIt you cannot mix them. If you used SoundPlay to start playing the file then you need to do as JLogan3o13 sugested and reuse SoundPlay to stop it. If you want to use the more comprehensive range of functions from the Sound UDF then czardas has shown you how. And as to the Helpfile being confusing - do you realise how lucky you are to have such a comprehensive aid to learning AutoIt? It is without doubt the best Help file I have ever seen and is constantly being improved thanks to the community and its editors (particulariy guinness). You just need to take the time to read it carefully and look at the examples. M23Edit: And the Admiral has a valid point about the thread title - please use sensible titles in future or you may find the thread being locked. Edited February 7, 2012 by Melba23 Fingerwagging 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 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