anixon Posted November 27, 2009 Share Posted November 27, 2009 I have been experiencing a Windows/Notebook.exe in that application when opening a file created by AutoIT and 'Access Denied' situation because the files Windows privileges no longer give the origionator/user of the file or an user with administrator privileges access. In addition whilst the AutoIT script is running you are unable to delete the corrupt file. The uncorrupt file being corrupted is during a process being assigned to a variable as an email attachement for example: $EmailAttachment = @scriptdir & "fileattachment.txt" Before it is passed to a CDO processes it is possible that the script updates the 'fileattachment.txt" which has already been assigned to an unprocessed variable. The email and its attachcment is received by the recipient but the fileattaqchment.txt is corrupt and cannot be deleted with the command filedelete(@scriptdir & "fileattachment.txt") even with full access privileges using fileattribute(@scriptdir & "fileattachment.txt", "-R") and then delete makes no difference. The simply question is this process the cause of the file being corrupted. Replies are always appreciated Ant.. Link to comment Share on other sites More sharing options...
99ojo Posted November 27, 2009 Share Posted November 27, 2009 (edited) Hi,1) See helpfile @ScriptDir:@ScriptDir Directory containing the running script. (Result does not contain a trailing backslash)-> filedelete(@scriptdir & "\fileattachment.txt")2) You may have an open file by the script -> e.g. $file = FileOpen ("fileattachment.txt", 2). If you don't close the filehandle (FileClose ($file)) before the FileDelete, you can't delete the file.;-))Stefan Edited November 27, 2009 by 99ojo 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