Sign in to follow this  
Followers 0
Total_newbie

Unable to delete running script OnExifFunc

2 posts in this topic

Hi Guys,

I've been fighting with this issue in the last hour.

I'm trying to delete my compiled script when exiting the script. I'm using @AutoitExe to get the script name that needs to be delete but FileDelete is not deleting this file.

My code is below

Opt("OnExitFunc","_Cleanup")

$file = FileOpen("test.txt", 0)

$output="log.txt"

$handle = FileOpen($output,1)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

FileWriteLine($output, "Line read:" & $line)

Wend

FileClose($file)

FileClose($handle)

Func _Cleanup()

FileDelete(@AutoitExe)

EndFunc

Share this post


Link to post
Share on other sites



in scite... type in "selfdelete" and press the space bar

8)


NEWHeader1.png

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