tinman_72 Posted April 29, 2017 Share Posted April 29, 2017 I have a script that I wanted to play a "goodbye" sound when exiting. I used FileInstall to copy the wav file to @TempDir. Being the neat freak that I am I want to delete the file after it is played. I used FileDelete at the end of my script to delete it but the file will not delete. Apparently, the script keeps the file in use so it cannot be deleted. What is the proper way to use a file as a temporary file and delete it when done? Thanks, Derek Link to comment Share on other sites More sharing options...
MattHiggs Posted April 29, 2017 Share Posted April 29, 2017 Why don't you try including a function that deletes the file when the script closes. Try this: OnAutoItExitRegister ( "deletefile" ) ;code goes here Func deletefile () Run ( @ComSpec & ' /c timeout 4 & del "PAth\to\file.wav"' ) Exit EndFunc 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