Pieter Posted August 28, 2006 Posted August 28, 2006 Simple example:$dir = StringTrimRight(@AutoItExe, 8) FileChangeDir($dir) FileInstall("chimes.wav", "chimes_sound.wav") SoundPlay("chimes_sound.wav") Sleep(6000) FileDelete("chimes_sound.wav")For some reason, it won't delete 'chimes_sound.wav'. Why?(Chimes.wav can of course be found in C:\Windows\Media) iPod + Online calendars = iPodCALsync
MHz Posted August 28, 2006 Posted August 28, 2006 This works for me.Const $AUTOITDIR = _AutoItDir() If FileChangeDir($AUTOITDIR) Then FileInstall('chimes.wav', 'chimes_sound.wav') SoundPlay('chimes_sound.wav') Sleep(6000) SoundPlay('') If FileDelete('chimes_sound.wav') Then MsgBox(0, @ScriptName, 'FileDelete Successful') EndIf EndIf Exit Func _AutoItDir() Return StringLeft(@AutoItExe, StringInStr(@AutoItExe, '\', 0, -1)-1) EndFuncSeems like your perhaps leaving a handle open on the wav file which locks it, so the FileDelete() fails. Calling SoundPlay() again with a empty string parameter tends to close the handle and FileDelete() succeeds.If you do set the optional wait parameter to 1 for SoundPlay(), then it seems to close the handle upon return of the function call so FileDelete() succeeds.
Xenobiologist Posted August 28, 2006 Posted August 28, 2006 HI, problem is your SoundPlay() the the flag to wait until the sound is done. The first line is also ... ... Have a look $dir = StringTrimRight(@AutoItExe, 8) MsgBox(0,"",$dir) ConsoleWrite("FCD: " & FileChangeDir($dir)) ; 1 success ConsoleWrite("FI: " & FileInstall(@WindowsDir & "\Media\chimes.wav", @ScriptDir & "\chimes_sound.wav", 1)) ; 1 success SoundPlay("chimes_sound.wav", 1) If FileExists(@ScriptDir & "\chimes_sound.wav") Then ConsoleWrite("FD: " & FileDelete(@ScriptDir & "\chimes_sound.wav")) ; 1 succes So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Pieter Posted August 28, 2006 Author Posted August 28, 2006 Fixed. I declare my program hereby for finished! iPod + Online calendars = iPodCALsync
Xenobiologist Posted August 28, 2006 Posted August 28, 2006 Fixed.I declare my program hereby for finished! Kudos! Share it :-)So long,Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
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