Sign in to follow this  
Followers 0
tinman_72

Deleting temp files placed via FileInstall

2 posts in this topic

#1 ·  Posted

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

Share this post


Link to post
Share on other sites



#2 ·  Posted

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

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0